From be0da410a0ba522d8d06fb3487af431bd5327687 Mon Sep 17 00:00:00 2001 From: tpajenka Date: Wed, 5 Mar 2014 13:27:48 +0100 Subject: [PATCH] started creating a GUI overlay image --- Pioneers.cabal | 4 +++- src/Main.hs | 3 ++- src/UI/GUIOverlay.hs | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/UI/GUIOverlay.hs diff --git a/Pioneers.cabal b/Pioneers.cabal index 1fbb7ce..03f8b90 100644 --- a/Pioneers.cabal +++ b/Pioneers.cabal @@ -11,12 +11,14 @@ executable Pioneers } else { ghc-options: -Wall -Odph -rtsopts -threaded -fno-liberate-case -funfolding-use-threshold1000 -funfolding-keeness-factor1000 -optlo-O3 -fllvm } - other-modules: + other-module Map.Map, Render.Misc, Render.Render, Render.RenderObject, UI.Callbacks, + Types, + UI.SurfaceOverlay Types main-is: Main.hs build-depends: diff --git a/src/Main.hs b/src/Main.hs index 142b6cf..bf6bb7e 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -40,6 +40,7 @@ import Render.Misc (checkError, import Render.Render (initRendering, initShader) import UI.Callbacks +import UI.GUIOverlay import Types import qualified Debug.Trace as D (trace) @@ -53,7 +54,7 @@ main = do ,WindowResizable -- and resizable ,WindowInputFocus -- focused (=> active) ,WindowMouseFocus -- Mouse into it - ,WindowInputGrabbed-- never let go of input (KB/Mouse) + --,WindowInputGrabbed-- never let go of input (KB/Mouse) ] $ \window -> do withOpenGL window $ do (Size fbWidth fbHeight) <- glGetDrawableSize window diff --git a/src/UI/GUIOverlay.hs b/src/UI/GUIOverlay.hs new file mode 100644 index 0000000..4114bda --- /dev/null +++ b/src/UI/GUIOverlay.hs @@ -0,0 +1,20 @@ +module UI.GUIOverlay where + +import Data.Int +import Graphics.UI.SDL.Surface +import Graphics.UI.SDL.Color +import Graphics.UI.SDL.Rect +import Graphics.UI.SDL.Types + +--createRGBSurface :: Int32 -> Int32 -> Int32 -> Word32 -> Word32 -> Word32 -> Word32 -> IO Surface +-- width height depth rFilter gFilter bFilter aFilter + +updateGUI :: Int32 -> Int32 -> IO Surface +updateGUI width height = do + overlay <- createRGBSurface width height 32 0xFF000000 0x00FF0000 0x0000FF00 0x000000FF + fillRect overlay (Rect 10 10 400 300) (Color 255 0 128 255) + return overlay + + +--createTextureFromSurface :: Renderer -> Surface -> IO Texture +--createSoftwareRenderer :: Surface -> IO Renderer \ No newline at end of file