{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE NoFieldSelectors #-}
{-# LANGUAGE NoImplicitPrelude #-}

-- | Some helper functions for managing rectangles and 2D points, in both integer and floating point versions. The structure that defines a point (using integers).
--
--     @since 3.2.0
--
--     [See also]: 'sDL_GetRectEnclosingPoints', 'sDL_PointInRect'
module SDL3.Sys.Bindgen.Rect (
  SDL3.Sys.Bindgen.Rect.SDL_Point (..),
  SDL3.Sys.Bindgen.Rect.SDL_FPoint (..),
  SDL3.Sys.Bindgen.Rect.SDL_Rect (..),
  SDL3.Sys.Bindgen.Rect.SDL_FRect (..),
)
where

import Prelude (Eq, Int, Show, pure, (<*>), (>>), type (~))

import HsBindgen.Runtime.HasCField qualified as HasCField
import HsBindgen.Runtime.Marshal qualified as Marshal
import HsBindgen.Runtime.Struct qualified as Struct
import HsBindgen.Runtime.Support qualified as BG
import HsBindgen.Runtime.Support.CompatHasField qualified as BG.CompatHasField

-- | [C declaration]: @struct SDL_Point@, defined at @SDL3\/SDL_rect.h 49:16@
data SDL_Point = SDL_Point
  { SDL_Point -> CInt
x :: BG.CInt
  -- ^ [C declaration]: @x@, defined at @SDL3\/SDL_rect.h 51:9@
  , SDL_Point -> CInt
y :: BG.CInt
  -- ^ [C declaration]: @y@, defined at @SDL3\/SDL_rect.h 52:9@
  }
  deriving stock ((forall x. SDL_Point -> Rep SDL_Point x)
-> (forall x. Rep SDL_Point x -> SDL_Point) -> Generic SDL_Point
forall x. Rep SDL_Point x -> SDL_Point
forall x. SDL_Point -> Rep SDL_Point x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_Point -> Rep SDL_Point x
from :: forall x. SDL_Point -> Rep SDL_Point x
$cto :: forall x. Rep SDL_Point x -> SDL_Point
to :: forall x. Rep SDL_Point x -> SDL_Point
BG.Generic, SDL_Point -> SDL_Point -> Bool
(SDL_Point -> SDL_Point -> Bool)
-> (SDL_Point -> SDL_Point -> Bool) -> Eq SDL_Point
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_Point -> SDL_Point -> Bool
== :: SDL_Point -> SDL_Point -> Bool
$c/= :: SDL_Point -> SDL_Point -> Bool
/= :: SDL_Point -> SDL_Point -> Bool
Eq, Int -> SDL_Point -> ShowS
[SDL_Point] -> ShowS
SDL_Point -> String
(Int -> SDL_Point -> ShowS)
-> (SDL_Point -> String)
-> ([SDL_Point] -> ShowS)
-> Show SDL_Point
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_Point -> ShowS
showsPrec :: Int -> SDL_Point -> ShowS
$cshow :: SDL_Point -> String
show :: SDL_Point -> String
$cshowList :: [SDL_Point] -> ShowS
showList :: [SDL_Point] -> ShowS
Show)

instance Marshal.StaticSize SDL_Point where
  staticSizeOf :: Proxy SDL_Point -> Int
staticSizeOf = \Proxy SDL_Point
_ -> (Int
8 :: Int)

  staticAlignment :: Proxy SDL_Point -> Int
staticAlignment = \Proxy SDL_Point
_ -> (Int
4 :: Int)

instance Marshal.ReadRaw SDL_Point where
  readRaw :: Ptr SDL_Point -> IO SDL_Point
readRaw =
    \Ptr SDL_Point
ptr0 ->
      (CInt -> CInt -> SDL_Point) -> IO (CInt -> CInt -> SDL_Point)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CInt -> CInt -> SDL_Point
SDL_Point
        IO (CInt -> CInt -> SDL_Point) -> IO CInt -> IO (CInt -> SDL_Point)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "x" -> Ptr SDL_Point -> IO (CFieldType SDL_Point "x")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x") Ptr SDL_Point
ptr0
        IO (CInt -> SDL_Point) -> IO CInt -> IO SDL_Point
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "y" -> Ptr SDL_Point -> IO (CFieldType SDL_Point "y")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y") Ptr SDL_Point
ptr0

instance Marshal.WriteRaw SDL_Point where
  writeRaw :: Ptr SDL_Point -> SDL_Point -> IO ()
writeRaw =
    \Ptr SDL_Point
ptr0 ->
      \SDL_Point
s1 ->
        case SDL_Point
s1 of
          SDL_Point CInt
x2 CInt
y3 ->
            Proxy "x" -> Ptr SDL_Point -> CFieldType SDL_Point "x" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x") Ptr SDL_Point
ptr0 CInt
CFieldType SDL_Point "x"
x2
              IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "y" -> Ptr SDL_Point -> CFieldType SDL_Point "y" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y") Ptr SDL_Point
ptr0 CInt
CFieldType SDL_Point "y"
y3

deriving via Marshal.EquivStorable SDL_Point instance BG.Storable SDL_Point

deriving via Struct.IsStructViaReadRaw SDL_Point instance Struct.IsStruct SDL_Point

-- | [C declaration]: @x@, defined at @SDL3\/SDL_rect.h 51:9@
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" SDL_Point ty where
  hasField :: SDL_Point -> (ty -> SDL_Point, ty)
hasField =
    \SDL_Point
x0 ->
      ( \ty
y1 ->
          SDL_Point{x :: CInt
x = ty
CInt
y1, y :: CInt
y = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_Point
x0}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_Point
x0
      )

instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr SDL_Point) (BG.Ptr ty) where
  getField :: Ptr SDL_Point -> Ptr ty
getField = Proxy "x" -> Ptr SDL_Point -> Ptr (CFieldType SDL_Point "x")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x")

instance HasCField.HasCField SDL_Point "x" where
  type CFieldType SDL_Point "x" = BG.CInt

  offset# :: Proxy# SDL_Point -> Proxy# "x" -> Int
offset# = \Proxy# SDL_Point
_ -> \Proxy# "x"
_ -> Int
0

-- | [C declaration]: @y@, defined at @SDL3\/SDL_rect.h 52:9@
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "y" SDL_Point ty where
  hasField :: SDL_Point -> (ty -> SDL_Point, ty)
hasField =
    \SDL_Point
x0 ->
      ( \ty
y1 ->
          SDL_Point{y :: CInt
y = ty
CInt
y1, x :: CInt
x = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_Point
x0}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_Point
x0
      )

instance (ty ~ BG.CInt) => BG.HasField "y" (BG.Ptr SDL_Point) (BG.Ptr ty) where
  getField :: Ptr SDL_Point -> Ptr ty
getField = Proxy "y" -> Ptr SDL_Point -> Ptr (CFieldType SDL_Point "y")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y")

instance HasCField.HasCField SDL_Point "y" where
  type CFieldType SDL_Point "y" = BG.CInt

  offset# :: Proxy# SDL_Point -> Proxy# "y" -> Int
offset# = \Proxy# SDL_Point
_ -> \Proxy# "y"
_ -> Int
4

-- | The structure that defines a point (using floating point values).
--
--     @since 3.2.0
--
--     [See also]: 'sDL_GetRectEnclosingPointsFloat', 'sDL_PointInRectFloat'
--
--     [C declaration]: @struct SDL_FPoint@, defined at @SDL3\/SDL_rect.h 63:16@
data SDL_FPoint = SDL_FPoint
  { SDL_FPoint -> CFloat
x :: BG.CFloat
  -- ^ [C declaration]: @x@, defined at @SDL3\/SDL_rect.h 65:11@
  , SDL_FPoint -> CFloat
y :: BG.CFloat
  -- ^ [C declaration]: @y@, defined at @SDL3\/SDL_rect.h 66:11@
  }
  deriving stock ((forall x. SDL_FPoint -> Rep SDL_FPoint x)
-> (forall x. Rep SDL_FPoint x -> SDL_FPoint) -> Generic SDL_FPoint
forall x. Rep SDL_FPoint x -> SDL_FPoint
forall x. SDL_FPoint -> Rep SDL_FPoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_FPoint -> Rep SDL_FPoint x
from :: forall x. SDL_FPoint -> Rep SDL_FPoint x
$cto :: forall x. Rep SDL_FPoint x -> SDL_FPoint
to :: forall x. Rep SDL_FPoint x -> SDL_FPoint
BG.Generic, SDL_FPoint -> SDL_FPoint -> Bool
(SDL_FPoint -> SDL_FPoint -> Bool)
-> (SDL_FPoint -> SDL_FPoint -> Bool) -> Eq SDL_FPoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_FPoint -> SDL_FPoint -> Bool
== :: SDL_FPoint -> SDL_FPoint -> Bool
$c/= :: SDL_FPoint -> SDL_FPoint -> Bool
/= :: SDL_FPoint -> SDL_FPoint -> Bool
Eq, Int -> SDL_FPoint -> ShowS
[SDL_FPoint] -> ShowS
SDL_FPoint -> String
(Int -> SDL_FPoint -> ShowS)
-> (SDL_FPoint -> String)
-> ([SDL_FPoint] -> ShowS)
-> Show SDL_FPoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_FPoint -> ShowS
showsPrec :: Int -> SDL_FPoint -> ShowS
$cshow :: SDL_FPoint -> String
show :: SDL_FPoint -> String
$cshowList :: [SDL_FPoint] -> ShowS
showList :: [SDL_FPoint] -> ShowS
Show)

instance Marshal.StaticSize SDL_FPoint where
  staticSizeOf :: Proxy SDL_FPoint -> Int
staticSizeOf = \Proxy SDL_FPoint
_ -> (Int
8 :: Int)

  staticAlignment :: Proxy SDL_FPoint -> Int
staticAlignment = \Proxy SDL_FPoint
_ -> (Int
4 :: Int)

instance Marshal.ReadRaw SDL_FPoint where
  readRaw :: Ptr SDL_FPoint -> IO SDL_FPoint
readRaw =
    \Ptr SDL_FPoint
ptr0 ->
      (CFloat -> CFloat -> SDL_FPoint)
-> IO (CFloat -> CFloat -> SDL_FPoint)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CFloat -> CFloat -> SDL_FPoint
SDL_FPoint
        IO (CFloat -> CFloat -> SDL_FPoint)
-> IO CFloat -> IO (CFloat -> SDL_FPoint)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "x" -> Ptr SDL_FPoint -> IO (CFieldType SDL_FPoint "x")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x") Ptr SDL_FPoint
ptr0
        IO (CFloat -> SDL_FPoint) -> IO CFloat -> IO SDL_FPoint
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "y" -> Ptr SDL_FPoint -> IO (CFieldType SDL_FPoint "y")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y") Ptr SDL_FPoint
ptr0

instance Marshal.WriteRaw SDL_FPoint where
  writeRaw :: Ptr SDL_FPoint -> SDL_FPoint -> IO ()
writeRaw =
    \Ptr SDL_FPoint
ptr0 ->
      \SDL_FPoint
s1 ->
        case SDL_FPoint
s1 of
          SDL_FPoint CFloat
x2 CFloat
y3 ->
            Proxy "x" -> Ptr SDL_FPoint -> CFieldType SDL_FPoint "x" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x") Ptr SDL_FPoint
ptr0 CFloat
CFieldType SDL_FPoint "x"
x2
              IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "y" -> Ptr SDL_FPoint -> CFieldType SDL_FPoint "y" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y") Ptr SDL_FPoint
ptr0 CFloat
CFieldType SDL_FPoint "y"
y3

deriving via Marshal.EquivStorable SDL_FPoint instance BG.Storable SDL_FPoint

deriving via Struct.IsStructViaReadRaw SDL_FPoint instance Struct.IsStruct SDL_FPoint

-- | [C declaration]: @x@, defined at @SDL3\/SDL_rect.h 65:11@
instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "x" SDL_FPoint ty where
  hasField :: SDL_FPoint -> (ty -> SDL_FPoint, ty)
hasField =
    \SDL_FPoint
x0 ->
      ( \ty
y1 ->
          SDL_FPoint{x :: CFloat
x = ty
CFloat
y1, y :: CFloat
y = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_FPoint
x0}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_FPoint
x0
      )

instance
  (ty ~ BG.CFloat)
  => BG.HasField "x" (BG.Ptr SDL_FPoint) (BG.Ptr ty)
  where
  getField :: Ptr SDL_FPoint -> Ptr ty
getField = Proxy "x" -> Ptr SDL_FPoint -> Ptr (CFieldType SDL_FPoint "x")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x")

instance HasCField.HasCField SDL_FPoint "x" where
  type CFieldType SDL_FPoint "x" = BG.CFloat

  offset# :: Proxy# SDL_FPoint -> Proxy# "x" -> Int
offset# = \Proxy# SDL_FPoint
_ -> \Proxy# "x"
_ -> Int
0

-- | [C declaration]: @y@, defined at @SDL3\/SDL_rect.h 66:11@
instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "y" SDL_FPoint ty where
  hasField :: SDL_FPoint -> (ty -> SDL_FPoint, ty)
hasField =
    \SDL_FPoint
x0 ->
      ( \ty
y1 ->
          SDL_FPoint{y :: CFloat
y = ty
CFloat
y1, x :: CFloat
x = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_FPoint
x0}
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_FPoint
x0
      )

instance
  (ty ~ BG.CFloat)
  => BG.HasField "y" (BG.Ptr SDL_FPoint) (BG.Ptr ty)
  where
  getField :: Ptr SDL_FPoint -> Ptr ty
getField = Proxy "y" -> Ptr SDL_FPoint -> Ptr (CFieldType SDL_FPoint "y")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y")

instance HasCField.HasCField SDL_FPoint "y" where
  type CFieldType SDL_FPoint "y" = BG.CFloat

  offset# :: Proxy# SDL_FPoint -> Proxy# "y" -> Int
offset# = \Proxy# SDL_FPoint
_ -> \Proxy# "y"
_ -> Int
4

-- | A rectangle, with the origin at the upper left (using integers).
--
--     @since 3.2.0
--
--     [See also]: 'sDL_RectEmpty', 'sDL_RectsEqual', 'sDL_HasRectIntersection', 'sDL_GetRectIntersection', 'sDL_GetRectAndLineIntersection', 'sDL_GetRectUnion', 'sDL_GetRectEnclosingPoints'
--
--     [C declaration]: @struct SDL_Rect@, defined at @SDL3\/SDL_rect.h 83:16@
data SDL_Rect = SDL_Rect
  { SDL_Rect -> CInt
x :: BG.CInt
  -- ^ [C declaration]: @x@, defined at @SDL3\/SDL_rect.h 85:9@
  , SDL_Rect -> CInt
y :: BG.CInt
  -- ^ [C declaration]: @y@, defined at @SDL3\/SDL_rect.h 85:12@
  , SDL_Rect -> CInt
w :: BG.CInt
  -- ^ [C declaration]: @w@, defined at @SDL3\/SDL_rect.h 86:9@
  , SDL_Rect -> CInt
h :: BG.CInt
  -- ^ [C declaration]: @h@, defined at @SDL3\/SDL_rect.h 86:12@
  }
  deriving stock ((forall x. SDL_Rect -> Rep SDL_Rect x)
-> (forall x. Rep SDL_Rect x -> SDL_Rect) -> Generic SDL_Rect
forall x. Rep SDL_Rect x -> SDL_Rect
forall x. SDL_Rect -> Rep SDL_Rect x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_Rect -> Rep SDL_Rect x
from :: forall x. SDL_Rect -> Rep SDL_Rect x
$cto :: forall x. Rep SDL_Rect x -> SDL_Rect
to :: forall x. Rep SDL_Rect x -> SDL_Rect
BG.Generic, SDL_Rect -> SDL_Rect -> Bool
(SDL_Rect -> SDL_Rect -> Bool)
-> (SDL_Rect -> SDL_Rect -> Bool) -> Eq SDL_Rect
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_Rect -> SDL_Rect -> Bool
== :: SDL_Rect -> SDL_Rect -> Bool
$c/= :: SDL_Rect -> SDL_Rect -> Bool
/= :: SDL_Rect -> SDL_Rect -> Bool
Eq, Int -> SDL_Rect -> ShowS
[SDL_Rect] -> ShowS
SDL_Rect -> String
(Int -> SDL_Rect -> ShowS)
-> (SDL_Rect -> String) -> ([SDL_Rect] -> ShowS) -> Show SDL_Rect
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_Rect -> ShowS
showsPrec :: Int -> SDL_Rect -> ShowS
$cshow :: SDL_Rect -> String
show :: SDL_Rect -> String
$cshowList :: [SDL_Rect] -> ShowS
showList :: [SDL_Rect] -> ShowS
Show)

instance Marshal.StaticSize SDL_Rect where
  staticSizeOf :: Proxy SDL_Rect -> Int
staticSizeOf = \Proxy SDL_Rect
_ -> (Int
16 :: Int)

  staticAlignment :: Proxy SDL_Rect -> Int
staticAlignment = \Proxy SDL_Rect
_ -> (Int
4 :: Int)

instance Marshal.ReadRaw SDL_Rect where
  readRaw :: Ptr SDL_Rect -> IO SDL_Rect
readRaw =
    \Ptr SDL_Rect
ptr0 ->
      (CInt -> CInt -> CInt -> CInt -> SDL_Rect)
-> IO (CInt -> CInt -> CInt -> CInt -> SDL_Rect)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CInt -> CInt -> CInt -> CInt -> SDL_Rect
SDL_Rect
        IO (CInt -> CInt -> CInt -> CInt -> SDL_Rect)
-> IO CInt -> IO (CInt -> CInt -> CInt -> SDL_Rect)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "x" -> Ptr SDL_Rect -> IO (CFieldType SDL_Rect "x")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x") Ptr SDL_Rect
ptr0
        IO (CInt -> CInt -> CInt -> SDL_Rect)
-> IO CInt -> IO (CInt -> CInt -> SDL_Rect)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "y" -> Ptr SDL_Rect -> IO (CFieldType SDL_Rect "y")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y") Ptr SDL_Rect
ptr0
        IO (CInt -> CInt -> SDL_Rect) -> IO CInt -> IO (CInt -> SDL_Rect)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "w" -> Ptr SDL_Rect -> IO (CFieldType SDL_Rect "w")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"w") Ptr SDL_Rect
ptr0
        IO (CInt -> SDL_Rect) -> IO CInt -> IO SDL_Rect
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "h" -> Ptr SDL_Rect -> IO (CFieldType SDL_Rect "h")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"h") Ptr SDL_Rect
ptr0

instance Marshal.WriteRaw SDL_Rect where
  writeRaw :: Ptr SDL_Rect -> SDL_Rect -> IO ()
writeRaw =
    \Ptr SDL_Rect
ptr0 ->
      \SDL_Rect
s1 ->
        case SDL_Rect
s1 of
          SDL_Rect CInt
x2 CInt
y3 CInt
w4 CInt
h5 ->
            Proxy "x" -> Ptr SDL_Rect -> CFieldType SDL_Rect "x" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x") Ptr SDL_Rect
ptr0 CInt
CFieldType SDL_Rect "x"
x2
              IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "y" -> Ptr SDL_Rect -> CFieldType SDL_Rect "y" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y") Ptr SDL_Rect
ptr0 CInt
CFieldType SDL_Rect "y"
y3
              IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "w" -> Ptr SDL_Rect -> CFieldType SDL_Rect "w" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"w") Ptr SDL_Rect
ptr0 CInt
CFieldType SDL_Rect "w"
w4
              IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "h" -> Ptr SDL_Rect -> CFieldType SDL_Rect "h" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"h") Ptr SDL_Rect
ptr0 CInt
CFieldType SDL_Rect "h"
h5

deriving via Marshal.EquivStorable SDL_Rect instance BG.Storable SDL_Rect

deriving via Struct.IsStructViaReadRaw SDL_Rect instance Struct.IsStruct SDL_Rect

-- | [C declaration]: @x@, defined at @SDL3\/SDL_rect.h 85:9@
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "x" SDL_Rect ty where
  hasField :: SDL_Rect -> (ty -> SDL_Rect, ty)
hasField =
    \SDL_Rect
x0 ->
      ( \ty
y1 ->
          SDL_Rect
            { x :: CInt
x = ty
CInt
y1
            , y :: CInt
y = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_Rect
x0
            , w :: CInt
w = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"w" SDL_Rect
x0
            , h :: CInt
h = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"h" SDL_Rect
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_Rect
x0
      )

instance (ty ~ BG.CInt) => BG.HasField "x" (BG.Ptr SDL_Rect) (BG.Ptr ty) where
  getField :: Ptr SDL_Rect -> Ptr ty
getField = Proxy "x" -> Ptr SDL_Rect -> Ptr (CFieldType SDL_Rect "x")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x")

instance HasCField.HasCField SDL_Rect "x" where
  type CFieldType SDL_Rect "x" = BG.CInt

  offset# :: Proxy# SDL_Rect -> Proxy# "x" -> Int
offset# = \Proxy# SDL_Rect
_ -> \Proxy# "x"
_ -> Int
0

-- | [C declaration]: @y@, defined at @SDL3\/SDL_rect.h 85:12@
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "y" SDL_Rect ty where
  hasField :: SDL_Rect -> (ty -> SDL_Rect, ty)
hasField =
    \SDL_Rect
x0 ->
      ( \ty
y1 ->
          SDL_Rect
            { y :: CInt
y = ty
CInt
y1
            , x :: CInt
x = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_Rect
x0
            , w :: CInt
w = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"w" SDL_Rect
x0
            , h :: CInt
h = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"h" SDL_Rect
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_Rect
x0
      )

instance (ty ~ BG.CInt) => BG.HasField "y" (BG.Ptr SDL_Rect) (BG.Ptr ty) where
  getField :: Ptr SDL_Rect -> Ptr ty
getField = Proxy "y" -> Ptr SDL_Rect -> Ptr (CFieldType SDL_Rect "y")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y")

instance HasCField.HasCField SDL_Rect "y" where
  type CFieldType SDL_Rect "y" = BG.CInt

  offset# :: Proxy# SDL_Rect -> Proxy# "y" -> Int
offset# = \Proxy# SDL_Rect
_ -> \Proxy# "y"
_ -> Int
4

-- | [C declaration]: @w@, defined at @SDL3\/SDL_rect.h 86:9@
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "w" SDL_Rect ty where
  hasField :: SDL_Rect -> (ty -> SDL_Rect, ty)
hasField =
    \SDL_Rect
x0 ->
      ( \ty
y1 ->
          SDL_Rect
            { w :: CInt
w = ty
CInt
y1
            , x :: CInt
x = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_Rect
x0
            , y :: CInt
y = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_Rect
x0
            , h :: CInt
h = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"h" SDL_Rect
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"w" SDL_Rect
x0
      )

instance (ty ~ BG.CInt) => BG.HasField "w" (BG.Ptr SDL_Rect) (BG.Ptr ty) where
  getField :: Ptr SDL_Rect -> Ptr ty
getField = Proxy "w" -> Ptr SDL_Rect -> Ptr (CFieldType SDL_Rect "w")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"w")

instance HasCField.HasCField SDL_Rect "w" where
  type CFieldType SDL_Rect "w" = BG.CInt

  offset# :: Proxy# SDL_Rect -> Proxy# "w" -> Int
offset# = \Proxy# SDL_Rect
_ -> \Proxy# "w"
_ -> Int
8

-- | [C declaration]: @h@, defined at @SDL3\/SDL_rect.h 86:12@
instance (ty ~ BG.CInt) => BG.CompatHasField.HasField "h" SDL_Rect ty where
  hasField :: SDL_Rect -> (ty -> SDL_Rect, ty)
hasField =
    \SDL_Rect
x0 ->
      ( \ty
y1 ->
          SDL_Rect
            { h :: CInt
h = ty
CInt
y1
            , x :: CInt
x = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_Rect
x0
            , y :: CInt
y = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_Rect
x0
            , w :: CInt
w = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"w" SDL_Rect
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"h" SDL_Rect
x0
      )

instance (ty ~ BG.CInt) => BG.HasField "h" (BG.Ptr SDL_Rect) (BG.Ptr ty) where
  getField :: Ptr SDL_Rect -> Ptr ty
getField = Proxy "h" -> Ptr SDL_Rect -> Ptr (CFieldType SDL_Rect "h")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"h")

instance HasCField.HasCField SDL_Rect "h" where
  type CFieldType SDL_Rect "h" = BG.CInt

  offset# :: Proxy# SDL_Rect -> Proxy# "h" -> Int
offset# = \Proxy# SDL_Rect
_ -> \Proxy# "h"
_ -> Int
12

-- | A rectangle stored using floating point values.
--
--     The origin of the coordinate space is in the top-left, with increasing values moving down and right. The properties @x@ and @y@ represent the coordinates of the top-left corner of the rectangle.
--
--     @since 3.2.0
--
--     [See also]: 'sDL_RectEmptyFloat', 'sDL_RectsEqualFloat', 'sDL_RectsEqualEpsilon', 'sDL_HasRectIntersectionFloat', 'sDL_GetRectIntersectionFloat', 'sDL_GetRectAndLineIntersectionFloat', 'sDL_GetRectUnionFloat', 'sDL_GetRectEnclosingPointsFloat', 'sDL_PointInRectFloat'
--
--     [C declaration]: @struct SDL_FRect@, defined at @SDL3\/SDL_rect.h 109:16@
data SDL_FRect = SDL_FRect
  { SDL_FRect -> CFloat
x :: BG.CFloat
  -- ^ [C declaration]: @x@, defined at @SDL3\/SDL_rect.h 111:11@
  , SDL_FRect -> CFloat
y :: BG.CFloat
  -- ^ [C declaration]: @y@, defined at @SDL3\/SDL_rect.h 112:11@
  , SDL_FRect -> CFloat
w :: BG.CFloat
  -- ^ [C declaration]: @w@, defined at @SDL3\/SDL_rect.h 113:11@
  , SDL_FRect -> CFloat
h :: BG.CFloat
  -- ^ [C declaration]: @h@, defined at @SDL3\/SDL_rect.h 114:11@
  }
  deriving stock ((forall x. SDL_FRect -> Rep SDL_FRect x)
-> (forall x. Rep SDL_FRect x -> SDL_FRect) -> Generic SDL_FRect
forall x. Rep SDL_FRect x -> SDL_FRect
forall x. SDL_FRect -> Rep SDL_FRect x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDL_FRect -> Rep SDL_FRect x
from :: forall x. SDL_FRect -> Rep SDL_FRect x
$cto :: forall x. Rep SDL_FRect x -> SDL_FRect
to :: forall x. Rep SDL_FRect x -> SDL_FRect
BG.Generic, SDL_FRect -> SDL_FRect -> Bool
(SDL_FRect -> SDL_FRect -> Bool)
-> (SDL_FRect -> SDL_FRect -> Bool) -> Eq SDL_FRect
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SDL_FRect -> SDL_FRect -> Bool
== :: SDL_FRect -> SDL_FRect -> Bool
$c/= :: SDL_FRect -> SDL_FRect -> Bool
/= :: SDL_FRect -> SDL_FRect -> Bool
Eq, Int -> SDL_FRect -> ShowS
[SDL_FRect] -> ShowS
SDL_FRect -> String
(Int -> SDL_FRect -> ShowS)
-> (SDL_FRect -> String)
-> ([SDL_FRect] -> ShowS)
-> Show SDL_FRect
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SDL_FRect -> ShowS
showsPrec :: Int -> SDL_FRect -> ShowS
$cshow :: SDL_FRect -> String
show :: SDL_FRect -> String
$cshowList :: [SDL_FRect] -> ShowS
showList :: [SDL_FRect] -> ShowS
Show)

instance Marshal.StaticSize SDL_FRect where
  staticSizeOf :: Proxy SDL_FRect -> Int
staticSizeOf = \Proxy SDL_FRect
_ -> (Int
16 :: Int)

  staticAlignment :: Proxy SDL_FRect -> Int
staticAlignment = \Proxy SDL_FRect
_ -> (Int
4 :: Int)

instance Marshal.ReadRaw SDL_FRect where
  readRaw :: Ptr SDL_FRect -> IO SDL_FRect
readRaw =
    \Ptr SDL_FRect
ptr0 ->
      (CFloat -> CFloat -> CFloat -> CFloat -> SDL_FRect)
-> IO (CFloat -> CFloat -> CFloat -> CFloat -> SDL_FRect)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure CFloat -> CFloat -> CFloat -> CFloat -> SDL_FRect
SDL_FRect
        IO (CFloat -> CFloat -> CFloat -> CFloat -> SDL_FRect)
-> IO CFloat -> IO (CFloat -> CFloat -> CFloat -> SDL_FRect)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "x" -> Ptr SDL_FRect -> IO (CFieldType SDL_FRect "x")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x") Ptr SDL_FRect
ptr0
        IO (CFloat -> CFloat -> CFloat -> SDL_FRect)
-> IO CFloat -> IO (CFloat -> CFloat -> SDL_FRect)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "y" -> Ptr SDL_FRect -> IO (CFieldType SDL_FRect "y")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y") Ptr SDL_FRect
ptr0
        IO (CFloat -> CFloat -> SDL_FRect)
-> IO CFloat -> IO (CFloat -> SDL_FRect)
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "w" -> Ptr SDL_FRect -> IO (CFieldType SDL_FRect "w")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"w") Ptr SDL_FRect
ptr0
        IO (CFloat -> SDL_FRect) -> IO CFloat -> IO SDL_FRect
forall a b. IO (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy "h" -> Ptr SDL_FRect -> IO (CFieldType SDL_FRect "h")
forall a (field :: Symbol).
(HasCField a field, ReadRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> IO (CFieldType a field)
HasCField.readRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"h") Ptr SDL_FRect
ptr0

instance Marshal.WriteRaw SDL_FRect where
  writeRaw :: Ptr SDL_FRect -> SDL_FRect -> IO ()
writeRaw =
    \Ptr SDL_FRect
ptr0 ->
      \SDL_FRect
s1 ->
        case SDL_FRect
s1 of
          SDL_FRect CFloat
x2 CFloat
y3 CFloat
w4 CFloat
h5 ->
            Proxy "x" -> Ptr SDL_FRect -> CFieldType SDL_FRect "x" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x") Ptr SDL_FRect
ptr0 CFloat
CFieldType SDL_FRect "x"
x2
              IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "y" -> Ptr SDL_FRect -> CFieldType SDL_FRect "y" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y") Ptr SDL_FRect
ptr0 CFloat
CFieldType SDL_FRect "y"
y3
              IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "w" -> Ptr SDL_FRect -> CFieldType SDL_FRect "w" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"w") Ptr SDL_FRect
ptr0 CFloat
CFieldType SDL_FRect "w"
w4
              IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Proxy "h" -> Ptr SDL_FRect -> CFieldType SDL_FRect "h" -> IO ()
forall a (field :: Symbol).
(HasCField a field, WriteRaw (CFieldType a field)) =>
Proxy field -> Ptr a -> CFieldType a field -> IO ()
HasCField.writeRaw (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"h") Ptr SDL_FRect
ptr0 CFloat
CFieldType SDL_FRect "h"
h5

deriving via Marshal.EquivStorable SDL_FRect instance BG.Storable SDL_FRect

deriving via Struct.IsStructViaReadRaw SDL_FRect instance Struct.IsStruct SDL_FRect

-- | [C declaration]: @x@, defined at @SDL3\/SDL_rect.h 111:11@
instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "x" SDL_FRect ty where
  hasField :: SDL_FRect -> (ty -> SDL_FRect, ty)
hasField =
    \SDL_FRect
x0 ->
      ( \ty
y1 ->
          SDL_FRect
            { x :: CFloat
x = ty
CFloat
y1
            , y :: CFloat
y = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_FRect
x0
            , w :: CFloat
w = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"w" SDL_FRect
x0
            , h :: CFloat
h = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"h" SDL_FRect
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_FRect
x0
      )

instance
  (ty ~ BG.CFloat)
  => BG.HasField "x" (BG.Ptr SDL_FRect) (BG.Ptr ty)
  where
  getField :: Ptr SDL_FRect -> Ptr ty
getField = Proxy "x" -> Ptr SDL_FRect -> Ptr (CFieldType SDL_FRect "x")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"x")

instance HasCField.HasCField SDL_FRect "x" where
  type CFieldType SDL_FRect "x" = BG.CFloat

  offset# :: Proxy# SDL_FRect -> Proxy# "x" -> Int
offset# = \Proxy# SDL_FRect
_ -> \Proxy# "x"
_ -> Int
0

-- | [C declaration]: @y@, defined at @SDL3\/SDL_rect.h 112:11@
instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "y" SDL_FRect ty where
  hasField :: SDL_FRect -> (ty -> SDL_FRect, ty)
hasField =
    \SDL_FRect
x0 ->
      ( \ty
y1 ->
          SDL_FRect
            { y :: CFloat
y = ty
CFloat
y1
            , x :: CFloat
x = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_FRect
x0
            , w :: CFloat
w = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"w" SDL_FRect
x0
            , h :: CFloat
h = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"h" SDL_FRect
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_FRect
x0
      )

instance
  (ty ~ BG.CFloat)
  => BG.HasField "y" (BG.Ptr SDL_FRect) (BG.Ptr ty)
  where
  getField :: Ptr SDL_FRect -> Ptr ty
getField = Proxy "y" -> Ptr SDL_FRect -> Ptr (CFieldType SDL_FRect "y")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"y")

instance HasCField.HasCField SDL_FRect "y" where
  type CFieldType SDL_FRect "y" = BG.CFloat

  offset# :: Proxy# SDL_FRect -> Proxy# "y" -> Int
offset# = \Proxy# SDL_FRect
_ -> \Proxy# "y"
_ -> Int
4

-- | [C declaration]: @w@, defined at @SDL3\/SDL_rect.h 113:11@
instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "w" SDL_FRect ty where
  hasField :: SDL_FRect -> (ty -> SDL_FRect, ty)
hasField =
    \SDL_FRect
x0 ->
      ( \ty
y1 ->
          SDL_FRect
            { w :: CFloat
w = ty
CFloat
y1
            , x :: CFloat
x = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_FRect
x0
            , y :: CFloat
y = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_FRect
x0
            , h :: CFloat
h = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"h" SDL_FRect
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"w" SDL_FRect
x0
      )

instance
  (ty ~ BG.CFloat)
  => BG.HasField "w" (BG.Ptr SDL_FRect) (BG.Ptr ty)
  where
  getField :: Ptr SDL_FRect -> Ptr ty
getField = Proxy "w" -> Ptr SDL_FRect -> Ptr (CFieldType SDL_FRect "w")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"w")

instance HasCField.HasCField SDL_FRect "w" where
  type CFieldType SDL_FRect "w" = BG.CFloat

  offset# :: Proxy# SDL_FRect -> Proxy# "w" -> Int
offset# = \Proxy# SDL_FRect
_ -> \Proxy# "w"
_ -> Int
8

-- | [C declaration]: @h@, defined at @SDL3\/SDL_rect.h 114:11@
instance (ty ~ BG.CFloat) => BG.CompatHasField.HasField "h" SDL_FRect ty where
  hasField :: SDL_FRect -> (ty -> SDL_FRect, ty)
hasField =
    \SDL_FRect
x0 ->
      ( \ty
y1 ->
          SDL_FRect
            { h :: CFloat
h = ty
CFloat
y1
            , x :: CFloat
x = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"x" SDL_FRect
x0
            , y :: CFloat
y = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"y" SDL_FRect
x0
            , w :: CFloat
w = forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"w" SDL_FRect
x0
            }
      , forall {k} (x :: k) r a. HasField x r a => r -> a
forall (x :: Symbol) r a. HasField x r a => r -> a
BG.getField @"h" SDL_FRect
x0
      )

instance
  (ty ~ BG.CFloat)
  => BG.HasField "h" (BG.Ptr SDL_FRect) (BG.Ptr ty)
  where
  getField :: Ptr SDL_FRect -> Ptr ty
getField = Proxy "h" -> Ptr SDL_FRect -> Ptr (CFieldType SDL_FRect "h")
forall a (field :: Symbol).
HasCField a field =>
Proxy field -> Ptr a -> Ptr (CFieldType a field)
HasCField.fromPtr (forall {k} (t :: k). Proxy t
forall (t :: Symbol). Proxy t
BG.Proxy @"h")

instance HasCField.HasCField SDL_FRect "h" where
  type CFieldType SDL_FRect "h" = BG.CFloat

  offset# :: Proxy# SDL_FRect -> Proxy# "h" -> Int
offset# = \Proxy# SDL_FRect
_ -> \Proxy# "h"
_ -> Int
12