{-# 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 ,
#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)
Vec2InterpolateMethodInfo ,
#endif
vec2Interpolate ,
#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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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
import qualified GHC.Records as R
newtype Vec2 = Vec2 (SP.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)
instance SP.ManagedPtrNewtype Vec2 where
toManagedPtr :: Vec2 -> ManagedPtr Vec2
toManagedPtr (Vec2 ManagedPtr Vec2
p) = ManagedPtr Vec2
p
foreign import ccall "graphene_vec2_get_type" c_graphene_vec2_get_type ::
IO GType
type instance O.ParentTypes Vec2 = '[]
instance O.HasParentTypes Vec2
instance B.Types.TypedObject Vec2 where
glibType :: IO GType
glibType = IO GType
c_graphene_vec2_get_type
instance B.Types.GBoxed Vec2
instance B.GValue.IsGValue (Maybe Vec2) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_graphene_vec2_get_type
gvalueSet_ :: Ptr GValue -> Maybe Vec2 -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Vec2
P.Nothing = Ptr GValue -> Ptr Vec2 -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Vec2
forall a. Ptr a
FP.nullPtr :: FP.Ptr Vec2)
gvalueSet_ Ptr GValue
gv (P.Just Vec2
obj) = Vec2 -> (Ptr Vec2 -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Vec2
obj (Ptr GValue -> Ptr Vec2 -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Vec2)
gvalueGet_ Ptr GValue
gv = do
Ptr Vec2
ptr <- Ptr GValue -> IO (Ptr Vec2)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Vec2)
if Ptr Vec2
ptr Ptr Vec2 -> Ptr Vec2 -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Vec2
forall a. Ptr a
FP.nullPtr
then Vec2 -> Maybe Vec2
forall a. a -> Maybe a
P.Just (Vec2 -> Maybe Vec2) -> IO Vec2 -> IO (Maybe Vec2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Vec2 -> Vec2
Vec2 Ptr Vec2
ptr
else Maybe Vec2 -> IO (Maybe Vec2)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Vec2
forall a. Maybe a
P.Nothing
newZeroVec2 :: MonadIO m => m Vec2
newZeroVec2 :: forall (m :: * -> *). MonadIO m => 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. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
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, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Vec2
instance tag ~ 'AttrSet => Constructible Vec2 tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Vec2 -> Vec2) -> [AttrOp Vec2 tag] -> m Vec2
new ManagedPtr Vec2 -> Vec2
_ [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
#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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"vec2Alloc" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Vec2
vec2Add Vec2
a 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2AddMethodInfo Vec2 signature where
overloadedMethod = vec2Add
instance O.OverloadedMethodInfo Vec2AddMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Add",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Vec2
vec2Divide Vec2
a 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2DivideMethodInfo Vec2 signature where
overloadedMethod = vec2Divide
instance O.OverloadedMethodInfo Vec2DivideMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Divide",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Float
vec2Dot Vec2
a 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.OverloadedMethod Vec2DotMethodInfo Vec2 signature where
overloadedMethod = vec2Dot
instance O.OverloadedMethodInfo Vec2DotMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Dot",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Bool
vec2Equal Vec2
v1 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
/= CInt
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.OverloadedMethod Vec2EqualMethodInfo Vec2 signature where
overloadedMethod = vec2Equal
instance O.OverloadedMethodInfo Vec2EqualMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Equal",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v:vec2Equal"
})
#endif
foreign import ccall "graphene_vec2_free" graphene_vec2_free ::
Ptr Vec2 ->
IO ()
vec2Free ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> m ()
vec2Free :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Vec2 -> m ()
vec2Free 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.OverloadedMethod Vec2FreeMethodInfo Vec2 signature where
overloadedMethod = vec2Free
instance O.OverloadedMethodInfo Vec2FreeMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Free",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Vec2 -> m Float
vec2GetX 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.OverloadedMethod Vec2GetXMethodInfo Vec2 signature where
overloadedMethod = vec2GetX
instance O.OverloadedMethodInfo Vec2GetXMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2GetX",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Vec2 -> m Float
vec2GetY 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.OverloadedMethod Vec2GetYMethodInfo Vec2 signature where
overloadedMethod = vec2GetY
instance O.OverloadedMethodInfo Vec2GetYMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2GetY",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Float -> Float -> m Vec2
vec2Init Vec2
v Float
x 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 Text
"vec2Init" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod Vec2InitMethodInfo Vec2 signature where
overloadedMethod = vec2Init
instance O.OverloadedMethodInfo Vec2InitMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Init",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> [Float] -> m Vec2
vec2InitFromFloat Vec2
v [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 Text
"vec2InitFromFloat" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod Vec2InitFromFloatMethodInfo Vec2 signature where
overloadedMethod = vec2InitFromFloat
instance O.OverloadedMethodInfo Vec2InitFromFloatMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2InitFromFloat",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Vec2
vec2InitFromVec2 Vec2
v 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 Text
"vec2InitFromVec2" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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.OverloadedMethod Vec2InitFromVec2MethodInfo Vec2 signature where
overloadedMethod = vec2InitFromVec2
instance O.OverloadedMethodInfo Vec2InitFromVec2MethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2InitFromVec2",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v:vec2InitFromVec2"
})
#endif
foreign import ccall "graphene_vec2_interpolate" graphene_vec2_interpolate ::
Ptr Vec2 ->
Ptr Vec2 ->
CDouble ->
Ptr Vec2 ->
IO ()
vec2Interpolate ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> Vec2
-> Double
-> m (Vec2)
vec2Interpolate :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> Double -> m Vec2
vec2Interpolate Vec2
v1 Vec2
v2 Double
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
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 factor' :: CDouble
factor' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
factor
Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
16 :: IO (Ptr Vec2)
Ptr Vec2 -> Ptr Vec2 -> CDouble -> Ptr Vec2 -> IO ()
graphene_vec2_interpolate Ptr Vec2
v1' Ptr Vec2
v2' CDouble
factor' Ptr Vec2
res
Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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
v1
Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
v2
Vec2 -> IO Vec2
forall (m :: * -> *) a. Monad m => a -> m a
return Vec2
res'
#if defined(ENABLE_OVERLOADING)
data Vec2InterpolateMethodInfo
instance (signature ~ (Vec2 -> Double -> m (Vec2)), MonadIO m) => O.OverloadedMethod Vec2InterpolateMethodInfo Vec2 signature where
overloadedMethod = vec2Interpolate
instance O.OverloadedMethodInfo Vec2InterpolateMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Interpolate",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v:vec2Interpolate"
})
#endif
foreign import ccall "graphene_vec2_length" graphene_vec2_length ::
Ptr Vec2 ->
IO CFloat
vec2Length ::
(B.CallStack.HasCallStack, MonadIO m) =>
Vec2
-> m Float
vec2Length :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Vec2 -> m Float
vec2Length 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.OverloadedMethod Vec2LengthMethodInfo Vec2 signature where
overloadedMethod = vec2Length
instance O.OverloadedMethodInfo Vec2LengthMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Length",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Vec2
vec2Max Vec2
a 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2MaxMethodInfo Vec2 signature where
overloadedMethod = vec2Max
instance O.OverloadedMethodInfo Vec2MaxMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Max",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Vec2
vec2Min Vec2
a 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2MinMethodInfo Vec2 signature where
overloadedMethod = vec2Min
instance O.OverloadedMethodInfo Vec2MinMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Min",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Vec2
vec2Multiply Vec2
a 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2MultiplyMethodInfo Vec2 signature where
overloadedMethod = vec2Multiply
instance O.OverloadedMethodInfo Vec2MultiplyMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Multiply",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> Float -> m Bool
vec2Near Vec2
v1 Vec2
v2 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
/= CInt
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.OverloadedMethod Vec2NearMethodInfo Vec2 signature where
overloadedMethod = vec2Near
instance O.OverloadedMethodInfo Vec2NearMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Near",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Vec2 -> m Vec2
vec2Negate 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2NegateMethodInfo Vec2 signature where
overloadedMethod = vec2Negate
instance O.OverloadedMethodInfo Vec2NegateMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Negate",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Vec2 -> m Vec2
vec2Normalize 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2NormalizeMethodInfo Vec2 signature where
overloadedMethod = vec2Normalize
instance O.OverloadedMethodInfo Vec2NormalizeMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Normalize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Float -> m Vec2
vec2Scale Vec2
v 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2ScaleMethodInfo Vec2 signature where
overloadedMethod = vec2Scale
instance O.OverloadedMethodInfo Vec2ScaleMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Scale",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v: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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Vec2 -> Vec2 -> m Vec2
vec2Subtract Vec2
a 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. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
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, GBoxed 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.OverloadedMethod Vec2SubtractMethodInfo Vec2 signature where
overloadedMethod = vec2Subtract
instance O.OverloadedMethodInfo Vec2SubtractMethodInfo Vec2 where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Graphene.Structs.Vec2.vec2Subtract",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.4/docs/GI-Graphene-Structs-Vec2.html#v:vec2Subtract"
})
#endif
foreign import ccall "graphene_vec2_one" graphene_vec2_one ::
IO (Ptr Vec2)
vec2One ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Vec2
vec2One :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"vec2One" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"vec2XAxis" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"vec2YAxis" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => 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 Text
"vec2Zero" Ptr Vec2
result
Vec2
result' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed 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 "interpolate" o = Vec2InterpolateMethodInfo
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.OverloadedMethod 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
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveVec2Method t Vec2, O.OverloadedMethod info Vec2 p, R.HasField t Vec2 p) => R.HasField t Vec2 p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveVec2Method t Vec2, O.OverloadedMethodInfo info Vec2) => OL.IsLabel t (O.MethodProxy info Vec2) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif