From: DeaDDooMER Date: Mon, 31 Jan 2022 18:46:04 +0000 (+0300) Subject: render: load image for TGUIImage within render X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=09e7681fd86c15d7553b8b8535775b703c5516aa;p=d2df-sdl.git render: load image for TGUIImage within render --- diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas index a872643..988d090 100644 --- a/src/game/g_gui.pas +++ b/src/game/g_gui.pas @@ -539,7 +539,6 @@ uses {$ENDIF} {$IFDEF ENABLE_RENDER} r_gui, - r_textures, (* load/free image *) {$ENDIF} g_sound, SysUtils, e_res, g_game, Math, StrUtils, g_player, g_options, @@ -3003,9 +3002,6 @@ end; procedure TGUIimage.ClearImage(); begin - if FImageRes = '' then Exit; - - g_Texture_Delete(FImageRes); FImageRes := ''; end; @@ -3028,9 +3024,7 @@ end; procedure TGUIimage.SetImage(Res: string); begin - ClearImage(); - - if g_Texture_CreateWADEx(Res, Res) then FImageRes := Res; + FImageRes := Res; end; procedure TGUIimage.Update(); diff --git a/src/game/opengl/r_gui.pas b/src/game/opengl/r_gui.pas index 3463a9e..8df2b40 100644 --- a/src/game/opengl/r_gui.pas +++ b/src/game/opengl/r_gui.pas @@ -26,6 +26,7 @@ interface procedure r_GUI_GetLogoSize (out w, h: WORD); procedure r_GUI_GetMaxFontSize (BigFont: Boolean; out w, h: Integer); procedure r_GUI_GetStringSize (BigFont: Boolean; str: String; out w, h: Integer); + procedure r_GUI_Draw_Window (win: TGUIWindow); implementation @@ -500,8 +501,12 @@ implementation end else begin - if g_Texture_Get(ctrl.ImageRes, ID) then - e_Draw(ID, ctrl.X, ctrl.Y, 0, True, False); + if g_Texture_CreateWADEx(ctrl.ImageRes, ctrl.ImageRes) then + begin + if g_Texture_Get(ctrl.ImageRes, ID) then + e_Draw(ID, ctrl.X, ctrl.Y, 0, True, False); + g_Texture_Delete(ctrl.ImageRes); + end; end; end;