Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put Float types in hsc under the guard too #252

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions src/SDL/Raw/Types.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ module SDL.Raw.Types (
Palette(..),
PixelFormat(..),
Point(..),
FPoint(..),
Rect(..),
#ifdef RECENT_ISH
FPoint(..),
FRect(..),
#endif
RendererInfo(..),
RWops(..),
Surface(..),
Expand Down Expand Up @@ -1334,22 +1336,6 @@ instance Storable Point where
(#poke SDL_Point, x) ptr x
(#poke SDL_Point, y) ptr y

data FPoint = FPoint
{ fPointX :: !CFloat
, fPointY :: !CFloat
} deriving (Eq, Show, Typeable)

instance Storable FPoint where
sizeOf _ = (#size SDL_FPoint)
alignment = sizeOf
peek ptr = do
x <- (#peek SDL_FPoint, x) ptr
y <- (#peek SDL_FPoint, y) ptr
return $! FPoint x y
poke ptr (FPoint x y) = do
(#poke SDL_FPoint, x) ptr x
(#poke SDL_FPoint, y) ptr y

data Rect = Rect
{ rectX :: !CInt
, rectY :: !CInt
Expand All @@ -1372,6 +1358,24 @@ instance Storable Rect where
(#poke SDL_Rect, w) ptr w
(#poke SDL_Rect, h) ptr h

#ifdef RECENT_ISH

data FPoint = FPoint
{ fPointX :: !CFloat
, fPointY :: !CFloat
} deriving (Eq, Show, Typeable)

instance Storable FPoint where
sizeOf _ = (#size SDL_FPoint)
alignment = sizeOf
peek ptr = do
x <- (#peek SDL_FPoint, x) ptr
y <- (#peek SDL_FPoint, y) ptr
return $! FPoint x y
poke ptr (FPoint x y) = do
(#poke SDL_FPoint, x) ptr x
(#poke SDL_FPoint, y) ptr y

data FRect = FRect
{ fRectX :: !CFloat
, fRectY :: !CFloat
Expand All @@ -1394,6 +1398,8 @@ instance Storable FRect where
(#poke SDL_FRect, w) ptr w
(#poke SDL_FRect, h) ptr h

#endif

data RendererInfo = RendererInfo
{ rendererInfoName :: !CString
, rendererInfoFlags :: !Word32
Expand Down