diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 9641d686e8b97d82354f41000b3bdbb74d7306a6..5e6d9b2f45e18fa882580f35c7d2edb6e01e1740 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
interface
-uses
- {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
- g_base, e_input, e_log, g_playermodel, g_basic, MAPDEF, utils;
+ uses
+ {$IFDEF USE_MEMPOOL}
+ mempool,
+ {$ENDIF}
+ g_base, g_playermodel, MAPDEF, utils
+ ;
const
- MAINMENU_HEADER_COLOR: TRGB = (R:255; G:255; B:255);
+
MAINMENU_ITEMS_COLOR: TRGB = (R:255; G:255; B:255);
MAINMENU_UNACTIVEITEMS_COLOR: TRGB = (R:192; G:192; B:192);
- MAINMENU_CLICKSOUND = 'MENU_SELECT';
- MAINMENU_CHANGESOUND = 'MENU_CHANGE';
+ MAINMENU_HEADER_COLOR: TRGB = (R:255; G:255; B:255);
MAINMENU_SPACE = 4;
- MAINMENU_MARKER1 = 'MAINMENU_MARKER1';
- MAINMENU_MARKER2 = 'MAINMENU_MARKER2';
MAINMENU_MARKERDELAY = 24;
- WINDOW_CLOSESOUND = 'MENU_CLOSE';
- MENU_HEADERCOLOR: TRGB = (R:255; G:255; B:255);
+
MENU_ITEMSTEXT_COLOR: TRGB = (R:255; G:255; B:255);
MENU_UNACTIVEITEMS_COLOR: TRGB = (R:128; G:128; B:128);
MENU_ITEMSCTRL_COLOR: TRGB = (R:255; G:0; B:0);
MENU_VSPACE = 2;
MENU_HSPACE = 32;
+ MENU_MARKERDELAY = 24;
+
+ MAPPREVIEW_WIDTH = 8;
+ MAPPREVIEW_HEIGHT = 8;
+
+ KEYREAD_QUERY = '<...>';
+ KEYREAD_CLEAR = '???';
+
+ WINDOW_CLOSESOUND = 'MENU_CLOSE';
+ MAINMENU_CLICKSOUND = 'MENU_SELECT';
+ MAINMENU_CHANGESOUND = 'MENU_CHANGE';
MENU_CLICKSOUND = 'MENU_SELECT';
MENU_CHANGESOUND = 'MENU_CHANGE';
- MENU_MARKERDELAY = 24;
- SCROLL_LEFT = 'SCROLL_LEFT';
- SCROLL_RIGHT = 'SCROLL_RIGHT';
- SCROLL_MIDDLE = 'SCROLL_MIDDLE';
- SCROLL_MARKER = 'SCROLL_MARKER';
SCROLL_ADDSOUND = 'SCROLL_ADD';
SCROLL_SUBSOUND = 'SCROLL_SUB';
- EDIT_LEFT = 'EDIT_LEFT';
- EDIT_RIGHT = 'EDIT_RIGHT';
- EDIT_MIDDLE = 'EDIT_MIDDLE';
- EDIT_CURSORCOLOR: TRGB = (R:200; G:0; B:0);
- EDIT_CURSORLEN = 10;
- KEYREAD_QUERY = '<...>';
- KEYREAD_CLEAR = '???';
- KEYREAD_TIMEOUT = 24;
- MAPPREVIEW_WIDTH = 8;
- MAPPREVIEW_HEIGHT = 8;
- BSCROLL_UPA = 'BSCROLL_UP_A';
- BSCROLL_UPU = 'BSCROLL_UP_U';
- BSCROLL_DOWNA = 'BSCROLL_DOWN_A';
- BSCROLL_DOWNU = 'BSCROLL_DOWN_U';
- BSCROLL_MIDDLE = 'BSCROLL_MIDDLE';
+
WM_KEYDOWN = 101;
WM_CHAR = 102;
WM_USER = 110;
g_system,
{$ENDIF}
{$IFDEF ENABLE_RENDER}
- r_gui,
- r_textures, (* load/free image *)
+ r_render,
{$ENDIF}
+ e_input, e_log,
g_sound, SysUtils, e_res,
g_game, Math, StrUtils, g_player, g_options, g_console,
g_map, g_weapons, xdynrec, wadreader;
end;
function LineWidth (): Integer; inline;
- var w, h: Integer;
+ {$IFDEF ENABLE_RENDER}
+ var w, h: Integer;
+ {$ENDIF}
begin
- r_GUI_GetStringSize(BigFont, GetLine(i, False), w, h);
- Result := w;
+ {$IFDEF ENABLE_RENDER}
+ r_Render_GetStringSize(BigFont, GetLine(i, False), w, h);
+ Result := w;
+ {$ELSE}
+ Result := 0;
+ {$ENDIF}
end;
begin
{$ENDIF}
begin
{$IFDEF ENABLE_RENDER}
- r_GUI_GetSize(Self, Result, h);
+ r_Render_GetControlSize(Self, Result, h);
{$ELSE}
Result := 0;
{$ENDIF}
{$ENDIF}
begin
{$IFDEF ENABLE_RENDER}
- r_GUI_GetSize(Self, w, Result);
+ r_Render_GetControlSize(Self, w, Result);
{$ELSE}
Result := 0;
{$ENDIF}
{ TGUIMainMenu }
function TGUIMainMenu.AddButton(fProc: Pointer; Caption: string; ShowWindow: string = ''): TGUITextButton;
-var
- a, _x: Integer;
- h, hh: Word;
- lw: Word = 0;
- lh: Word = 0;
+ var
+ {$IFDEF ENABLE_RENDER}
+ lw: Integer;
+ {$ENDIF}
+ a, _x: Integer;
+ h, hh: Word;
+ lh: Integer;
begin
FIndex := 0;
if FButtons[a] <> nil then
_x := Min(_x, (gScreenWidth div 2)-(FButtons[a].GetWidth div 2));
- if FHeader = nil then
- r_GUI_GetLogoSize(lw, lh);
+ lw := 0;
+ lh := 0;
+ {$IFDEF ENABLE_RENDER}
+ if FHeader = nil then
+ r_Render_GetLogoSize(lw, lh);
+ {$ENDIF}
hh := FButtons[High(FButtons)].GetHeight;
if FHeader = nil then h := lh + hh * (1 + Length(FButtons)) + MAINMENU_SPACE * (Length(FButtons) - 1)
end;
procedure TGUIMenu.ReAlign();
-var
- a, tx, cx, w, h, fw, fh: Integer;
- cww: array of Integer; // cached widths
- maxcww: Integer;
+ var
+ {$IFDEF ENABLE_RENDER}
+ fw, fh: Integer;
+ {$ENDIF}
+ a, tx, cx, w, h: Integer;
+ cww: array of Integer; // cached widths
+ maxcww: Integer;
begin
if FItems = nil then Exit;
h := h+(FItems[a].Control as TGUIListBox).GetHeight()
else
begin
- r_GUI_GetMaxFontSize(FBigFont, fw, fh);
- h := h + fh;
+ {$IFDEF ENABLE_RENDER}
+ r_Render_GetMaxFontSize(FBigFont, fw, fh);
+ h := h + fh;
+ {$ENDIF}
end;
end;
end;
else if ControlType = TGUIMemo then Inc(h, (Control as TGUIMemo).GetHeight+MENU_VSPACE)
else
begin
- r_GUI_GetMaxFontSize(FBigFont, fw, fh);
- h := h + fh + MENU_VSPACE;
+ {$IFDEF ENABLE_RENDER}
+ r_Render_GetMaxFontSize(FBigFont, fw, fh);
+ h := h + fh + MENU_VSPACE;
+ {$ELSE}
+ h := h + MENU_VSPACE;
+ {$ENDIF}
end;
end;
end;
{ TGUIKeyRead2 }
constructor TGUIKeyRead2.Create(BigFont: Boolean);
- var a: Byte; w, h: Integer;
+ {$IFDEF ENABLE_RENDER}
+ var a: Byte; w, h: Integer;
+ {$ENDIF}
begin
inherited Create();
FMaxKeyNameWdt := 0;
- FMaxKeyNameWdt := 0;
-
- for a := 0 to 255 do
- begin
- r_GUI_GetStringSize(BigFont, e_KeyNames[a], w, h);
- FMaxKeyNameWdt := Max(FMaxKeyNameWdt, w);
- end;
-
- FMaxKeyNameWdt := FMaxKeyNameWdt-(FMaxKeyNameWdt div 3);
-
- r_GUI_GetStringSize(BigFont, KEYREAD_QUERY, w, h);
- if w > FMaxKeyNameWdt then FMaxKeyNameWdt := w;
-
- r_GUI_GetStringSize(BigFont, KEYREAD_CLEAR, w, h);
- if w > FMaxKeyNameWdt then FMaxKeyNameWdt := w;
+ {$IFDEF ENABLE_RENDER}
+ for a := 0 to 255 do
+ begin
+ r_Render_GetStringSize(BigFont, e_KeyNames[a], w, h);
+ FMaxKeyNameWdt := Max(FMaxKeyNameWdt, w);
+ end;
+ FMaxKeyNameWdt := FMaxKeyNameWdt-(FMaxKeyNameWdt div 3);
+ r_Render_GetStringSize(BigFont, KEYREAD_QUERY, w, h);
+ if w > FMaxKeyNameWdt then FMaxKeyNameWdt := w;
+ r_Render_GetStringSize(BigFont, KEYREAD_CLEAR, w, h);
+ if w > FMaxKeyNameWdt then FMaxKeyNameWdt := w;
+ {$ENDIF}
end;
function TGUIKeyRead2.WantActivationKey (key: LongInt): Boolean;
procedure TGUIimage.ClearImage();
begin
- if FImageRes = '' then Exit;
-
- g_Texture_Delete(FImageRes);
FImageRes := '';
end;
procedure TGUIimage.SetImage(Res: string);
begin
- ClearImage();
-
- if g_Texture_CreateWADEx(Res, Res) then FImageRes := Res;
+ FImageRes := Res;
end;
procedure TGUIimage.Update();