HGamer3D-Common-0.5.0: Toolset for the Haskell Game Programmer - Game Engine and Utilities

Safe HaskellNone
LanguageHaskell98

HGamer3D.Common

Description

Common Elements for HGamer3D

Synopsis

Documentation

data Component Source

Possible Components, which are known, this list needs to be extended, if additional components are introduced. Each component can occur only once in an Entity.

Constructors

CTPos

Position

CTOri

Orientation

CTSiz

Size

CTSca

Scale

CTFig

Figure

CTASr

Audio Source

CTALs

Audio Listener

CTCam

Camera

CTLig

Light

CTScP

Scene Parameter

CTGFo

GUI Form

CTWin

Window

CTCmd

internal, used for sending commands, created automatically

CTEvt

internal, used for receiving events, created automatically

type Entity = Map Component Dynamic Source

Entities

Entity, Maps from Component to Dynamic

(#:) :: Typeable a => Component -> a -> (Component, Dynamic) Source

Pair builder for nice construction syntax, allows [ ct #: val, ...] syntax

entity :: [(Component, Dynamic)] -> Entity Source

Builder for entities, allows newE = entity [ct #: val, ...] syntax

(#?) :: Entity -> Component -> Bool Source

does the entity have the component

(#) :: Typeable a => Entity -> Component -> a Source

get the component, throws exception, if component not present, or wrong type

(?#) :: Typeable a => Entity -> Component -> Maybe a Source

get the component as an maybe, in case wrong type

updateEntity :: Typeable a => Entity -> Component -> (a -> a) -> Entity Source

modification function, throws exception, if component not present

_setComponent :: Typeable a => Entity -> Component -> a -> Entity Source

modification function, sets entity component, needed for events

data ERef Source

Constructors

ERef (TVar Entity) Listeners 

Instances

updateE :: Typeable a => ERef -> Component -> (a -> a) -> IO () Source

_setE :: Typeable a => ERef -> Component -> a -> IO () Source

sendCmd :: Typeable a => ERef -> a -> IO () Source

sendEvt :: Typeable a => ERef -> a -> IO () Source

regEvtH :: Typeable a => ERef -> (a -> IO ()) -> IO () Source

type ComponentListener = TVar (Maybe (Entity, Entity)) Source

ComponentListener are tracking the change of a component of a specific entity. Ones this component changes, they contain the latest value of the entity. ComponentListener are implemented with the Listener mechanism for ERefs

data SomeSystem Source

Constructors

forall a . System a => SomeSystem (SystemData a) 

(#+) :: [SomeSystem] -> [SomeSystem] -> [SomeSystem] infixr 9 Source