Window shows fps-count + proc-tex-shader

- added fps to window-name
- hsSDL2 needs update (as i changed functions in there which got merged)
- wrote simplistic procedural texture shader
This commit is contained in:
Stefan Dresselhaus
2014-01-22 14:04:18 +01:00
parent 080776b25c
commit 5f313c4495
7 changed files with 447 additions and 19 deletions

View File

@ -315,6 +315,8 @@ run = do
mt <- liftIO $ do
now <- getCurrentTime
diff <- return $ diffUTCTime now (stateClock state) -- get time-diffs
title <- return $ unwords ["Pioneers @ ",show $ ((round .fromRational.toRational $ 1/diff)::Int),"fps"]
setWindowTitle win $ title
sleepAmount <- return $ floor (max 0 (0.04 - diff))*1000000 -- get time until next frame in microseconds
threadDelay sleepAmount
return now
@ -447,5 +449,4 @@ processEvent e = do
}
Quit -> modify $ \s -> s {stateWinClose = True}
-- there is more (joystic, touchInterface, ...), but currently ignored
_ -> return ()
liftIO $ putStrLn $ unwords ["Processing Event:",(show e)]
_ -> liftIO $ putStrLn $ unwords ["Not processing Event:",(show e)]

View File

@ -1,10 +1,8 @@
{-# LANGUAGE ForeignFunctionInterface #-}
module Render.Misc where
import Control.Monad
import qualified Data.ByteString as B (ByteString)
import Foreign.Marshal.Array (allocaArray,
pokeArray)
import Foreign.C (CFloat)
import Graphics.Rendering.OpenGL.GL.Shaders
import Graphics.Rendering.OpenGL.GL.StateVar
import Graphics.Rendering.OpenGL.GL.StringQueries
@ -12,7 +10,7 @@ import Graphics.Rendering.OpenGL.GLU.Errors
import Graphics.Rendering.OpenGL.Raw.Core31
import System.IO (hPutStrLn, stderr)
import Linear
import Foreign.C (CFloat)
up :: V3 CFloat
up = V3 0 1 0