From 5bf0ebf274fef28811ab952338bd261bd1dd0fa8 Mon Sep 17 00:00:00 2001 From: b1indy Date: Thu, 3 May 2007 00:19:52 +0000 Subject: added "popups" to ask for confirmation when leaving party mode or game or to display messages (like minor errors) still ugly, needs some theme work git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@157 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Menu/UDisplay.pas | 40 +++++++++++++++++++++++++++++++++------- Game/Code/Menu/UMenu.pas | 19 +++++++++++++++---- 2 files changed, 48 insertions(+), 11 deletions(-) (limited to 'Game/Code/Menu') diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 19266414..428cc6c7 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -2,12 +2,15 @@ unit UDisplay; interface -uses Windows, SDL, UMenu, OpenGL12, SysUtils, dialogs; +uses Windows, SDL, UMenu, OpenGL12, SysUtils; type TDisplay = class ActualScreen: PMenu; NextScreen: PMenu; + //popup hack + NextScreenWithCheck: Pmenu; + CheckOK: Boolean; h_DC: HDC; h_RC: HGLRC; @@ -45,6 +48,11 @@ var i: integer; begin inherited Create; + //popup hack + CheckOK:=False; + NextScreen:=NIL; + NextScreenWithCheck:=NIL; + // fade mod myfade:=0; @@ -75,10 +83,6 @@ begin canFade:=False; end; FreeMem(pTexData); - if not canFade then begin - showmessage('Fehler beim Initialisieren der Fading-Textur... Fading deaktiviert'); - doFade:=False; - end // end end; @@ -120,9 +124,26 @@ begin if S = 2 then TimeSkip := 0 else; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); + //popup hack + // check was successful... move on + if CheckOK then + if assigned (NextScreenWithCheck)then + begin + NextScreen:=NextScreenWithCheck; + NextScreenWithCheck := NIL; + CheckOk:=False; + end + else + Result:=False; + //end popup hack + // ActualScreen.SetAnimationProgress(1); if not assigned (NextScreen) then begin - Result := ActualScreen.Draw; + ActualScreen.Draw; + //popup mod + if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.Draw else + if ScreenPopupCheck <> NIL then if ScreenPopupCheck.Visible then ScreenPopupCheck.Draw; + //popup end // fade mod myfade:=0; if (Ini.ScreenFade=1) and canFade then @@ -133,6 +154,11 @@ begin end else begin + // check if we had an initialization error (canfade=false, dofade=true) + if doFade and not canFade then begin + doFade:=False; //disable fading + ScreenPopupError.ShowPopup(['Error initializing','fade texture','','fading','disabled']); //show error message + end; if doFade and canFade then begin // fade mod @@ -146,7 +172,7 @@ begin if glGetError <> GL_NO_ERROR then begin canFade := False; - showmessage('Fehler beim Kopieren der Fade-Textur... Fading deaktiviert'); + ScreenPopupError.ShowPopup(['Error copying','fade texture','','fading','disabled']); //show error message end; glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); NextScreen.onShow; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index 4ad8270a..c9d3c726 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -12,7 +12,7 @@ type TMenu = class protected ButtonPos: Integer; - + Interactions: array of TInteract; SelInteraction: integer; Button: array of TButton; @@ -29,7 +29,7 @@ type mY: integer; // mouse Y Fade: integer; // fade type - ShowFinish: boolean; // true if there is no fade + ShowFinish: boolean; // true if there is no fade destructor Destroy; override; @@ -47,7 +47,7 @@ type procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); procedure AddButtonCollection(const ThemeCollection: TThemeButtonCollection; Const Num: Byte); - + // background procedure AddBackground(Name: string); @@ -68,7 +68,7 @@ type function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; Tekst: string): integer; overload; // button - Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button + Procedure SetButtonLength(Length: Cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button function AddButton(ThemeButton: TThemeButton): integer; overload; function AddButton(X, Y, W, H: real; Name: String): integer; overload; function AddButton(X, Y, W, H: real; Name, Format, Typ: String; Reflection: Boolean): integer; overload; @@ -107,6 +107,8 @@ type // function AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; // procedure ClearWidgets(MinNumber : Int16); procedure FadeTo(Screen: PMenu); + //popup hack + procedure CheckFadeTo(Screen: PMenu; msg: String); function DrawBG: boolean; virtual; function DrawFG: boolean; virtual; @@ -873,6 +875,15 @@ begin Display.NextScreen := Screen; end; +//popup hack +procedure TMenu.CheckFadeTo(Screen: PMenu; msg: String); +begin + Display.Fade := 0; + Display.NextScreenWithCheck := Screen; + Display.CheckOK:=False; + ScreenPopupCheck.ShowPopup(msg); +end; + procedure TMenu.AddButtonText(AddX, AddY: real; AddText: string); begin AddButtonText(AddX, AddY, 1, 1, 1, AddText); -- cgit v1.2.3