From 41e75dcdeb932bae140737be9e874d06873e6f9b Mon Sep 17 00:00:00 2001 From: tpajenka Date: Fri, 20 Jun 2014 00:19:02 +0200 Subject: [PATCH] upper bound of 0.001s for frame diff time (Main.hs), added second viewport widget to GUI (currently just an empty shell) --- src/Main.hs | 2 +- src/UI/Callbacks.hs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Main.hs b/src/Main.hs index d0da614..20ea800 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -210,7 +210,7 @@ run = do targetFrametime = 1.0/targetFramerate --targetFrametimeμs = targetFrametime * 1000000.0 now <- getCurrentTime - let diff = diffUTCTime now (state ^. io.clock) -- get time-diffs + let diff = max 0.001 $ diffUTCTime now (state ^. io.clock) -- get time-diffs updatediff = diffUTCTime now (state ^. io.tessClockTime) -- get diff to last update title = unwords ["Pioneers @ ",show ((round . double $ 1.0/diff)::Int),"fps"] ddiff = double diff diff --git a/src/UI/Callbacks.hs b/src/UI/Callbacks.hs index 62bf672..dedfb8a 100644 --- a/src/UI/Callbacks.hs +++ b/src/UI/Callbacks.hs @@ -26,11 +26,12 @@ import UI.UIOperations createGUI :: ScreenUnit -> ScreenUnit -> UIState createGUI w h = UIState { _uiHasChanged = True - , _uiMap = Map.fromList [ (UIId 0, createViewport LeftButton (0, 0, w, h) [UIId 1, UIId 2] 0) -- TODO: automatic resize - , (UIId 1, createContainer (30, 215, 100, 80) [] 1) - , (UIId 2, createPanel (50, 40, 0, 0) [UIId 3, UIId 4] 3) + , _uiMap = Map.fromList [ (UIId 0, createViewport LeftButton (0, 0, w, h) [UIId 1, UIId 2, UIId 5] 0) -- TODO: automatic resize + , (UIId 1, createContainer (30, 415, 100, 80) [] 1) + , (UIId 2, createPanel (50, 240, 0, 0) [UIId 3, UIId 4] 3) , (UIId 3, createContainer (80, 15, 130, 90) [] 4 ) , (UIId 4, createButton (10, 40, 60, 130) 2 testMessage) + , (UIId 5, createViewport LeftButton (10, 10, 300, 200) [] 0) ] , _uiObserverEvents = Map.fromList [(WindowEvent, [resizeToScreenHandler (UIId 0)])] , _uiRoots = [UIId 0]