From 544d6b5d3ebc527245d20542b6130baef315b715 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Sat, 27 Jun 2009 21:40:55 +0000 Subject: merged r1830 trunk (current) in this branch add some files to svn:ignore git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1831 b956fd51-792f-4845-bead-9b4dfca2ff2c --- unicode/src/base/UMain.pas | 89 +++++++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 29 deletions(-) (limited to 'unicode/src/base/UMain.pas') diff --git a/unicode/src/base/UMain.pas b/unicode/src/base/UMain.pas index 8d11b91d..1962e953 100644 --- a/unicode/src/base/UMain.pas +++ b/unicode/src/base/UMain.pas @@ -66,11 +66,6 @@ implementation uses Math, gl, -{ - SDL_ttf, - UParty, - UCore, -} UCatCovers, UCommandLine, UCommon, @@ -88,10 +83,12 @@ uses UPath, UPlaylist, UMusic, + UBeatTimer, UPlatform, USkins, USongs, UThemes, + UParty, UTime; procedure Main; @@ -236,14 +233,12 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PluginManager', 1); -{ // Party Mode Manager Log.BenchmarkStart(1); Log.LogStatus('PartySession Manager', 'Initialization'); PartySession := TPartySession.Create; //Load PartySession Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PartySession Manager', 1); -} // Graphics Log.BenchmarkStart(1); @@ -364,9 +359,11 @@ begin CountMidTime; Delay := Floor(1000 / MAX_FPS - 1000 * TimeMid); + Log.LogError ('MainLoop', 'Delay: ' + intToStr(Delay)); if Delay >= 1 then SDL_Delay(Delay); // dynamic, maximum is 100 fps + Log.LogError ('MainLoop', 'Delay: ok ' + intToStr(Delay)); CountSkipTime; @@ -380,9 +377,26 @@ begin end; end; +procedure DoQuit; +begin + // if question option is enabled then show exit popup + if (Ini.AskbeforeDel = 1) then + begin + Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX'); + end + else // if ask-for-exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := true; + end; +end; + procedure CheckEvents; var - Event: TSDL_event; + Event: TSDL_event; + mouseDown: boolean; + mouseBtn: integer; begin if Assigned(Display.NextScreen) then Exit; @@ -396,17 +410,46 @@ begin Display.NextScreenWithCheck := nil; Display.CheckOK := true; end; - SDL_MOUSEBUTTONDOWN: + + SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP: begin -{ - with Event.button do + if (Ini.Mouse > 0) then begin - if State = SDL_BUTTON_LEFT then + case Event.type_ of + SDL_MOUSEMOTION: + begin + mouseDown := false; + mouseBtn := 0; + end; + SDL_MOUSEBUTTONDOWN: + begin + mouseDown := true; + mouseBtn := Event.button.button; + end; + SDL_MOUSEBUTTONUP: + begin + mouseDown := false; + mouseBtn := Event.button.button; + end; + end; + + Display.MoveCursor(Event.button.X * 800 / Screen.w, + Event.button.Y * 600 / Screen.h, + mouseDown and ((mouseBtn <> SDL_BUTTON_WHEELDOWN) or (mouseBtn <> SDL_BUTTON_WHEELUP))); + + if (ScreenPopupError <> nil) and (ScreenPopupError.Visible) then + done := not ScreenPopupError.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) + else if (ScreenPopupCheck <> nil) and (ScreenPopupCheck.Visible) then + done := not ScreenPopupCheck.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) + else begin - // + done := not Display.CurrentScreen^.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y); + + // if screen wants to exit + if done then + DoQuit; end; end; -} end; SDL_VIDEORESIZE: begin @@ -442,14 +485,14 @@ begin if boolean( Ini.FullScreen ) then begin SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); - SDL_ShowCursor(0); end else begin SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_RESIZABLE); - SDL_ShowCursor(1); end; + Display.SetCursor; + glViewPort(0, 0, ScreenW, ScreenH); {$IFEND} end @@ -469,19 +512,7 @@ begin // if screen wants to exit if Done then - begin - // if question option is enabled then show exit popup - if (Ini.AskbeforeDel = 1) then - begin - Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX'); - end - else // if ask-for-exit is disabled then simply exit - begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := true; - end; - end; + DoQuit; end; end; -- cgit v1.2.3