add sync and GL infos

This commit is contained in:
nek0 2020-10-15 18:49:04 +02:00
parent fc6bfa1ca5
commit 3332370012

View file

@ -17,11 +17,21 @@ import qualified SDL
import qualified SDL.Raw.Video as SDL (glSetAttribute)
import qualified SDL.Raw.Enum as SDL
import qualified Graphics.Rendering.OpenGL as GL (clear, flush, ClearBuffer(..))
import qualified Graphics.GL as GLRaw
import Foreign.Marshal.Array
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as B8
import System.Clock
import Control.Monad.Loops
import Control.Monad.State.Strict
-- internal imports
import Affection.Types as A
import Affection.Class as A
import Affection.StateMachine as A
@ -31,9 +41,6 @@ import Affection.Subsystems as A
import Affection.Logging as A
import qualified Graphics.Rendering.OpenGL as GL (clear, flush, ClearBuffer(..))
-- | Main function which bootstraps everything else.
withAffection
:: forall us. (Affectionate us)
@ -50,6 +57,8 @@ withAffection AffectionConfig{..} = do
SDL.initialize is
-- give SDL render quality
SDL.HintRenderScaleQuality SDL.$= SDL.ScaleLinear
-- sync updates with monitor
SDL.swapInterval $= SDL.SynchronizedUpdates
-- just checking…
do
renderQuality <- SDL.get SDL.HintRenderScaleQuality
@ -70,6 +79,9 @@ withAffection AffectionConfig{..} = do
mapM_ (\w -> flip SDL.setWindowMode ((\(_,_,z) -> z) w) ((\(_,y,_) -> y) w)) windows
-- SDL.swapInterval $= SDL.SynchronizedUpdates -- <- causes Problems with windows
liftIO $ logIO Debug "Getting Time"
-- print current used GL Version
version <- peerArray0 (0 :: Word8) =<< GLRaw.glGetString GLRaw.GL_VERSION
print (B.pack version)
-- get current time
execTime <- getTime Monotonic
liftIO $ logIO Debug "Loading initial data container"