packages feed

tcod-haskell-0.2.0.0: src/Game/TCOD/Version.hs

module Game.TCOD.Version(
    tcodHexVersion
  , tcodVersion
  , tcodVersionName
  , tcodTechVersion
  ) where

import Game.TCOD.Context as C
import System.IO.Unsafe (unsafePerformIO)
import Foreign.C

context tcodContext
include "libtcod/libtcod_version.h"

tcodHexVersion :: Word
tcodHexVersion = unsafePerformIO $ fromIntegral <$> [C.exp| int {TCOD_HEXVERSION} |]

tcodVersion :: String
tcodVersion = unsafePerformIO $ peekCString =<< [C.exp| const char* {TCOD_STRVERSION} |]

tcodVersionName :: String
tcodVersionName = unsafePerformIO $ peekCString =<< [C.exp| const char* {TCOD_STRVERSIONNAME} |]

tcodTechVersion :: Word
tcodTechVersion = unsafePerformIO $ fromIntegral <$> [C.exp| int {TCOD_TECHVERSION} |]