nyx-game-1.0.0.0: A bullet-hell game made with SDL2.

Safe HaskellNone
LanguageHaskell2010

Play.Engine.Utils

Description

a utility module

Synopsis

Documentation

firstM :: Functor f => (a -> f c) -> (a, b) -> f (c, b) Source #

replicateMChain :: Monad m => Int -> (a -> m a) -> a -> m a Source #

replicate operation and chain it

maybeToEither :: a -> Maybe b -> Either a b Source #

if Maybe b is nothing, replace it with Left a. otherwise: Right b

duplicates :: Ord a => [a] -> [a] Source #

returns the duplicates of a list

splitBy :: Eq a => a -> [a] -> [[a]] Source #

split arguments by element

supplyBoth :: (a -> b -> c) -> (b -> a) -> b -> c Source #

(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d Source #

Compose with an input function that takes two arguments

addPoint :: (NFData a, Num a) => Point a -> Point a -> Point a Source #

mulPoint :: (NFData a, Num a) => Point a -> Point a -> Point a Source #

updateList :: (a -> [a]) -> DList a -> DList a Source #

updateListWith :: NFData b => b -> (b -> b -> b) -> (a -> ([a], b)) -> DList a -> (DList a, b) Source #

data HasPosSize Source #

Constructors

HasPosSize 

Fields

Instances
Show HasPosSize Source # 
Instance details

Defined in Play.Engine.Utils

HasSize HasPosSize Size Source # 
Instance details

Defined in Play.Engine.Utils

HasPos HasPosSize IPoint Source # 
Instance details

Defined in Play.Engine.Utils

class HasPos s a | s -> a where Source #

Methods

pos :: Lens' s a Source #

Instances
HasPos HasPosSize IPoint Source # 
Instance details

Defined in Play.Engine.Utils

HasPos Sprite Int Source # 
Instance details

Defined in Play.Engine.Sprite

HasPos BG IPoint Source # 
Instance details

Defined in Play.Engine.ScrollingBackground

HasPos Button IPoint Source # 
Instance details

Defined in Play.Engine.Button

class HasSize s a | s -> a where Source #

Methods

size :: Lens' s a Source #

Instances
HasSize HasPosSize Size Source # 
Instance details

Defined in Play.Engine.Utils

HasSize Hitbox Size Source # 
Instance details

Defined in Play.Engine.Utils

HasSize Sprite Size Source # 
Instance details

Defined in Play.Engine.Sprite

HasSize SBG Size Source # 
Instance details

Defined in Play.Engine.ScrollingBackground

HasSize Button IPoint Source # 
Instance details

Defined in Play.Engine.Button

data Hitbox Source #

Constructors

Hitbox 

Fields

Instances
Eq Hitbox Source # 
Instance details

Defined in Play.Engine.Utils

Methods

(==) :: Hitbox -> Hitbox -> Bool #

(/=) :: Hitbox -> Hitbox -> Bool #

Show Hitbox Source # 
Instance details

Defined in Play.Engine.Utils

HasSize Hitbox Size Source # 
Instance details

Defined in Play.Engine.Utils

HasAlignment Hitbox IPoint Source # 
Instance details

Defined in Play.Engine.Utils

HasHitbox HasHitBox Hitbox Source # 
Instance details

Defined in Play.Engine.Utils

class HasAlignment s a | s -> a where Source #

Methods

alignment :: Lens' s a Source #

Instances
HasAlignment Hitbox IPoint Source # 
Instance details

Defined in Play.Engine.Utils

data HasHitBox Source #

Constructors

HasHitBox 

Fields

Instances
Show HasHitBox Source # 
Instance details

Defined in Play.Engine.Utils

HasHitbox HasHitBox Hitbox Source # 
Instance details

Defined in Play.Engine.Utils

class HasHitbox s a | s -> a where Source #

Methods

hitbox :: Lens' s a Source #

Instances
HasHitbox HasHitBox Hitbox Source # 
Instance details

Defined in Play.Engine.Utils

isTouchingCircleRect :: (HasPos circle IPoint, HasSize circle Size, HasPos rect IPoint, HasHitbox rect Hitbox) => circle -> rect -> Maybe (circle, rect) Source #

fixPos :: (HasSize a Size, HasPos a IPoint) => Size -> a -> a Source #

data Stack a Source #

Constructors

Stack !a ![a] 

head :: Stack a -> a Source #

push :: a -> Stack a -> Stack a Source #

init :: a -> Stack a Source #

pop :: Stack a -> (a, Maybe (Stack a)) Source #

replace :: a -> Stack a -> Stack a Source #