0619108abcd45036b8d861e2141e4572a211dae5
1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../../../shared/a_modes.inc}
25 procedure r_GUI_GetSize (ctrl
: TGUIControl
; out w
, h
: Integer);
26 procedure r_GUI_GetLogoSize (out w
, h
: Integer);
27 procedure r_GUI_GetMaxFontSize (BigFont
: Boolean; out w
, h
: Integer);
28 procedure r_GUI_GetStringSize (BigFont
: Boolean; str
: String; out w
, h
: Integer);
30 procedure r_GUI_Draw_Window (win
: TGUIWindow
);
35 Classes
, Math
, SysUtils
,
37 g_basic
, g_base
, e_input
, g_options
,
38 r_draw
, r_textures
, r_common
, r_map
,
46 Box
: Array [0..8] of TGLTexture
;
47 MarkerID
: array [Boolean] of TGLTexture
;
48 ScrollLeft
, ScrollRight
, ScrollMiddle
, ScrollMarker
: TGLTexture
;
49 EditLeft
, EditRight
, EditMiddle
: TGLTexture
;
50 BScrollUp
, BScrollDown
: array [Boolean] of TGLTexture
;
51 BScrollMiddle
: TGLTexture
;
53 Font
: array [boolean] of TGLFont
; (* Small[FALSE] / Big[TRUE] *)
57 Background
: THereTexture
;
58 ImageControl
: THereTexture
;
63 Font
[FALSE] := smallfont
;
64 Font
[TRUE] := menufont
;
66 MarkerID
[FALSE] := r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/MARKER1');
67 MarkerID
[TRUE] := r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/MARKER2');
70 Box
[i
] := r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/BOX' + IntToStr(i
+ 1));
72 ScrollLeft
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SLEFT');
73 ScrollRight
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SRIGHT');
74 ScrollMiddle
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SMIDDLE');
75 ScrollMarker
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SMARKER');
77 EditLeft
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/ELEFT');
78 EditRight
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/ERIGHT');
79 EditMiddle
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/EMIDDLE');
81 BScrollUp
[true] := r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SCROLLUPA');
82 BScrollUp
[false] := r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SCROLLUPU');
83 BScrollDown
[true] := r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SCROLLDOWNA');
84 BScrollDown
[false] := r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SCROLLDOWNU');
85 BScrollMiddle
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/SCROLLMIDDLE');
87 LogoTex
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/MAINLOGO');
88 nopic
:= r_Textures_LoadFromFile(GameWad
+ ':TEXTURES/NOPIC');
112 BScrollUp
[true].Free
;
113 BScrollUp
[false].Free
;
114 BScrollDown
[true].Free
;
115 BScrollDown
[false].Free
;
121 r_Common_FreeThis(Background
);
122 r_Common_FreeThis(ImageControl
);
125 procedure r_GUI_GetMaxFontSize (BigFont
: Boolean; out w
, h
: Integer);
129 w
:= f
.GetMaxWidth();
130 h
:= f
.GetMaxHeight();
133 procedure r_GUI_GetStringSize (BigFont
: Boolean; str
: String; out w
, h
: Integer);
135 r_Draw_GetTextSize(str
, Font
[BigFont
], w
, h
);
138 procedure r_GUI_GetLogoSize (out w
, h
: Integer);
141 if LogoTex
<> nil then
148 procedure r_GUI_GetSize_TextButton (ctrl
: TGUITextButton
; out w
, h
: Integer);
150 r_Draw_GetTextSize(ctrl
.Caption
, Font
[ctrl
.BigFont
], w
, h
);
153 procedure r_GUI_GetSize_Label (ctrl
: TGUILabel
; out w
, h
: Integer);
156 f
:= Font
[ctrl
.BigFont
];
157 r_Draw_GetTextSize(ctrl
.Text, f
, w
, h
);
158 if ctrl
.FixedLength
<> 0 then
159 w
:= f
.GetMaxWidth() * ctrl
.FixedLength
;
162 procedure r_GUI_GetSize_Switch (ctrl
: TGUISwitch
; out w
, h
: Integer);
166 if ctrl
.Items
<> nil then
167 for i
:= 0 to High(ctrl
.Items
) do
168 r_Draw_GetTextSize(ctrl
.Items
[i
], Font
[ctrl
.BigFont
], w
, h
);
171 procedure r_GUI_GetSize_KeyRead (ctrl
: TGUIKeyRead
; out w
, h
: Integer);
172 var i
, ww
, hh
: Integer; f
: TGLFont
;
174 w
:= 0; h
:= 0; // ??? h always 0
175 f
:= Font
[ctrl
.BigFont
];
178 r_Draw_GetTextSize(e_KeyNames
[i
], f
, ww
, hh
);
181 r_Draw_GetTextSize(KEYREAD_QUERY
, f
, ww
, hh
);
183 r_Draw_GetTextSize(KEYREAD_CLEAR
, f
, ww
, hh
);
187 procedure r_GUI_GetSize (ctrl
: TGUIControl
; out w
, h
: Integer);
191 if ctrl
is TGUITextButton
then
192 r_GUI_GetSize_TextButton(ctrl
as TGUITextButton
, w
, h
)
193 else if ctrl
is TGUILabel
then
194 r_GUI_GetSize_Label(ctrl
as TGUILabel
, w
, h
)
195 else if ctrl
is TGUIScroll
then
196 w
:= 16 + ((ctrl
as TGUIScroll
).Max
+ 1) * 8 // ??? but h = 0
197 else if ctrl
is TGUISwitch
then
198 r_GUI_GetSize_Switch(ctrl
as TGUISwitch
, w
, h
)
199 else if ctrl
is TGUIEdit
then
200 w
:= 16 + (ctrl
as TGUIEdit
).Width
* 16 // ??? but h = 0
201 else if ctrl
is TGUIKeyRead
then
202 r_GUI_GetSize_KeyRead(ctrl
as TGUIKeyRead
, w
, h
)
203 else if ctrl
is TGUIKeyRead2
then
204 w
:= (ctrl
as TGUIKeyRead2
).MaxKeyNameWdt
* 2 + 8 + 8 + 16 // ??? but h = 0
205 else if ctrl
is TGUIListBox
then
207 w
:= 8 + ((ctrl
as TGUIListBox
).Width
+ 1) * 16; // recheck w & h
208 h
:= 8 + (ctrl
as TGUIListBox
).Height
* 16;
210 else if ctrl
is TGUIMemo
then
212 w
:= 8 + ((ctrl
as TGUIMemo
).Width
+ 1) * 16;
213 h
:= 8 + (ctrl
as TGUIMemo
).Height
* 16;
217 w
:= ctrl
.GetWidth();
218 h
:= ctrl
.GetHeight();
222 procedure r_GUI_Draw_Control (ctrl
: TGUIControl
); forward;
224 procedure r_GUI_Draw_TextButton (ctrl
: TGUITextButton
);
226 r_Draw_Text(ctrl
.Caption
, ctrl
.x
, ctrl
.y
, ctrl
.Color
.R
, ctrl
.Color
.G
, ctrl
.Color
.B
, 255, Font
[ctrl
.BigFont
]);
229 procedure r_GUI_Draw_Label (ctrl
: TGUILabel
);
230 var w
, h
: Integer; f
: TGLFont
;
232 f
:= Font
[ctrl
.BigFont
];
233 if ctrl
.RightAlign
then
235 r_Draw_GetTextSize(ctrl
.Text, f
, w
, h
);
236 r_Draw_Text(ctrl
.Text, ctrl
.X
+ ctrl
.CMaxWidth
- w
, ctrl
.Y
, ctrl
.Color
.R
, ctrl
.Color
.G
, ctrl
.Color
.B
, 255, f
);
239 r_Draw_Text(ctrl
.Text, ctrl
.X
, ctrl
.Y
, ctrl
.Color
.R
, ctrl
.Color
.G
, ctrl
.Color
.B
, 255, f
);
242 procedure r_GUI_Draw_Scroll (ctrl
: TGUIScroll
);
244 r_Draw_Texture(ScrollLeft
, ctrl
.X
, ctrl
.Y
, ScrollLeft
.width
, ScrollLeft
.height
, false, 255, 255, 255, 255, false);
245 r_Draw_TextureRepeat(ScrollMiddle
, ctrl
.X
+ 8 + 0 * 8, ctrl
.Y
, 8 + ctrl
.Max
* 8, ScrollMiddle
.height
, false, 255, 255, 255, 255, false);
246 r_Draw_Texture(ScrollRight
, ctrl
.X
+ 8 + (ctrl
.Max
+ 1) * 8, ctrl
.Y
, ScrollRight
.width
, ScrollRight
.height
, false, 255, 255, 255, 255, false);
247 r_Draw_Texture(ScrollMarker
, ctrl
.X
+ 8 + ctrl
.Value
* 8, ctrl
.Y
, ScrollMarker
.width
, ScrollMarker
.height
, false, 255, 255, 255, 255, false);
250 procedure r_GUI_Draw_Switch (ctrl
: TGUISwitch
);
252 r_Draw_Text(ctrl
.Items
[ctrl
.ItemIndex
], ctrl
.X
, ctrl
.Y
, ctrl
.Color
.R
, ctrl
.Color
.G
, ctrl
.Color
.B
, 255, Font
[ctrl
.BigFont
]);
255 procedure r_GUI_Draw_Edit (ctrl
: TGUIEdit
);
256 var w
, h
: Integer; r
, g
, b
: Byte; f
: TGLFont
;
258 r_Draw_Texture(EditLeft
, ctrl
.X
, ctrl
.Y
, EditLeft
.width
, EditLeft
.height
, false, 255, 255, 255, 255, false);
259 r_Draw_TextureRepeat(EditMiddle
, ctrl
.X
+ 8, ctrl
.Y
, 8 + (ctrl
.Width
- 1) * 16, EditMiddle
.height
, false, 255, 255, 255, 255, false);
260 r_Draw_Texture(EditRight
, ctrl
.X
+ 8 + ctrl
.Width
* 16, ctrl
.Y
, EditRight
.width
, EditRight
.height
, false, 255, 255, 255, 255, false);
264 if ctrl
.Invalid
and (ctrl
.Window
.ActiveControl
<> ctrl
) then
270 f
:= Font
[ctrl
.BigFont
];
271 r_Draw_Text(ctrl
.Text, ctrl
.X
+ 8, ctrl
.Y
, r
, g
, b
, 255, f
);
272 if ctrl
.Window
.ActiveControl
= ctrl
then
274 r_Draw_GetTextSize(Copy(ctrl
.Text, 1, ctrl
.CaretPos
), f
, w
, h
);
275 r_Draw_FillRect(ctrl
.X
+ 8 + w
, ctrl
.Y
+ h
- 4, ctrl
.X
+ 8 + w
+ EDIT_CURSORLEN
, ctrl
.Y
+ h
- 2, 200, 0, 0, 255);
279 procedure r_GUI_Draw_KeyRead (ctrl
: TGUIKeyRead
);
284 else if ctrl
.Key
<> 0 then
285 k
:= e_KeyNames
[ctrl
.Key
]
288 r_Draw_Text(k
, ctrl
.X
, ctrl
.Y
, ctrl
.Color
.R
, ctrl
.Color
.G
, ctrl
.Color
.B
, 255, Font
[ctrl
.BigFont
]);
291 procedure r_GUI_Draw_KeyRead2 (ctrl
: TGUIKeyRead2
);
293 procedure drawText (idx
: Integer);
294 var x
, y
: Integer; r
, g
, b
: Byte; kk
: DWORD
; str
: AnsiString;
296 if idx
= 0 then kk
:= ctrl
.Key0
else kk
:= ctrl
.Key1
;
298 if idx
= 0 then x
:= ctrl
.X
+ 8 else x
:= ctrl
.X
+ 8 + ctrl
.MaxKeyNameWdt
+ 16;
299 r
:= 255; g
:= 0; b
:= 0;
300 if ctrl
.KeyIdx
= idx
then
302 r
:= 255; g
:= 255; b
:= 255;
304 if ctrl
.IsQuery
and (ctrl
.KeyIdx
= idx
) then
307 str
:= e_KeyNames
[kk
]
309 str
:= KEYREAD_CLEAR
;
310 r_Draw_Text(str
, x
, y
, r
, g
, b
, 255, Font
[ctrl
.BigFont
]);
318 procedure DrawBox (x
, y
, w
, h
: Integer);
320 r_Draw_Texture(Box
[0], x
, y
, 4, 4, false, 255, 255, 255, 255, false);
321 r_Draw_TextureRepeat(Box
[1], x
+ 4, y
, w
* 16, 4, false, 255, 255, 255, 255, false);
322 r_Draw_Texture(Box
[2], x
+ 4 + w
* 16, y
, 4, 4, false, 255, 255, 255, 255, false);
324 r_Draw_TextureRepeat(Box
[3], x
, y
+ 4, 4, h
* 16, false, 255, 255, 255, 255, false);
325 r_Draw_TextureRepeat(Box
[4], x
+ 4, y
+ 4, w
* 16, h
* 16, false, 255, 255, 255, 255, false);
326 r_Draw_TextureRepeat(Box
[5], x
+ 4 + w
* 16, y
+ 4, 4, h
* 16, false, 255, 255, 255, 255, false);
328 r_Draw_Texture(Box
[6], x
, y
+ 4 + h
* 16, 4, 4, false, 255, 255, 255, 255, false);
329 r_Draw_TextureRepeat(Box
[7], x
+ 4, y
+ 4 + h
* 16, w
* 16, 4, false, 255, 255, 255, 255, false);
330 r_Draw_Texture(Box
[8], x
+ 4 + w
* 16, y
+ 4 + h
* 16, 4, 4, false, 255, 255, 255, 255, false);
333 procedure r_GUI_Draw_ModelView (ctrl
: TGUIModelView
);
335 DrawBox(ctrl
.X
, ctrl
.Y
, 4, 4);
336 if ctrl
.Model
<> nil then
337 r_Map_DrawPlayerModel(ctrl
.Model
, ctrl
.X
+ 4, ctrl
.Y
+ 4, 255);
340 procedure r_GUI_Draw_MapPreview (ctrl
: TGUIMapPreview
);
341 var a
: Integer; r
, g
, b
: Byte;
343 DrawBox(ctrl
.X
, ctrl
.Y
, MAPPREVIEW_WIDTH
, MAPPREVIEW_HEIGHT
);
344 if (ctrl
.MapSize
.X
<= 0) or (ctrl
.MapSize
.Y
<= 0) then
346 r_Draw_FillRect(ctrl
.X
+ 4, ctrl
.Y
+ 4, ctrl
.X
+ 4 + Trunc(ctrl
.MapSize
.X
/ ctrl
.Scale
), ctrl
.Y
+ 4 + Trunc(ctrl
.MapSize
.Y
/ ctrl
.Scale
), 32, 32, 32, 255);
347 if ctrl
.MapData
<> nil then
348 for a
:= 0 to High(ctrl
.MapData
) do
349 with ctrl
.MapData
[a
] do
351 if X1
> MAPPREVIEW_WIDTH
* 16 then Continue
;
352 if Y1
> MAPPREVIEW_HEIGHT
* 16 then Continue
;
353 if X2
< 0 then Continue
;
354 if Y2
< 0 then Continue
;
355 if X2
> MAPPREVIEW_WIDTH
* 16 then X2
:= MAPPREVIEW_WIDTH
* 16;
356 if Y2
> MAPPREVIEW_HEIGHT
* 16 then Y2
:= MAPPREVIEW_HEIGHT
* 16;
357 if X1
< 0 then X1
:= 0;
358 if Y1
< 0 then Y1
:= 0;
362 r
:= 255; g
:= 255; b
:= 255;
366 r
:= 255; g
:= 255; b
:= 0;
370 r
:= 0; g
:= 0; b
:= 192;
374 r
:= 0; g
:= 176; b
:= 0;
378 r
:= 176; g
:= 0; b
:= 0;
381 r
:= 128; g
:= 128; b
:= 128;
383 if ((X2
- X1
) > 0) and ((Y2
- Y1
) > 0) then
384 r_Draw_FillRect(ctrl
.X
+ 4 + X1
, ctrl
.Y
+ 4 + Y1
, ctrl
.X
+ 4 + X2
, ctrl
.Y
+ 4 + Y2
, r
, g
, b
, 255);
388 procedure r_GUI_Draw_Image (ctrl
: TGUIImage
);
392 if ctrl
.ImageRes
<> '' then
393 if r_Common_LoadThis(ctrl
.ImageRes
, ImageControl
) then
394 pic
:= ImageControl
.id
;
396 r_Draw_Texture(pic
, ctrl
.x
, ctrl
.y
, pic
.width
, pic
.height
, false, 255, 255, 255, 255, false);
399 procedure DrawScroll(x
, y
, h
: Integer; Up
, Down
: Boolean);
405 r_Draw_Texture(t
, x
, y
, t
.width
, t
.height
, false, 255, 255, 255, 255, false);
406 t
:= BScrollDown
[Down
];
407 r_Draw_Texture(t
, x
, y
+ (h
- 1) * 16, t
.width
, t
.height
, false, 255, 255, 255, 255, false);
409 r_Draw_TextureRepeat(t
, x
, y
+ 16, t
.width
, (h
- 2) * 16, false, 255, 255, 255, 255, false);
413 procedure r_GUI_Draw_ListBox (ctrl
: TGUIListBox
); // + TGUIFileListBox
414 var a
, w2
, h2
: Integer; s
: string; col
: TRGB
; f
: TGLFont
;
416 if ctrl
.DrawBack
then
417 DrawBox(ctrl
.X
, ctrl
.Y
, ctrl
.Width
+ 1, ctrl
.Height
);
418 if ctrl
.DrawScrollBar
then
419 DrawScroll(ctrl
.X
+ 4 + ctrl
.Width
* 16, ctrl
.Y
+ 4, ctrl
.Height
, (ctrl
.StartLine
> 0) and (ctrl
.Items
<> nil), (ctrl
.StartLine
+ ctrl
.Height
- 1 < High(ctrl
.Items
)) and (ctrl
.Items
<> nil));
420 if ctrl
.Items
<> nil then
422 f
:= Font
[ctrl
.BigFont
];
423 for a
:= ctrl
.StartLine
to Min(High(ctrl
.Items
), ctrl
.StartLine
+ ctrl
.Height
- 1) do
426 r_Draw_GetTextSize(s
, f
, w2
, h2
);
427 while (Length(s
) > 0) and (w2
> ctrl
.Width
* 16) do
429 SetLength(s
, Length(s
) - 1);
430 r_Draw_GetTextSize(s
, f
, w2
, h2
);
432 if a
= ctrl
.ItemIndex
then col
:= ctrl
.ActiveColor
else col
:= ctrl
.UnActiveColor
;
433 r_Draw_Text(s
, ctrl
.X
+ 4, ctrl
.Y
+ 4 + (a
- ctrl
.StartLine
) * 16, col
.r
, col
.g
, col
.b
, 255, f
);
438 procedure r_GUI_Draw_Memo (ctrl
: TGUIMemo
);
441 if ctrl
.DrawBack
then
442 DrawBox(ctrl
.X
, ctrl
.Y
, ctrl
.Width
+ 1, ctrl
.Height
);
443 if ctrl
.DrawScrollBar
then
444 DrawScroll(ctrl
.X
+ 4 + ctrl
.Width
* 16, ctrl
.Y
+ 4, ctrl
.Height
, (ctrl
.StartLine
> 0) and (ctrl
.Lines
<> nil), (ctrl
.StartLine
+ ctrl
.Height
- 1 < High(ctrl
.Lines
)) and (ctrl
.Lines
<> nil));
445 if ctrl
.Lines
<> nil then
446 for i
:= ctrl
.StartLine
to Min(High(ctrl
.Lines
), ctrl
.StartLine
+ ctrl
.Height
- 1) do
447 r_Draw_Text(ctrl
.Lines
[i
], ctrl
.X
+ 4, ctrl
.Y
+ 4 + (i
- ctrl
.StartLine
) * 16, ctrl
.Color
.R
, ctrl
.Color
.G
, ctrl
.Color
.B
, 255, Font
[ctrl
.BigFont
]);
450 procedure r_GUI_Draw_MainMenu (ctrl
: TGUIMainMenu
);
451 var i
, w
, h
: Integer; ID
: TGLTexture
;
453 if ctrl
.Header
<> nil then
455 r_GUI_Draw_Label(ctrl
.Header
)
457 else if LogoTex
<> nil then
459 r_GUI_GetLogoSize(w
, h
);
460 r_Draw_Texture(LogoTex
, ((gScreenWidth
div 2) - (w
div 2)), ctrl
.Buttons
[0].Y
- ctrl
.Buttons
[0].GetHeight
- h
, w
, h
, false, 255, 255, 255, 255, false);
462 if ctrl
.Buttons
<> nil then
464 for i
:= 0 to High(ctrl
.Buttons
) do
465 if ctrl
.Buttons
[i
] <> nil then
466 r_GUI_Draw_TextButton(ctrl
.Buttons
[i
]);
467 if ctrl
.Index
<> -1 then
469 ID
:= MarkerID
[ctrl
.Counter
DIV MAINMENU_MARKERDELAY
MOD 2 <> 0];
470 r_Draw_Texture(ID
, ctrl
.Buttons
[ctrl
.Index
].X
- 48, ctrl
.Buttons
[ctrl
.Index
].Y
, ID
.width
, ID
.height
, false, 255, 255, 255, 255, false);
475 procedure r_GUI_Draw_Menu (ctrl
: TGUIMenu
);
476 var a
, locx
, locy
: Integer; f
: TGLFont
;
478 if ctrl
.Header
<> nil then
479 r_GUI_Draw_Label(ctrl
.Header
);
480 if ctrl
.Items
<> nil then
482 for a
:= 0 to High(ctrl
.Items
) do
484 if ctrl
.Items
[a
].Text <> nil then
485 r_GUI_Draw_Control(ctrl
.Items
[a
].Text);
486 if ctrl
.Items
[a
].Control
<> nil then
487 r_GUI_Draw_Control(ctrl
.Items
[a
].Control
);
490 if (ctrl
.Index
<> -1) and (ctrl
.Counter
> MENU_MARKERDELAY
div 2) then
494 if ctrl
.Items
[ctrl
.Index
].Text <> nil then
496 locx
:= ctrl
.Items
[ctrl
.Index
].Text.X
;
497 locy
:= ctrl
.Items
[ctrl
.Index
].Text.Y
;
499 if ctrl
.Items
[ctrl
.Index
].Text.RightAlign
then
501 locx
:= locx
+ ctrl
.Items
[ctrl
.Index
].Text.CMaxWidth
- ctrl
.Items
[ctrl
.Index
].Text.GetWidth
;
504 else if ctrl
.Items
[ctrl
.Index
].Control
<> nil then
506 locx
:= ctrl
.Items
[ctrl
.Index
].Control
.X
;
507 locy
:= ctrl
.Items
[ctrl
.Index
].Control
.Y
;
509 f
:= Font
[ctrl
.BigFont
];
510 locx
:= locx
- f
.GetMaxWidth();
511 r_Draw_Text(#16, locx
, locy
, 255, 0, 0, 255, f
);
515 procedure r_GUI_Draw_Control (ctrl
: TGUIControl
);
517 if ctrl
is TGUITextButton
then
518 r_GUI_Draw_TextButton(TGUITextButton(ctrl
))
519 else if ctrl
is TGUILabel
then
520 r_GUI_Draw_Label(TGUILabel(ctrl
))
521 else if ctrl
is TGUIScroll
then
522 r_GUI_Draw_Scroll(TGUIScroll(ctrl
))
523 else if ctrl
is TGUISwitch
then
524 r_GUI_Draw_Switch(TGUISwitch(ctrl
))
525 else if ctrl
is TGUIEdit
then
526 r_GUI_Draw_Edit(TGUIEdit(ctrl
))
527 else if ctrl
is TGUIKeyRead
then
528 r_GUI_Draw_KeyRead(TGUIKeyRead(ctrl
))
529 else if ctrl
is TGUIKeyRead2
then
530 r_GUI_Draw_KeyRead2(TGUIKeyRead2(ctrl
))
531 else if ctrl
is TGUIModelView
then
532 r_GUI_Draw_ModelView(TGUIModelView(ctrl
))
533 else if ctrl
is TGUIMapPreview
then
534 r_GUI_Draw_MapPreview(TGUIMapPreview(ctrl
))
535 else if ctrl
is TGUIImage
then
536 r_GUI_Draw_Image(TGUIImage(ctrl
))
537 else if ctrl
is TGUIListBox
then
538 r_GUI_Draw_ListBox(TGUIListBox(ctrl
)) // + TGUIFileListBox
539 else if ctrl
is TGUIMemo
then
540 r_GUI_Draw_Memo(TGUIMemo(ctrl
))
541 else if ctrl
is TGUIMainMenu
then
542 r_GUI_Draw_MainMenu(TGUIMainMenu(ctrl
))
543 else if ctrl
is TGUIMenu
then
544 r_GUI_Draw_Menu(TGUIMenu(ctrl
))
549 procedure r_GUI_Draw_Window (win
: TGUIWindow
);
550 var i
, tw
, th
: Integer;
552 // Here goes code duplication from g_game.pas:DrawMenuBackground()
553 if win
.BackTexture
<> '' then
554 if r_Common_LoadThis(win
.BackTexture
, Background
) then
556 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, 255);
557 tw
:= Background
.id
.width
;
558 th
:= Background
.id
.height
;
560 tw
:= round(tw
* 1.333 * (gScreenHeight
/ th
))
562 tw
:= trunc(tw
* (gScreenHeight
/ th
));
563 r_Draw_Texture(Background
.id
, (gScreenWidth
- tw
) div 2, 0, tw
, gScreenHeight
, false, 255, 255, 255, 255, false);
566 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 127, 127, 127, 255);
569 if win
.Name
= 'AuthorsMenu' then
570 r_Draw_FillRect(0, 0, gScreenWidth
- 1, gScreenHeight
- 1, 0, 0, 0, 105);
571 for i
:= 0 to High(win
.Childs
) do
572 if win
.Childs
[i
] <> nil then
573 r_GUI_Draw_Control(win
.Childs
[i
]);