diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 7e1c60353a920c72263a2f8e0cf04ee6e5b47a2d..c6b22b8e82d3cbc3b3af1615a38921ee07c4e442 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
interface
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
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_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_SPACE = 4;
- MAINMENU_MARKER1 = 'MAINMENU_MARKER1';
- MAINMENU_MARKER2 = 'MAINMENU_MARKER2';
MAINMENU_MARKERDELAY = 24;
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_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_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';
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;
WM_KEYDOWN = 101;
WM_CHAR = 102;
WM_USER = 110;
lParam: LongInt;
end;
lParam: LongInt;
end;
- TFontType = (Texture, Character);
-
- TFont = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF}
- private
- FID: DWORD;
- FScale: Single;
- FFontType: TFontType;
- public
- constructor Create(FontID: DWORD; FontType: TFontType);
- destructor Destroy; override;
- procedure Draw(X, Y: Integer; Text: string; R, G, B: Byte);
- procedure GetTextSize(Text: string; var w, h: Word);
- property Scale: Single read FScale write FScale;
- property ID: DWORD read FID;
- end;
-
TGUIControl = class;
TGUIWindow = class;
TGUIControl = class;
TGUIWindow = class;
private
FText: string;
FColor: TRGB;
private
FText: string;
FColor: TRGB;
- FFont: TFont;
+ FBigFont: Boolean;
FSound: string;
FShowWindow: string;
public
Proc: procedure;
ProcEx: procedure (sender: TGUITextButton);
FSound: string;
FShowWindow: string;
public
Proc: procedure;
ProcEx: procedure (sender: TGUITextButton);
- constructor Create(aProc: Pointer; FontID: DWORD; Text: string);
+ constructor Create(aProc: Pointer; BigFont: Boolean; Text: string);
destructor Destroy(); override;
procedure OnMessage(var Msg: TMessage); override;
procedure Update(); override;
procedure Click(Silent: Boolean = False);
property Caption: string read FText write FText;
property Color: TRGB read FColor write FColor;
destructor Destroy(); override;
procedure OnMessage(var Msg: TMessage); override;
procedure Update(); override;
procedure Click(Silent: Boolean = False);
property Caption: string read FText write FText;
property Color: TRGB read FColor write FColor;
- property Font: TFont read FFont write FFont;
+ property BigFont: Boolean read FBigFont write FBigFont;
property ShowWindow: string read FShowWindow write FShowWindow;
end;
property ShowWindow: string read FShowWindow write FShowWindow;
end;
private
FText: string;
FColor: TRGB;
private
FText: string;
FColor: TRGB;
- FFont: TFont;
+ FBigFont: Boolean;
FFixedLen: Word;
FOnClickEvent: TOnClickEvent;
public
FFixedLen: Word;
FOnClickEvent: TOnClickEvent;
public
- constructor Create(Text: string; FontID: DWORD);
+ constructor Create(Text: string; BigFont: Boolean);
procedure OnMessage(var Msg: TMessage); override;
property OnClick: TOnClickEvent read FOnClickEvent write FOnClickEvent;
property FixedLength: Word read FFixedLen write FFixedLen;
property Text: string read FText write FText;
property Color: TRGB read FColor write FColor;
procedure OnMessage(var Msg: TMessage); override;
property OnClick: TOnClickEvent read FOnClickEvent write FOnClickEvent;
property FixedLength: Word read FFixedLen write FFixedLen;
property Text: string read FText write FText;
property Color: TRGB read FColor write FColor;
- property Font: TFont read FFont write FFont;
+ property BigFont: Boolean read FBigFont write FBigFont;
end;
TGUIScroll = class(TGUIControl)
end;
TGUIScroll = class(TGUIControl)
TGUISwitch = class(TGUIControl)
private
TGUISwitch = class(TGUIControl)
private
- FFont: TFont;
+ FBigFont: Boolean;
FItems: TGUIItemsList;
FIndex: Integer;
FColor: TRGB;
FOnChangeEvent: TOnChangeEvent;
public
FItems: TGUIItemsList;
FIndex: Integer;
FColor: TRGB;
FOnChangeEvent: TOnChangeEvent;
public
- constructor Create(FontID: DWORD);
+ constructor Create(BigFont: Boolean);
procedure OnMessage(var Msg: TMessage); override;
procedure AddItem(Item: string);
procedure Update; override;
function GetText: string;
property ItemIndex: Integer read FIndex write FIndex;
property Color: TRGB read FColor write FColor;
procedure OnMessage(var Msg: TMessage); override;
procedure AddItem(Item: string);
procedure Update; override;
function GetText: string;
property ItemIndex: Integer read FIndex write FIndex;
property Color: TRGB read FColor write FColor;
- property Font: TFont read FFont write FFont;
+ property BigFont: Boolean read FBigFont write FBigFont;
property OnChange: TOnChangeEvent read FOnChangeEvent write FOnChangeEvent;
property Items: TGUIItemsList read FItems;
end;
TGUIEdit = class(TGUIControl)
private
property OnChange: TOnChangeEvent read FOnChangeEvent write FOnChangeEvent;
property Items: TGUIItemsList read FItems;
end;
TGUIEdit = class(TGUIControl)
private
- FFont: TFont;
+ FBigFont: Boolean;
FCaretPos: Integer;
FMaxLength: Word;
FWidth: Word;
FCaretPos: Integer;
FMaxLength: Word;
FWidth: Word;
FInvalid: Boolean;
procedure SetText(Text: string);
public
FInvalid: Boolean;
procedure SetText(Text: string);
public
- constructor Create(FontID: DWORD);
+ constructor Create(BigFont: Boolean);
procedure OnMessage(var Msg: TMessage); override;
procedure Update; override;
property OnChange: TOnChangeEvent read FOnChangeEvent write FOnChangeEvent;
procedure OnMessage(var Msg: TMessage); override;
procedure Update; override;
property OnChange: TOnChangeEvent read FOnChangeEvent write FOnChangeEvent;
property OnlyDigits: Boolean read FOnlyDigits write FOnlyDigits;
property Text: string read FText write SetText;
property Color: TRGB read FColor write FColor;
property OnlyDigits: Boolean read FOnlyDigits write FOnlyDigits;
property Text: string read FText write SetText;
property Color: TRGB read FColor write FColor;
- property Font: TFont read FFont write FFont;
+ property BigFont: Boolean read FBigFont write FBigFont;
property Invalid: Boolean read FInvalid write FInvalid;
property CaretPos: Integer read FCaretPos;
property Invalid: Boolean read FInvalid write FInvalid;
property CaretPos: Integer read FCaretPos;
TGUIKeyRead = class(TGUIControl)
private
TGUIKeyRead = class(TGUIControl)
private
- FFont: TFont;
+ FBigFont: Boolean;
FColor: TRGB;
FKey: Word;
FIsQuery: Boolean;
public
FColor: TRGB;
FKey: Word;
FIsQuery: Boolean;
public
- constructor Create(FontID: DWORD);
+ constructor Create(BigFont: Boolean);
procedure OnMessage(var Msg: TMessage); override;
function WantActivationKey (key: LongInt): Boolean; override;
property Key: Word read FKey write FKey;
property Color: TRGB read FColor write FColor;
procedure OnMessage(var Msg: TMessage); override;
function WantActivationKey (key: LongInt): Boolean; override;
property Key: Word read FKey write FKey;
property Color: TRGB read FColor write FColor;
- property Font: TFont read FFont write FFont;
+ property BigFont: Boolean read FBigFont write FBigFont;
property IsQuery: Boolean read FIsQuery;
end;
property IsQuery: Boolean read FIsQuery;
end;
// can hold two keys
TGUIKeyRead2 = class(TGUIControl)
private
// can hold two keys
TGUIKeyRead2 = class(TGUIControl)
private
- FFont: TFont;
- FFontID: DWORD;
+ FBigFont: Boolean;
FColor: TRGB;
FKey0, FKey1: Word; // this should be an array. sorry.
FKeyIdx: Integer;
FIsQuery: Boolean;
FMaxKeyNameWdt: Integer;
public
FColor: TRGB;
FKey0, FKey1: Word; // this should be an array. sorry.
FKeyIdx: Integer;
FIsQuery: Boolean;
FMaxKeyNameWdt: Integer;
public
- constructor Create(FontID: DWORD);
+ constructor Create(BigFont: Boolean);
procedure OnMessage(var Msg: TMessage); override;
function WantActivationKey (key: LongInt): Boolean; override;
property Key0: Word read FKey0 write FKey0;
property Key1: Word read FKey1 write FKey1;
property Color: TRGB read FColor write FColor;
procedure OnMessage(var Msg: TMessage); override;
function WantActivationKey (key: LongInt): Boolean; override;
property Key0: Word read FKey0 write FKey0;
property Key1: Word read FKey1 write FKey1;
property Color: TRGB read FColor write FColor;
- property Font: TFont read FFont write FFont;
+ property BigFont: Boolean read FBigFont write FBigFont;
property IsQuery: Boolean read FIsQuery;
property MaxKeyNameWdt: Integer read FMaxKeyNameWdt;
property IsQuery: Boolean read FIsQuery;
property MaxKeyNameWdt: Integer read FMaxKeyNameWdt;
FItems: SSArray;
FActiveColor: TRGB;
FUnActiveColor: TRGB;
FItems: SSArray;
FActiveColor: TRGB;
FUnActiveColor: TRGB;
- FFont: TFont;
+ FBigFont: Boolean;
FStartLine: Integer;
FIndex: Integer;
FWidth: Word;
FStartLine: Integer;
FIndex: Integer;
FWidth: Word;
procedure FSetIndex(aIndex: Integer);
public
procedure FSetIndex(aIndex: Integer);
public
- constructor Create(FontID: DWORD; Width, Height: Word);
+ constructor Create(BigFont: Boolean; Width, Height: Word);
procedure OnMessage(var Msg: TMessage); override;
procedure AddItem(Item: String);
function ItemExists (item: String): Boolean;
procedure OnMessage(var Msg: TMessage); override;
procedure AddItem(Item: String);
function ItemExists (item: String): Boolean;
property DrawScrollBar: Boolean read FDrawScroll write FDrawScroll;
property ActiveColor: TRGB read FActiveColor write FActiveColor;
property UnActiveColor: TRGB read FUnActiveColor write FUnActiveColor;
property DrawScrollBar: Boolean read FDrawScroll write FDrawScroll;
property ActiveColor: TRGB read FActiveColor write FActiveColor;
property UnActiveColor: TRGB read FUnActiveColor write FUnActiveColor;
- property Font: TFont read FFont write FFont;
+ property BigFont: Boolean read FBigFont write FBigFont;
property Width: Word read FWidth;
property Height: Word read FHeight;
property Width: Word read FWidth;
property Height: Word read FHeight;
TGUIMemo = class(TGUIControl)
private
FLines: SSArray;
TGUIMemo = class(TGUIControl)
private
FLines: SSArray;
- FFont: TFont;
+ FBigFont: Boolean;
FStartLine: Integer;
FWidth: Word;
FHeight: Word;
FStartLine: Integer;
FWidth: Word;
FHeight: Word;
FDrawBack: Boolean;
FDrawScroll: Boolean;
public
FDrawBack: Boolean;
FDrawScroll: Boolean;
public
- constructor Create(FontID: DWORD; Width, Height: Word);
+ constructor Create(BigFont: Boolean; Width, Height: Word);
procedure OnMessage(var Msg: TMessage); override;
procedure Clear;
procedure SetText(Text: string);
property DrawBack: Boolean read FDrawBack write FDrawBack;
property DrawScrollBar: Boolean read FDrawScroll write FDrawScroll;
property Color: TRGB read FColor write FColor;
procedure OnMessage(var Msg: TMessage); override;
procedure Clear;
procedure SetText(Text: string);
property DrawBack: Boolean read FDrawBack write FDrawBack;
property DrawScrollBar: Boolean read FDrawScroll write FDrawScroll;
property Color: TRGB read FColor write FColor;
- property Font: TFont read FFont write FFont;
+ property BigFont: Boolean read FBigFont write FBigFont;
property Width: Word read FWidth;
property Height: Word read FHeight;
property Width: Word read FWidth;
property Height: Word read FHeight;
FButtons: TGUITextButtonList;
FHeader: TGUILabel;
FIndex: Integer;
FButtons: TGUITextButtonList;
FHeader: TGUILabel;
FIndex: Integer;
- FFontID: DWORD;
+ FBigFont: Boolean;
FCounter: Byte; // !!! update it within render
public
FCounter: Byte; // !!! update it within render
public
- constructor Create(FontID: DWORD; Header: string);
+ constructor Create(BigFont: Boolean; Header: string);
destructor Destroy; override;
procedure OnMessage(var Msg: TMessage); override;
function AddButton(fProc: Pointer; Caption: string; ShowWindow: string = ''): TGUITextButton;
destructor Destroy; override;
procedure OnMessage(var Msg: TMessage); override;
function AddButton(fProc: Pointer; Caption: string; ShowWindow: string = ''): TGUITextButton;
FItems: TMenuItemList;
FHeader: TGUILabel;
FIndex: Integer;
FItems: TMenuItemList;
FHeader: TGUILabel;
FIndex: Integer;
- FFontID: DWORD;
+ FBigFont: Boolean;
FCounter: Byte;
FAlign: Boolean;
FLeft: Integer;
FYesNo: Boolean;
function NewItem(): Integer;
public
FCounter: Byte;
FAlign: Boolean;
FLeft: Integer;
FYesNo: Boolean;
function NewItem(): Integer;
public
- constructor Create(HeaderFont, ItemsFont: DWORD; Header: string);
+ constructor Create(HeaderBigFont, ItemsBigFont: Boolean; Header: string);
destructor Destroy; override;
procedure OnMessage(var Msg: TMessage); override;
procedure AddSpace();
destructor Destroy; override;
procedure OnMessage(var Msg: TMessage); override;
procedure AddSpace();
property Counter: Byte read FCounter;
property Index: Integer read FIndex;
property Items: TMenuItemList read FItems;
property Counter: Byte read FCounter;
property Index: Integer read FIndex;
property Items: TMenuItemList read FItems;
- property FontID: DWORD read FFontID;
+ property BigFont: Boolean read FBigFont;
end;
var
end;
var
g_system,
{$ENDIF}
{$IFDEF ENABLE_RENDER}
g_system,
{$ENDIF}
{$IFDEF ENABLE_RENDER}
- r_gui, r_textures, r_graphics,
+ r_render,
{$ENDIF}
{$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;
g_sound, SysUtils, e_res,
g_game, Math, StrUtils, g_player, g_options, g_console,
g_map, g_weapons, xdynrec, wadreader;
var
Saved_Windows: SSArray;
var
Saved_Windows: SSArray;
-function GetLines (text: string; FontID: DWORD; MaxWidth: Word): SSArray;
+function GetLines (text: string; BigFont: Boolean; MaxWidth: Word): SSArray;
var
k: Integer = 1;
lines: Integer = 0;
var
k: Integer = 1;
lines: Integer = 0;
end;
function LineWidth (): Integer; inline;
end;
function LineWidth (): Integer; inline;
- var w, h: Word;
+ {$IFDEF ENABLE_RENDER}
+ var w, h: Integer;
+ {$ENDIF}
begin
begin
- e_CharFont_GetSize(FontID, 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
end;
begin
{$ENDIF}
begin
{$IFDEF ENABLE_RENDER}
{$ENDIF}
begin
{$IFDEF ENABLE_RENDER}
- r_GUI_GetSize(Self, Result, h);
+ r_Render_GetControlSize(Self, Result, h);
{$ELSE}
Result := 0;
{$ENDIF}
{$ELSE}
Result := 0;
{$ENDIF}
{$ENDIF}
begin
{$IFDEF ENABLE_RENDER}
{$ENDIF}
begin
{$IFDEF ENABLE_RENDER}
- r_GUI_GetSize(Self, w, Result);
+ r_Render_GetControlSize(Self, w, Result);
{$ELSE}
Result := 0;
{$ENDIF}
{$ELSE}
Result := 0;
{$ENDIF}
if FShowWindow <> '' then g_GUI_ShowWindow(FShowWindow);
end;
if FShowWindow <> '' then g_GUI_ShowWindow(FShowWindow);
end;
-constructor TGUITextButton.Create(aProc: Pointer; FontID: DWORD; Text: string);
+constructor TGUITextButton.Create(aProc: Pointer; BigFont: Boolean; Text: string);
begin
inherited Create();
Self.Proc := aProc;
ProcEx := nil;
begin
inherited Create();
Self.Proc := aProc;
ProcEx := nil;
- FFont := TFont.Create(FontID, TFontType.Character);
-
+ FBigFont := BigFont;
FText := Text;
end;
FText := Text;
end;
inherited;
end;
inherited;
end;
-{ TFont }
-
-constructor TFont.Create(FontID: DWORD; FontType: TFontType);
-begin
- FID := FontID;
- FScale := 1;
- FFontType := FontType;
-end;
-
-destructor TFont.Destroy;
-begin
-
- inherited;
-end;
-
-procedure TFont.Draw(X, Y: Integer; Text: string; R, G, B: Byte);
-begin
- if FFontType = TFontType.Character then e_CharFont_PrintEx(ID, X, Y, Text, _RGB(R, G, B), FScale)
- else e_TextureFontPrintEx(X, Y, Text, ID, R, G, B, FScale);
-end;
-
-procedure TFont.GetTextSize(Text: string; var w, h: Word);
-var
- cw, ch: Byte;
-begin
- if FFontType = TFontType.Character then e_CharFont_GetSize(ID, Text, w, h)
- else
- begin
- e_TextureFontGetSize(ID, cw, ch);
- w := cw*Length(Text);
- h := ch;
- end;
-
- w := Round(w*FScale);
- h := Round(h*FScale);
-end;
-
{ TGUIMainMenu }
function TGUIMainMenu.AddButton(fProc: Pointer; Caption: string; ShowWindow: string = ''): TGUITextButton;
{ 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;
SetLength(FButtons, Length(FButtons)+1);
begin
FIndex := 0;
SetLength(FButtons, Length(FButtons)+1);
- FButtons[High(FButtons)] := TGUITextButton.Create(fProc, FFontID, Caption);
+ FButtons[High(FButtons)] := TGUITextButton.Create(fProc, FBigFont, Caption);
FButtons[High(FButtons)].ShowWindow := ShowWindow;
with FButtons[High(FButtons)] do
begin
FButtons[High(FButtons)].ShowWindow := ShowWindow;
with FButtons[High(FButtons)] do
begin
if FButtons[a] <> nil then
_x := Min(_x, (gScreenWidth div 2)-(FButtons[a].GetWidth div 2));
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);
+ lh := 0;
+ {$IFDEF ENABLE_RENDER}
+ lw := 0;
+ 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)
hh := FButtons[High(FButtons)].GetHeight;
if FHeader = nil then h := lh + hh * (1 + Length(FButtons)) + MAINMENU_SPACE * (Length(FButtons) - 1)
FButtons[High(FButtons)] := nil;
end;
FButtons[High(FButtons)] := nil;
end;
-constructor TGUIMainMenu.Create(FontID: DWORD; Header: string);
+constructor TGUIMainMenu.Create(BigFont: Boolean; Header: string);
begin
inherited Create();
FIndex := -1;
begin
inherited Create();
FIndex := -1;
- FFontID := FontID;
+ FBigFont := BigFont;
FCounter := MAINMENU_MARKERDELAY;
if Header <> '' then
begin
FCounter := MAINMENU_MARKERDELAY;
if Header <> '' then
begin
- FHeader := TGUILabel.Create(Header, FFontID);
+ FHeader := TGUILabel.Create(Header, BigFont);
with FHeader do
begin
FColor := MAINMENU_HEADER_COLOR;
with FHeader do
begin
FColor := MAINMENU_HEADER_COLOR;
{ TGUILabel }
{ TGUILabel }
-constructor TGUILabel.Create(Text: string; FontID: DWORD);
+constructor TGUILabel.Create(Text: string; BigFont: Boolean);
begin
inherited Create();
begin
inherited Create();
- FFont := TFont.Create(FontID, TFontType.Character);
-
+ FBigFont := BigFont;
FText := Text;
FFixedLen := 0;
FOnClickEvent := nil;
FText := Text;
FFixedLen := 0;
FOnClickEvent := nil;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUITextButton.Create(Proc, FFontID, fText);
+ Control := TGUITextButton.Create(Proc, FBigFont, fText);
with Control as TGUITextButton do
begin
ShowWindow := _ShowWindow;
with Control as TGUITextButton do
begin
ShowWindow := _ShowWindow;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
a, i: Integer;
l: SSArray;
begin
a, i: Integer;
l: SSArray;
begin
- l := GetLines(fText, FFontID, MaxWidth);
+ l := GetLines(fText, FBigFont, MaxWidth);
if l = nil then Exit;
if l = nil then Exit;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Text := TGUILabel.Create(l[a], FFontID);
+ Text := TGUILabel.Create(l[a], FBigFont);
if FYesNo then
begin
with Text do begin FColor := _RGB(255, 0, 0); end;
if FYesNo then
begin
with Text do begin FColor := _RGB(255, 0, 0); end;
ReAlign();
end;
ReAlign();
end;
-constructor TGUIMenu.Create(HeaderFont, ItemsFont: DWORD; Header: string);
+constructor TGUIMenu.Create(HeaderBigFont, ItemsBigFont: Boolean; Header: string);
begin
inherited Create();
FItems := nil;
FIndex := -1;
begin
inherited Create();
FItems := nil;
FIndex := -1;
- FFontID := ItemsFont;
+ FBigFont := ItemsBigFont;
FCounter := MENU_MARKERDELAY;
FAlign := True;
FYesNo := false;
FCounter := MENU_MARKERDELAY;
FAlign := True;
FYesNo := false;
- FHeader := TGUILabel.Create(Header, HeaderFont);
+ FHeader := TGUILabel.Create(Header, HeaderBigFont);
with FHeader do
begin
FX := (gScreenWidth div 2)-(GetWidth div 2);
with FHeader do
begin
FX := (gScreenWidth div 2)-(GetWidth div 2);
end;
procedure TGUIMenu.ReAlign();
end;
procedure TGUIMenu.ReAlign();
-var
- a, tx, cx, w, h: 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;
begin
if FItems = nil then Exit;
if (ControlType = TGUIListBox) or (ControlType = TGUIFileListBox) then
h := h+(FItems[a].Control as TGUIListBox).GetHeight()
else
if (ControlType = TGUIListBox) or (ControlType = TGUIFileListBox) then
h := h+(FItems[a].Control as TGUIListBox).GetHeight()
else
- h := h+e_CharFont_GetMaxHeight(FFontID);
+ begin
+ {$IFDEF ENABLE_RENDER}
+ r_Render_GetMaxFontSize(FBigFont, fw, fh);
+ h := h + fh;
+ {$ENDIF}
+ end;
end;
end;
end;
end;
if (ControlType = TGUIListBox) or (ControlType = TGUIFileListBox) then Inc(h, (Control as TGUIListBox).GetHeight+MENU_VSPACE)
else if ControlType = TGUIMemo then Inc(h, (Control as TGUIMemo).GetHeight+MENU_VSPACE)
if (ControlType = TGUIListBox) or (ControlType = TGUIFileListBox) then Inc(h, (Control as TGUIListBox).GetHeight+MENU_VSPACE)
else if ControlType = TGUIMemo then Inc(h, (Control as TGUIMemo).GetHeight+MENU_VSPACE)
- else Inc(h, e_CharFont_GetMaxHeight(FFontID)+MENU_VSPACE);
+ else
+ begin
+ {$IFDEF ENABLE_RENDER}
+ r_Render_GetMaxFontSize(FBigFont, fw, fh);
+ h := h + fh + MENU_VSPACE;
+ {$ELSE}
+ h := h + MENU_VSPACE;
+ {$ENDIF}
+ end;
end;
end;
end;
end;
begin
Control := TGUIScroll.Create();
begin
Control := TGUIScroll.Create();
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUISwitch.Create(FFontID);
+ Control := TGUISwitch.Create(FBigFont);
(Control as TGUISwitch).FColor := MENU_ITEMSCTRL_COLOR;
(Control as TGUISwitch).FColor := MENU_ITEMSCTRL_COLOR;
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUIEdit.Create(FFontID);
+ Control := TGUIEdit.Create(FBigFont);
with Control as TGUIEdit do
begin
FWindow := Self.FWindow;
with Control as TGUIEdit do
begin
FWindow := Self.FWindow;
if fText = '' then Text := nil else
begin
if fText = '' then Text := nil else
begin
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
Text.FColor := MENU_ITEMSTEXT_COLOR;
end;
Text.FColor := MENU_ITEMSTEXT_COLOR;
end;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUIKeyRead.Create(FFontID);
+ Control := TGUIKeyRead.Create(FBigFont);
with Control as TGUIKeyRead do
begin
FWindow := Self.FWindow;
FColor := MENU_ITEMSCTRL_COLOR;
end;
with Control as TGUIKeyRead do
begin
FWindow := Self.FWindow;
FColor := MENU_ITEMSCTRL_COLOR;
end;
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUIKeyRead2.Create(FFontID);
+ Control := TGUIKeyRead2.Create(FBigFont);
with Control as TGUIKeyRead2 do
begin
FWindow := Self.FWindow;
FColor := MENU_ITEMSCTRL_COLOR;
end;
with Control as TGUIKeyRead2 do
begin
FWindow := Self.FWindow;
FColor := MENU_ITEMSCTRL_COLOR;
end;
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
with Text do
begin
FColor := MENU_ITEMSCTRL_COLOR; //MENU_ITEMSTEXT_COLOR;
with Text do
begin
FColor := MENU_ITEMSCTRL_COLOR; //MENU_ITEMSTEXT_COLOR;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUIListBox.Create(FFontID, Width, Height);
+ Control := TGUIListBox.Create(FBigFont, Width, Height);
with Control as TGUIListBox do
begin
FWindow := Self.FWindow;
with Control as TGUIListBox do
begin
FWindow := Self.FWindow;
FUnActiveColor := MENU_ITEMSTEXT_COLOR;
end;
FUnActiveColor := MENU_ITEMSTEXT_COLOR;
end;
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUIFileListBox.Create(FFontID, Width, Height);
+ Control := TGUIFileListBox.Create(FBigFont, Width, Height);
with Control as TGUIFileListBox do
begin
FWindow := Self.FWindow;
with Control as TGUIFileListBox do
begin
FWindow := Self.FWindow;
if fText = '' then Text := nil else
begin
if fText = '' then Text := nil else
begin
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
Text.FColor := MENU_ITEMSTEXT_COLOR;
end;
Text.FColor := MENU_ITEMSTEXT_COLOR;
end;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUILabel.Create('', FFontID);
+ Control := TGUILabel.Create('', FBigFont);
with Control as TGUILabel do
begin
FWindow := Self.FWindow;
FColor := MENU_ITEMSCTRL_COLOR;
end;
with Control as TGUILabel do
begin
FWindow := Self.FWindow;
FColor := MENU_ITEMSCTRL_COLOR;
end;
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
with Text do
begin
FColor := MENU_ITEMSTEXT_COLOR;
i := NewItem();
with FItems[i] do
begin
i := NewItem();
with FItems[i] do
begin
- Control := TGUIMemo.Create(FFontID, Width, Height);
+ Control := TGUIMemo.Create(FBigFont, Width, Height);
with Control as TGUIMemo do
begin
FWindow := Self.FWindow;
with Control as TGUIMemo do
begin
FWindow := Self.FWindow;
if fText = '' then Text := nil else
begin
if fText = '' then Text := nil else
begin
- Text := TGUILabel.Create(fText, FFontID);
+ Text := TGUILabel.Create(fText, FBigFont);
Text.FColor := MENU_ITEMSTEXT_COLOR;
end;
Text.FColor := MENU_ITEMSTEXT_COLOR;
end;
if FIndex = -1 then FIndex := 0;
end;
if FIndex = -1 then FIndex := 0;
end;
-constructor TGUISwitch.Create(FontID: DWORD);
+constructor TGUISwitch.Create(BigFont: Boolean);
begin
inherited Create();
FIndex := -1;
begin
inherited Create();
FIndex := -1;
- FFont := TFont.Create(FontID, TFontType.Character);
+ FBigFont := BigFont;
end;
function TGUISwitch.GetText: string;
end;
function TGUISwitch.GetText: string;
{ TGUIEdit }
{ TGUIEdit }
-constructor TGUIEdit.Create(FontID: DWORD);
+constructor TGUIEdit.Create(BigFont: Boolean);
begin
inherited Create();
begin
inherited Create();
- FFont := TFont.Create(FontID, TFontType.Character);
-
+ FBigFont := BigFont;
FMaxLength := 0;
FWidth := 0;
FInvalid := false;
FMaxLength := 0;
FWidth := 0;
FInvalid := false;
{ TGUIKeyRead }
{ TGUIKeyRead }
-constructor TGUIKeyRead.Create(FontID: DWORD);
+constructor TGUIKeyRead.Create(BigFont: Boolean);
begin
inherited Create();
FKey := 0;
FIsQuery := false;
begin
inherited Create();
FKey := 0;
FIsQuery := false;
-
- FFont := TFont.Create(FontID, TFontType.Character);
+ FBigFont := BigFont;
end;
function TGUIKeyRead.WantActivationKey (key: LongInt): Boolean;
end;
function TGUIKeyRead.WantActivationKey (key: LongInt): Boolean;
{ TGUIKeyRead2 }
{ TGUIKeyRead2 }
-constructor TGUIKeyRead2.Create(FontID: DWORD);
-var
- a: Byte;
- w, h: Word;
+constructor TGUIKeyRead2.Create(BigFont: Boolean);
+ {$IFDEF ENABLE_RENDER}
+ var a: Byte; w, h: Integer;
+ {$ENDIF}
begin
inherited Create();
begin
inherited Create();
FKeyIdx := 0;
FIsQuery := False;
FKeyIdx := 0;
FIsQuery := False;
- FFontID := FontID;
- FFont := TFont.Create(FontID, TFontType.Character);
+ FBigFont := BigFont;
FMaxKeyNameWdt := 0;
FMaxKeyNameWdt := 0;
- for a := 0 to 255 do
- begin
- FFont.GetTextSize(e_KeyNames[a], w, h);
- FMaxKeyNameWdt := Max(FMaxKeyNameWdt, w);
- end;
-
- FMaxKeyNameWdt := FMaxKeyNameWdt-(FMaxKeyNameWdt div 3);
-
- FFont.GetTextSize(KEYREAD_QUERY, w, h);
- if w > FMaxKeyNameWdt then FMaxKeyNameWdt := w;
- FFont.GetTextSize(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;
end;
function TGUIKeyRead2.WantActivationKey (key: LongInt): Boolean;
FIndex := -1;
end;
FIndex := -1;
end;
-constructor TGUIListBox.Create(FontID: DWORD; Width, Height: Word);
+constructor TGUIListBox.Create(BigFont: Boolean; Width, Height: Word);
begin
inherited Create();
begin
inherited Create();
- FFont := TFont.Create(FontID, TFontType.Character);
-
+ FBigFont := BigFont;
FWidth := Width;
FHeight := Height;
FIndex := -1;
FWidth := Width;
FHeight := Height;
FIndex := -1;
FStartLine := 0;
end;
FStartLine := 0;
end;
-constructor TGUIMemo.Create(FontID: DWORD; Width, Height: Word);
+constructor TGUIMemo.Create(BigFont: Boolean; Width, Height: Word);
begin
inherited Create();
begin
inherited Create();
- FFont := TFont.Create(FontID, TFontType.Character);
-
+ FBigFont := BigFont;
FWidth := Width;
FHeight := Height;
FDrawBack := True;
FWidth := Width;
FHeight := Height;
FDrawBack := True;
procedure TGUIMemo.SetText(Text: string);
begin
FStartLine := 0;
procedure TGUIMemo.SetText(Text: string);
begin
FStartLine := 0;
- FLines := GetLines(Text, FFont.ID, FWidth*16);
+ FLines := GetLines(Text, FBigFont, FWidth * 16);
end;
{ TGUIimage }
procedure TGUIimage.ClearImage();
begin
end;
{ TGUIimage }
procedure TGUIimage.ClearImage();
begin
- if FImageRes = '' then Exit;
-
- g_Texture_Delete(FImageRes);
FImageRes := '';
end;
FImageRes := '';
end;
procedure TGUIimage.SetImage(Res: string);
begin
procedure TGUIimage.SetImage(Res: string);
begin
- ClearImage();
-
- if g_Texture_CreateWADEx(Res, Res) then FImageRes := Res;
+ FImageRes := Res;
end;
procedure TGUIimage.Update();
end;
procedure TGUIimage.Update();