{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Graphene.Structs.Vec2
(
Vec2(..) ,
newZeroVec2 ,
noVec2 ,
#if defined(ENABLE_OVERLOADING)
ResolveVec2Method ,
#endif
#if defined(ENABLE_OVERLOADING)
Vec2AddMethodInfo ,
#endif
vec2Add ,
vec2Alloc ,
#if defined(ENABLE_OVERLOADING)
Vec2DivideMethodInfo ,
#endif
vec2Divide ,
#if defined(ENABLE_OVERLOADING)
Vec2DotMethodInfo ,
#endif
vec2Dot ,
#if defined(ENABLE_OVERLOADING)
Vec2EqualMethodInfo ,
#endif
vec2Equal ,
#if defined(ENABLE_OVERLOADING)
Vec2FreeMethodInfo ,
#endif
vec2Free ,
#if defined(ENABLE_OVERLOADING)
Vec2GetXMethodInfo ,
#endif
vec2GetX ,
#if defined(ENABLE_OVERLOADING)
Vec2GetYMethodInfo ,
#endif
vec2GetY ,
#if defined(ENABLE_OVERLOADING)
Vec2InitMethodInfo ,
#endif
vec2Init ,
#if defined(ENABLE_OVERLOADING)
Vec2InitFromFloatMethodInfo ,
#endif
vec2InitFromFloat ,
#if defined(ENABLE_OVERLOADING)
Vec2InitFromVec2MethodInfo ,
#endif
vec2InitFromVec2 ,
#if defined(ENABLE_OVERLOADING)
Vec2LengthMethodInfo ,
#endif
vec2Length ,
#if defined(ENABLE_OVERLOADING)
Vec2MaxMethodInfo ,
#endif
vec2Max ,
#if defined(ENABLE_OVERLOADING)
Vec2MinMethodInfo ,
#endif
vec2Min ,
#if defined(ENABLE_OVERLOADING)
Vec2MultiplyMethodInfo ,
#endif
vec2Multiply ,
#if defined(ENABLE_OVERLOADING)
Vec2NearMethodInfo ,
#endif
vec2Near ,
#if defined(ENABLE_OVERLOADING)
Vec2NegateMethodInfo ,
#endif
vec2Negate ,
#if defined(ENABLE_OVERLOADING)
Vec2NormalizeMethodInfo ,
#endif
vec2Normalize ,
vec2One ,
#if defined(ENABLE_OVERLOADING)
Vec2ScaleMethodInfo ,
#endif
vec2Scale ,
#if defined(ENABLE_OVERLOADING)
Vec2SubtractMethodInfo ,
#endif
vec2Subtract ,
vec2XAxis ,
vec2YAxis ,
vec2Zero ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
newtype Vec2 = Vec2 (ManagedPtr Vec2)
deriving (Vec2 -> Vec2 -> Bool
(Vec2 -> Vec2 -> Bool) -> (Vec2 -> Vec2 -> Bool) -> Eq Vec2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Vec2 -> Vec2 -> Bool
$c/= :: Vec2 -> Vec2 -> Bool
== :: Vec2 -> Vec2 -> Bool
$c== :: Vec2 -> Vec2 -> Bool
Eq)
foreign import ccall "graphene_vec2_get_type" c_graphene_vec2_get_type ::
IO GType
instance BoxedObject Vec2 where
boxedType :: Vec2 -> IO GType
boxedType _ = IO GType
c_graphene_vec2_get_type
instance B.GValue.IsGValue Vec2 where
toGValue :: Vec2 -> IO GValue
toGValue o :: Vec2
o = do
GType
gtype <- IO GType
c_graphene_vec2_get_type
Vec2 -> (Ptr Vec2 -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Vec2
o (GType -> (GValue -> Ptr Vec2 -> IO ()) -> Ptr Vec2 -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Vec2 -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO Vec2
fromGValue gv :: GValue
gv = do
Ptr Vec2
ptr <- GValue -> IO (Ptr Vec2)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Vec2)
(ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Vec2 -> Vec2
Vec2 Ptr Vec2
ptr
newZeroVec2 :: MonadIO m => m Vec2
newZeroVec2 :: m Vec2
newZeroVec2 = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 IO (Ptr Vec2) -> (Ptr Vec2 -> IO Vec2) -> IO Vec2
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2
instance tag ~ 'AttrSet => Constructible Vec2 tag where
new :: (ManagedPtr Vec2 -> Vec2) -> [AttrOp Vec2 tag] -> m Vec2
new _ attrs :: [AttrOp Vec2 tag]
attrs = do
Vec2
o <- m Vec2
forall (m :: * -> *). MonadIO m => m Vec2
newZeroVec2
Vec2 -> [AttrOp Vec2 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Vec2
o [AttrOp Vec2 tag]
[AttrOp Vec2 'AttrSet]
attrs
Vec2 -> m Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
o
noVec2 :: Maybe Vec2
noVec2 :: Maybe Vec2
noVec2 = Maybe Vec2
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Vec2
type instance O.AttributeList Vec2 = Vec2AttributeList
type Vec2AttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "graphene_vec2_alloc" graphene_vec2_alloc ::
IO (Ptr Vec2)
vec2Alloc ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Vec2
vec2Alloc :: m Vec2
vec2Alloc = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
result <- IO (Ptr Vec2)
graphene_vec2_alloc
Text -> Ptr Vec2 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "vec2Alloc" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
result
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_vec2_add" graphene_vec2_add ::
Ptr Vec2 ->
Ptr Vec2 ->
Ptr Vec2 ->
IO ()
vec2Add ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m (Vec2)
vec2Add :: Vec2 -> Vec2 -> m Vec2
vec2Add a :: Vec2
a b :: Vec2
b = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
a' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
a
Ptr Vec2
b' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
b
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> Ptr Vec2 -> IO ()
graphene_vec2_add Ptr Vec2
a' Ptr Vec2
b' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
a
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
b
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2AddMethodInfo
instance (signature ~ (Vec2 -> m (Vec2)), MonadIO m) => O.MethodInfo Vec2AddMethodInfo Vec2 signature where
overloadedMethod = vec2Add
#endif
foreign import ccall "graphene_vec2_divide" graphene_vec2_divide ::
Ptr Vec2 ->
Ptr Vec2 ->
Ptr Vec2 ->
IO ()
vec2Divide ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m (Vec2)
vec2Divide :: Vec2 -> Vec2 -> m Vec2
vec2Divide a :: Vec2
a b :: Vec2
b = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
a' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
a
Ptr Vec2
b' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
b
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> Ptr Vec2 -> IO ()
graphene_vec2_divide Ptr Vec2
a' Ptr Vec2
b' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
a
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
b
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2DivideMethodInfo
instance (signature ~ (Vec2 -> m (Vec2)), MonadIO m) => O.MethodInfo Vec2DivideMethodInfo Vec2 signature where
overloadedMethod = vec2Divide
#endif
foreign import ccall "graphene_vec2_dot" graphene_vec2_dot ::
Ptr Vec2 ->
Ptr Vec2 ->
IO CFloat
vec2Dot ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m Float
vec2Dot :: Vec2 -> Vec2 -> m Float
vec2Dot a :: Vec2
a b :: Vec2
b = IO Float -> m Float
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
a' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
a
Ptr Vec2
b' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
b
CFloat
result <- Ptr Vec2 -> Ptr Vec2 -> IO CFloat
graphene_vec2_dot Ptr Vec2
a' Ptr Vec2
b'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
a
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
b
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data Vec2DotMethodInfo
instance (signature ~ (Vec2 -> m Float), MonadIO m) => O.MethodInfo Vec2DotMethodInfo Vec2 signature where
overloadedMethod = vec2Dot
#endif
foreign import ccall "graphene_vec2_equal" graphene_vec2_equal ::
Ptr Vec2 ->
Ptr Vec2 ->
IO CInt
vec2Equal ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m Bool
vec2Equal :: Vec2 -> Vec2 -> m Bool
vec2Equal v1 :: Vec2
v1 v2 :: Vec2
v2 = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v1' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v1
Ptr Vec2
v2' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v2
CInt
result <- Ptr Vec2 -> Ptr Vec2 -> IO CInt
graphene_vec2_equal Ptr Vec2
v1' Ptr Vec2
v2'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v1
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v2
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data Vec2EqualMethodInfo
instance (signature ~ (Vec2 -> m Bool), MonadIO m) => O.MethodInfo Vec2EqualMethodInfo Vec2 signature where
overloadedMethod = vec2Equal
#endif
foreign import ccall "graphene_vec2_free" graphene_vec2_free ::
Ptr Vec2 ->
IO ()
vec2Free ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> m ()
vec2Free :: Vec2 -> m ()
vec2Free v :: Vec2
v = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
Ptr Vec2 -> IO ()
graphene_vec2_free Ptr Vec2
v'
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data Vec2FreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo Vec2FreeMethodInfo Vec2 signature where
overloadedMethod = vec2Free
#endif
foreign import ccall "graphene_vec2_get_x" graphene_vec2_get_x ::
Ptr Vec2 ->
IO CFloat
vec2GetX ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> m Float
vec2GetX :: Vec2 -> m Float
vec2GetX v :: Vec2
v = IO Float -> m Float
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
CFloat
result <- Ptr Vec2 -> IO CFloat
graphene_vec2_get_x Ptr Vec2
v'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data Vec2GetXMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo Vec2GetXMethodInfo Vec2 signature where
overloadedMethod = vec2GetX
#endif
foreign import ccall "graphene_vec2_get_y" graphene_vec2_get_y ::
Ptr Vec2 ->
IO CFloat
vec2GetY ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> m Float
vec2GetY :: Vec2 -> m Float
vec2GetY v :: Vec2
v = IO Float -> m Float
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
CFloat
result <- Ptr Vec2 -> IO CFloat
graphene_vec2_get_y Ptr Vec2
v'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data Vec2GetYMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo Vec2GetYMethodInfo Vec2 signature where
overloadedMethod = vec2GetY
#endif
foreign import ccall "graphene_vec2_init" graphene_vec2_init ::
Ptr Vec2 ->
CFloat ->
CFloat ->
IO (Ptr Vec2)
vec2Init ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Float
-> Float
-> m Vec2
vec2Init :: Vec2 -> Float -> Float -> m Vec2
vec2Init v :: Vec2
v x :: Float
x y :: Float
y = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
let x' :: CFloat
x' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x
let y' :: CFloat
y' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y
Ptr Vec2
result <- Ptr Vec2 -> CFloat -> CFloat -> IO (Ptr Vec2)
graphene_vec2_init Ptr Vec2
v' CFloat
x' CFloat
y'
Text -> Ptr Vec2 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "vec2Init" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
result'
#if defined(ENABLE_OVERLOADING)
data Vec2InitMethodInfo
instance (signature ~ (Float -> Float -> m Vec2), MonadIO m) => O.MethodInfo Vec2InitMethodInfo Vec2 signature where
overloadedMethod = vec2Init
#endif
foreign import ccall "graphene_vec2_init_from_float" graphene_vec2_init_from_float ::
Ptr Vec2 ->
Ptr CFloat ->
IO (Ptr Vec2)
vec2InitFromFloat ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> [Float]
-> m Vec2
vec2InitFromFloat :: Vec2 -> [Float] -> m Vec2
vec2InitFromFloat v :: Vec2
v src :: [Float]
src = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
Ptr CFloat
src' <- ((Float -> CFloat) -> [Float] -> IO (Ptr CFloat)
forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b)
packMapStorableArray Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac) [Float]
src
Ptr Vec2
result <- Ptr Vec2 -> Ptr CFloat -> IO (Ptr Vec2)
graphene_vec2_init_from_float Ptr Vec2
v' Ptr CFloat
src'
Text -> Ptr Vec2 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "vec2InitFromFloat" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
src'
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
result'
#if defined(ENABLE_OVERLOADING)
data Vec2InitFromFloatMethodInfo
instance (signature ~ ([Float] -> m Vec2), MonadIO m) => O.MethodInfo Vec2InitFromFloatMethodInfo Vec2 signature where
overloadedMethod = vec2InitFromFloat
#endif
foreign import ccall "graphene_vec2_init_from_vec2" graphene_vec2_init_from_vec2 ::
Ptr Vec2 ->
Ptr Vec2 ->
IO (Ptr Vec2)
vec2InitFromVec2 ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m Vec2
vec2InitFromVec2 :: Vec2 -> Vec2 -> m Vec2
vec2InitFromVec2 v :: Vec2
v src :: Vec2
src = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
Ptr Vec2
src' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
src
Ptr Vec2
result <- Ptr Vec2 -> Ptr Vec2 -> IO (Ptr Vec2)
graphene_vec2_init_from_vec2 Ptr Vec2
v' Ptr Vec2
src'
Text -> Ptr Vec2 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "vec2InitFromVec2" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
src
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
result'
#if defined(ENABLE_OVERLOADING)
data Vec2InitFromVec2MethodInfo
instance (signature ~ (Vec2 -> m Vec2), MonadIO m) => O.MethodInfo Vec2InitFromVec2MethodInfo Vec2 signature where
overloadedMethod = vec2InitFromVec2
#endif
foreign import ccall "graphene_vec2_length" graphene_vec2_length ::
Ptr Vec2 ->
IO CFloat
vec2Length ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> m Float
vec2Length :: Vec2 -> m Float
vec2Length v :: Vec2
v = IO Float -> m Float
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
CFloat
result <- Ptr Vec2 -> IO CFloat
graphene_vec2_length Ptr Vec2
v'
let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'
#if defined(ENABLE_OVERLOADING)
data Vec2LengthMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo Vec2LengthMethodInfo Vec2 signature where
overloadedMethod = vec2Length
#endif
foreign import ccall "graphene_vec2_max" graphene_vec2_max ::
Ptr Vec2 ->
Ptr Vec2 ->
Ptr Vec2 ->
IO ()
vec2Max ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m (Vec2)
vec2Max :: Vec2 -> Vec2 -> m Vec2
vec2Max a :: Vec2
a b :: Vec2
b = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
a' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
a
Ptr Vec2
b' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
b
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> Ptr Vec2 -> IO ()
graphene_vec2_max Ptr Vec2
a' Ptr Vec2
b' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
a
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
b
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2MaxMethodInfo
instance (signature ~ (Vec2 -> m (Vec2)), MonadIO m) => O.MethodInfo Vec2MaxMethodInfo Vec2 signature where
overloadedMethod = vec2Max
#endif
foreign import ccall "graphene_vec2_min" graphene_vec2_min ::
Ptr Vec2 ->
Ptr Vec2 ->
Ptr Vec2 ->
IO ()
vec2Min ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m (Vec2)
vec2Min :: Vec2 -> Vec2 -> m Vec2
vec2Min a :: Vec2
a b :: Vec2
b = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
a' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
a
Ptr Vec2
b' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
b
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> Ptr Vec2 -> IO ()
graphene_vec2_min Ptr Vec2
a' Ptr Vec2
b' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
a
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
b
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2MinMethodInfo
instance (signature ~ (Vec2 -> m (Vec2)), MonadIO m) => O.MethodInfo Vec2MinMethodInfo Vec2 signature where
overloadedMethod = vec2Min
#endif
foreign import ccall "graphene_vec2_multiply" graphene_vec2_multiply ::
Ptr Vec2 ->
Ptr Vec2 ->
Ptr Vec2 ->
IO ()
vec2Multiply ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m (Vec2)
vec2Multiply :: Vec2 -> Vec2 -> m Vec2
vec2Multiply a :: Vec2
a b :: Vec2
b = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
a' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
a
Ptr Vec2
b' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
b
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> Ptr Vec2 -> IO ()
graphene_vec2_multiply Ptr Vec2
a' Ptr Vec2
b' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
a
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
b
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2MultiplyMethodInfo
instance (signature ~ (Vec2 -> m (Vec2)), MonadIO m) => O.MethodInfo Vec2MultiplyMethodInfo Vec2 signature where
overloadedMethod = vec2Multiply
#endif
foreign import ccall "graphene_vec2_near" graphene_vec2_near ::
Ptr Vec2 ->
Ptr Vec2 ->
CFloat ->
IO CInt
vec2Near ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> Float
-> m Bool
vec2Near :: Vec2 -> Vec2 -> Float -> m Bool
vec2Near v1 :: Vec2
v1 v2 :: Vec2
v2 epsilon :: Float
epsilon = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v1' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v1
Ptr Vec2
v2' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v2
let epsilon' :: CFloat
epsilon' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
epsilon
CInt
result <- Ptr Vec2 -> Ptr Vec2 -> CFloat -> IO CInt
graphene_vec2_near Ptr Vec2
v1' Ptr Vec2
v2' CFloat
epsilon'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v1
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v2
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data Vec2NearMethodInfo
instance (signature ~ (Vec2 -> Float -> m Bool), MonadIO m) => O.MethodInfo Vec2NearMethodInfo Vec2 signature where
overloadedMethod = vec2Near
#endif
foreign import ccall "graphene_vec2_negate" graphene_vec2_negate ::
Ptr Vec2 ->
Ptr Vec2 ->
IO ()
vec2Negate ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> m (Vec2)
vec2Negate :: Vec2 -> m Vec2
vec2Negate v :: Vec2
v = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> IO ()
graphene_vec2_negate Ptr Vec2
v' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2NegateMethodInfo
instance (signature ~ (m (Vec2)), MonadIO m) => O.MethodInfo Vec2NegateMethodInfo Vec2 signature where
overloadedMethod = vec2Negate
#endif
foreign import ccall "graphene_vec2_normalize" graphene_vec2_normalize ::
Ptr Vec2 ->
Ptr Vec2 ->
IO ()
vec2Normalize ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> m (Vec2)
vec2Normalize :: Vec2 -> m Vec2
vec2Normalize v :: Vec2
v = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> IO ()
graphene_vec2_normalize Ptr Vec2
v' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2NormalizeMethodInfo
instance (signature ~ (m (Vec2)), MonadIO m) => O.MethodInfo Vec2NormalizeMethodInfo Vec2 signature where
overloadedMethod = vec2Normalize
#endif
foreign import ccall "graphene_vec2_scale" graphene_vec2_scale ::
Ptr Vec2 ->
CFloat ->
Ptr Vec2 ->
IO ()
vec2Scale ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Float
-> m (Vec2)
vec2Scale :: Vec2 -> Float -> m Vec2
vec2Scale v :: Vec2
v factor :: Float
factor = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
v' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
v
let factor' :: CFloat
factor' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
factor
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> CFloat -> Ptr Vec2 -> IO ()
graphene_vec2_scale Ptr Vec2
v' CFloat
factor' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2ScaleMethodInfo
instance (signature ~ (Float -> m (Vec2)), MonadIO m) => O.MethodInfo Vec2ScaleMethodInfo Vec2 signature where
overloadedMethod = vec2Scale
#endif
foreign import ccall "graphene_vec2_subtract" graphene_vec2_subtract ::
Ptr Vec2 ->
Ptr Vec2 ->
Ptr Vec2 ->
IO ()
vec2Subtract ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> m (Vec2)
vec2Subtract :: Vec2 -> Vec2 -> m Vec2
vec2Subtract a :: Vec2
a b :: Vec2
b = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
a' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
a
Ptr Vec2
b' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
b
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> Ptr Vec2 -> IO ()
graphene_vec2_subtract Ptr Vec2
a' Ptr Vec2
b' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
res
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
a
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
b
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2SubtractMethodInfo
instance (signature ~ (Vec2 -> m (Vec2)), MonadIO m) => O.MethodInfo Vec2SubtractMethodInfo Vec2 signature where
overloadedMethod = vec2Subtract
#endif
foreign import ccall "graphene_vec2_one" graphene_vec2_one ::
IO (Ptr Vec2)
vec2One ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Vec2
vec2One :: m Vec2
vec2One = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
result <- IO (Ptr Vec2)
graphene_vec2_one
Text -> Ptr Vec2 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "vec2One" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
result
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_vec2_x_axis" graphene_vec2_x_axis ::
IO (Ptr Vec2)
vec2XAxis ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Vec2
vec2XAxis :: m Vec2
vec2XAxis = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
result <- IO (Ptr Vec2)
graphene_vec2_x_axis
Text -> Ptr Vec2 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "vec2XAxis" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
result
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_vec2_y_axis" graphene_vec2_y_axis ::
IO (Ptr Vec2)
vec2YAxis ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Vec2
vec2YAxis :: m Vec2
vec2YAxis = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
result <- IO (Ptr Vec2)
graphene_vec2_y_axis
Text -> Ptr Vec2 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "vec2YAxis" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
result
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "graphene_vec2_zero" graphene_vec2_zero ::
IO (Ptr Vec2)
vec2Zero ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Vec2
vec2Zero :: m Vec2
vec2Zero = IO Vec2 -> m Vec2
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec2 -> m Vec2) -> IO Vec2 -> m Vec2
forall a b. (a -> b) -> a -> b
$ do
Ptr Vec2
result <- IO (Ptr Vec2)
graphene_vec2_zero
Text -> Ptr Vec2 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "vec2Zero" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Vec2 -> Vec2
Vec2) Ptr Vec2
result
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
result'
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveVec2Method (t :: Symbol) (o :: *) :: * where
ResolveVec2Method "add" o = Vec2AddMethodInfo
ResolveVec2Method "divide" o = Vec2DivideMethodInfo
ResolveVec2Method "dot" o = Vec2DotMethodInfo
ResolveVec2Method "equal" o = Vec2EqualMethodInfo
ResolveVec2Method "free" o = Vec2FreeMethodInfo
ResolveVec2Method "init" o = Vec2InitMethodInfo
ResolveVec2Method "initFromFloat" o = Vec2InitFromFloatMethodInfo
ResolveVec2Method "initFromVec2" o = Vec2InitFromVec2MethodInfo
ResolveVec2Method "length" o = Vec2LengthMethodInfo
ResolveVec2Method "max" o = Vec2MaxMethodInfo
ResolveVec2Method "min" o = Vec2MinMethodInfo
ResolveVec2Method "multiply" o = Vec2MultiplyMethodInfo
ResolveVec2Method "near" o = Vec2NearMethodInfo
ResolveVec2Method "negate" o = Vec2NegateMethodInfo
ResolveVec2Method "normalize" o = Vec2NormalizeMethodInfo
ResolveVec2Method "scale" o = Vec2ScaleMethodInfo
ResolveVec2Method "subtract" o = Vec2SubtractMethodInfo
ResolveVec2Method "getX" o = Vec2GetXMethodInfo
ResolveVec2Method "getY" o = Vec2GetYMethodInfo
ResolveVec2Method l o = O.MethodResolutionFailed l o
instance (info ~ ResolveVec2Method t Vec2, O.MethodInfo info Vec2 p) => OL.IsLabel t (Vec2 -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif