module Reanimate.Parameters
( Raster(..)
, Width
, Height
, FPS
, pRaster
, pFPS
, pWidth
, pHeight
, pNoExternals
, pRootDirectory
, setRaster
, setFPS
, setWidth
, setHeight
, setNoExternals
, setRootDirectory
) where
import Data.IORef (IORef, newIORef, readIORef, writeIORef)
import System.IO.Unsafe (unsafePerformIO)
type Width = Int
type Height = Int
type FPS = Int
data Raster
= RasterNone
| RasterAuto
| RasterInkscape
| RasterRSvg
| RasterMagick
deriving (Int -> Raster -> ShowS
[Raster] -> ShowS
Raster -> String
(Int -> Raster -> ShowS)
-> (Raster -> String) -> ([Raster] -> ShowS) -> Show Raster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Raster] -> ShowS
$cshowList :: [Raster] -> ShowS
show :: Raster -> String
$cshow :: Raster -> String
showsPrec :: Int -> Raster -> ShowS
$cshowsPrec :: Int -> Raster -> ShowS
Show, Raster -> Raster -> Bool
(Raster -> Raster -> Bool)
-> (Raster -> Raster -> Bool) -> Eq Raster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Raster -> Raster -> Bool
$c/= :: Raster -> Raster -> Bool
== :: Raster -> Raster -> Bool
$c== :: Raster -> Raster -> Bool
Eq)
{-# NOINLINE pRasterRef #-}
pRasterRef :: IORef Raster
pRasterRef :: IORef Raster
pRasterRef = IO (IORef Raster) -> IORef Raster
forall a. IO a -> a
unsafePerformIO (Raster -> IO (IORef Raster)
forall a. a -> IO (IORef a)
newIORef Raster
RasterNone)
{-# NOINLINE pRaster #-}
pRaster :: Raster
pRaster :: Raster
pRaster = IO Raster -> Raster
forall a. IO a -> a
unsafePerformIO (IORef Raster -> IO Raster
forall a. IORef a -> IO a
readIORef IORef Raster
pRasterRef)
setRaster :: Raster -> IO ()
setRaster :: Raster -> IO ()
setRaster = IORef Raster -> Raster -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef Raster
pRasterRef
{-# NOINLINE pFPSRef #-}
pFPSRef :: IORef FPS
pFPSRef :: IORef Int
pFPSRef = IO (IORef Int) -> IORef Int
forall a. IO a -> a
unsafePerformIO (Int -> IO (IORef Int)
forall a. a -> IO (IORef a)
newIORef Int
0)
{-# NOINLINE pFPS #-}
pFPS :: FPS
pFPS :: Int
pFPS = IO Int -> Int
forall a. IO a -> a
unsafePerformIO (IORef Int -> IO Int
forall a. IORef a -> IO a
readIORef IORef Int
pFPSRef)
setFPS :: FPS -> IO ()
setFPS :: Int -> IO ()
setFPS = IORef Int -> Int -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef Int
pFPSRef
{-# NOINLINE pWidthRef #-}
pWidthRef :: IORef FPS
pWidthRef :: IORef Int
pWidthRef = IO (IORef Int) -> IORef Int
forall a. IO a -> a
unsafePerformIO (Int -> IO (IORef Int)
forall a. a -> IO (IORef a)
newIORef Int
0)
{-# NOINLINE pWidth #-}
pWidth :: Width
pWidth :: Int
pWidth = IO Int -> Int
forall a. IO a -> a
unsafePerformIO (IORef Int -> IO Int
forall a. IORef a -> IO a
readIORef IORef Int
pWidthRef)
setWidth :: Width -> IO ()
setWidth :: Int -> IO ()
setWidth = IORef Int -> Int -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef Int
pWidthRef
{-# NOINLINE pHeightRef #-}
pHeightRef :: IORef FPS
pHeightRef :: IORef Int
pHeightRef = IO (IORef Int) -> IORef Int
forall a. IO a -> a
unsafePerformIO (Int -> IO (IORef Int)
forall a. a -> IO (IORef a)
newIORef Int
0)
{-# NOINLINE pHeight #-}
pHeight :: Height
pHeight :: Int
pHeight = IO Int -> Int
forall a. IO a -> a
unsafePerformIO (IORef Int -> IO Int
forall a. IORef a -> IO a
readIORef IORef Int
pHeightRef)
setHeight :: Height -> IO ()
setHeight :: Int -> IO ()
setHeight = IORef Int -> Int -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef Int
pHeightRef
{-# NOINLINE pNoExternalsRef #-}
pNoExternalsRef :: IORef Bool
pNoExternalsRef :: IORef Bool
pNoExternalsRef = IO (IORef Bool) -> IORef Bool
forall a. IO a -> a
unsafePerformIO (Bool -> IO (IORef Bool)
forall a. a -> IO (IORef a)
newIORef Bool
False)
{-# NOINLINE pNoExternals #-}
pNoExternals :: Bool
pNoExternals :: Bool
pNoExternals = IO Bool -> Bool
forall a. IO a -> a
unsafePerformIO (IORef Bool -> IO Bool
forall a. IORef a -> IO a
readIORef IORef Bool
pNoExternalsRef)
setNoExternals :: Bool -> IO ()
setNoExternals :: Bool -> IO ()
setNoExternals = IORef Bool -> Bool -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef Bool
pNoExternalsRef
{-# NOINLINE pRootDirectoryRef #-}
pRootDirectoryRef :: IORef FilePath
pRootDirectoryRef :: IORef String
pRootDirectoryRef = IO (IORef String) -> IORef String
forall a. IO a -> a
unsafePerformIO (String -> IO (IORef String)
forall a. a -> IO (IORef a)
newIORef (ShowS
forall a. HasCallStack => String -> a
error String
"root directory not set"))
{-# NOINLINE pRootDirectory #-}
pRootDirectory :: FilePath
pRootDirectory :: String
pRootDirectory = IO String -> String
forall a. IO a -> a
unsafePerformIO (IORef String -> IO String
forall a. IORef a -> IO a
readIORef IORef String
pRootDirectoryRef)
setRootDirectory :: FilePath -> IO ()
setRootDirectory :: String -> IO ()
setRootDirectory = IORef String -> String -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef String
pRootDirectoryRef