Skip to content

Commit

Permalink
Put Float types in hsc under the guard too
Browse files Browse the repository at this point in the history
  • Loading branch information
dpwiz committed Mar 10, 2022
1 parent 40e89b2 commit c187e39
Showing 1 changed file with 23 additions and 17 deletions.
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

0 comments on commit c187e39

Please sign in to comment.