-----------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-----------------------------------------------------------------------------
module THREE.Vector2
  ( -- * Types
    Vector2 (..)
    -- * Methods
  , THREE.Vector2.new
    -- * Properties
  ) where
-----------------------------------------------------------------------------
import           Miso
-----------------------------------------------------------------------------
import qualified THREE.Internal as THREE
-----------------------------------------------------------------------------
-- | https://threejs.org/docs/#api/en/scenes/Vector2
newtype Vector2
  = Vector2
  { Vector2 -> JSVal
unVector2 :: JSVal
  } deriving (Vector2 -> IO Object
(Vector2 -> IO Object) -> ToObject Vector2
forall a. (a -> IO Object) -> ToObject a
$ctoObject :: Vector2 -> IO Object
toObject :: Vector2 -> IO Object
ToObject, Vector2 -> IO JSVal
(Vector2 -> IO JSVal) -> ToJSVal Vector2
forall a. (a -> IO JSVal) -> ToJSVal a
$ctoJSVal :: Vector2 -> IO JSVal
toJSVal :: Vector2 -> IO JSVal
ToJSVal, Vector2 -> IO [JSVal]
(Vector2 -> IO [JSVal]) -> ToArgs Vector2
forall args. (args -> IO [JSVal]) -> ToArgs args
$ctoArgs :: Vector2 -> IO [JSVal]
toArgs :: Vector2 -> IO [JSVal]
ToArgs, ToObject Vector2
Property Vector2 Double
ToObject Vector2 => Property Vector2 Double -> X Vector2
forall object.
ToObject object =>
Property object Double -> X object
$cx :: Property Vector2 Double
x :: Property Vector2 Double
THREE.X, ToObject Vector2
Property Vector2 Double
ToObject Vector2 => Property Vector2 Double -> Y Vector2
forall object.
ToObject object =>
Property object Double -> Y object
$cy :: Property Vector2 Double
y :: Property Vector2 Double
THREE.Y)
-----------------------------------------------------------------------------
instance FromJSVal Vector2 where
  fromJSVal :: JSVal -> IO (Maybe Vector2)
fromJSVal = Maybe Vector2 -> IO (Maybe Vector2)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Vector2 -> IO (Maybe Vector2))
-> (JSVal -> Maybe Vector2) -> JSVal -> IO (Maybe Vector2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector2 -> Maybe Vector2
forall a. a -> Maybe a
Just (Vector2 -> Maybe Vector2)
-> (JSVal -> Vector2) -> JSVal -> Maybe Vector2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. JSVal -> Vector2
Vector2
-----------------------------------------------------------------------------
-- | https://threejs.org/docs/#api/en/cameras/Vector2
new :: THREE.Three Vector2
new :: IO Vector2
new = (JSVal -> Vector2) -> MisoString -> [MisoString] -> IO Vector2
forall args con.
ToArgs args =>
(JSVal -> con) -> MisoString -> args -> Three con
THREE.new JSVal -> Vector2
Vector2 MisoString
"Vector2" ([] :: [MisoString])
-----------------------------------------------------------------------------