started creating a GUI overlay image

This commit is contained in:
tpajenka 2014-03-05 13:27:48 +01:00
parent 734cabb759
commit be0da410a0
3 changed files with 25 additions and 2 deletions

View File

@ -11,12 +11,14 @@ executable Pioneers
} else { } else {
ghc-options: -Wall -Odph -rtsopts -threaded -fno-liberate-case -funfolding-use-threshold1000 -funfolding-keeness-factor1000 -optlo-O3 -fllvm ghc-options: -Wall -Odph -rtsopts -threaded -fno-liberate-case -funfolding-use-threshold1000 -funfolding-keeness-factor1000 -optlo-O3 -fllvm
} }
other-modules: other-module
Map.Map, Map.Map,
Render.Misc, Render.Misc,
Render.Render, Render.Render,
Render.RenderObject, Render.RenderObject,
UI.Callbacks, UI.Callbacks,
Types,
UI.SurfaceOverlay
Types Types
main-is: Main.hs main-is: Main.hs
build-depends: build-depends:

View File

@ -40,6 +40,7 @@ import Render.Misc (checkError,
import Render.Render (initRendering, import Render.Render (initRendering,
initShader) initShader)
import UI.Callbacks import UI.Callbacks
import UI.GUIOverlay
import Types import Types
import qualified Debug.Trace as D (trace) import qualified Debug.Trace as D (trace)
@ -53,7 +54,7 @@ main = do
,WindowResizable -- and resizable ,WindowResizable -- and resizable
,WindowInputFocus -- focused (=> active) ,WindowInputFocus -- focused (=> active)
,WindowMouseFocus -- Mouse into it ,WindowMouseFocus -- Mouse into it
,WindowInputGrabbed-- never let go of input (KB/Mouse) --,WindowInputGrabbed-- never let go of input (KB/Mouse)
] $ \window -> do ] $ \window -> do
withOpenGL window $ do withOpenGL window $ do
(Size fbWidth fbHeight) <- glGetDrawableSize window (Size fbWidth fbHeight) <- glGetDrawableSize window

20
src/UI/GUIOverlay.hs Normal file
View File

@ -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