PDG engine v0.9.5
 All Classes Namespaces Functions Variables Groups Pages
Classes | Functions | Variables
pdg Namespace Reference

Classes

class  Animated
 something that can be automatically moved, spun or resized over time. More...
 
class  Color
 color in RGB space, with optional alpha More...
 
class  ConfigManager
 used for loading and saving application configuration info More...
 
class  CpArbiter
 arbitrates collisions between sprites using Chipmunk Physics (Chipmunk Physics Only) More...
 
class  CpConstraint
 describes how two sprites are connected to one another (Chipmunk Physics Only) More...
 
class  CpSpace
 container for simulating objects (Chipmunk Physics Only) More...
 
class  Deserializer
 deserialize data from a serialized data stream More...
 
class  EventEmitter
 Distributes events to event handlers. More...
 
class  EventManager
 Distributes events to event handlers. More...
 
class  FileManager
 extras beyond what Node.js FileSystem provides More...
 
class  Font
 font for text drawing and measuring (GUI Only) More...
 
class  GraphicsManager
 Used to create and track ports (GUI Only) More...
 
class  IAnimationHelper
 helper for add-on or complex motion during animation More...
 
class  IEventHandler
 Interface for any class which handles events. More...
 
class  Image
 A bitmap image that can be blitted onto the screen. More...
 
class  ImageStrip
 bitmap image containing a number of frames that can be blitted onto the screen More...
 
class  ISerializable
 interface for an object which can be serialized More...
 
class  ISpriteCollideHelper
 helper for deciding whether 2 sprites should collide or not More...
 
class  ISpriteDrawHelper
 helper for drawing sprite overlays and add-on effects More...
 
struct  KeyEvent
 a key down or up event More...
 
struct  KeyPressEvent
 the user pressed and released a key More...
 
class  LogManager
 used for doing logging with variable debug levels More...
 
class  MemBlock
 holds arbitrary blocks of memory More...
 
struct  MouseEvent
 the user did something with the mouse More...
 
struct  MouseTrackingEvent
 the mouse entered or left a tracking region (NOT IMPLEMENTED) More...
 
class  NetClient
 a network endpoint that can initiate a connection More...
 
class  NetConnection
 sends data between two network endpoints More...
 
class  NetServer
 a network endpoint that can accept incoming connections More...
 
class  Offset
 offset within a 2D coordinate system More...
 
class  Point
 point for 2D coordinate system More...
 
class  Port
 area in which drawing is done, a viewport (GUI Only) More...
 
struct  PortDrawEvent
 a port needs to be redrawn (GUI Only) More...
 
struct  PortResizedEvent
 a port has been resized (GUI Only) More...
 
class  Quad
 4 point polygon in 2D system More...
 
class  Rect
 Rectangle for 2D coordinate system. More...
 
class  ResourceManager
 used for loading resources More...
 
class  RotatedRect
 rectangle with rotation for 2D coordinate system. More...
 
struct  ScrollWheelEvent
 the user repositioned the scroll wheel More...
 
class  Serializer
 serialize data into memory More...
 
struct  ShutdownEvent
 a timer fire event More...
 
class  Sound
 handles both short sounds and music (GUI Only) More...
 
struct  SoundEvent
 a sound completed or is looping (GUI Only) More...
 
class  SoundManager
 used for application wide sound settings and options (GUI Only) More...
 
class  Sprite
 animated, moving image that is automatically moved, animated, and drawn More...
 
struct  SpriteAnimateEvent
 a Sprite did some animation (Optional) More...
 
struct  SpriteBreakEvent
 a Sprite joint is breaking because it was overstressed (Chipmunk Physics Only) More...
 
struct  SpriteCollideEvent
 a Sprite collided with something (Optional) More...
 
class  SpriteLayer
 creates and tracks collections of sprites More...
 
struct  SpriteLayerEvent
 something happened to this layer More...
 
struct  SpriteTouchEvent
 the user clicked on (or touched) a Sprite More...
 
class  TileLayer
 efficiently handles large tile datasets, useful for backgrounds, terrains, etc... More...
 
struct  TimerEvent
 a timer fire event More...
 
class  TimerManager
 manages timers that can fire at a particular time, or repeatedly at an interval More...
 
class  Vector
 vector (magnitude and direction) within a 2D coordinate system. More...
 

Functions

 captureConsole ()
 
 cleanupSpriteLayer (SpriteLayer layer)
 
SpriteLayer createSpriteLayer (Port port=null)
 
SpriteLayer createSpriteLayerFromSCMLFile (string layerSCMLFilename, boolean addSprites=true, Port port=null)
 
TileLayer createTileLayer (Port port=null)
 
 debug (string msg)
 
 error (string msg)
 
 fatal (string msg)
 
ConfigManager getConfigManager ()
 get the singleton instance of the ConfigManager used by the pdg framework More...
 
EventManager getEventManager ()
 get the singleton instance of the EventManager used by the pdg framework More...
 
FileManager getFileManager ()
 get the singleton instance of the FileManager used by the pdg framework More...
 
GraphicsManager getGraphicsManager ()
 get the singleton instance of the GraphicsManager used by the pdg framework More...
 
LogManager getLogManager ()
 get the singleton instance of the LogManager used by the pdg framework More...
 
ResourceManager getResourceManager ()
 get the singleton instance of the ResourceManager used by the pdg framework More...
 
SoundManager getSoundManager ()
 get the singleton instance of the SoundManager used by the pdg framework More...
 
TimerManager getTimerManager ()
 get the singleton instance of the TimerManager used by the pdg framework More...
 
 idle ()
 
 info (string msg)
 
 log (string msg)
 
IEventHandler on (int eventType, function func)
 
IEventHandler onKeyDown (function func)
 
IEventHandler onKeyPress (function func)
 
IEventHandler onKeyUp (function func)
 
IEventHandler onMouseDown (function func)
 
IEventHandler onMouseMove (function func)
 
IEventHandler onMouseUp (function func)
 
IEventHandler onShutdown (function func)
 
IEventHandler onTimer (function func)
 
 openCommandPort (int port=5757)
 
 openConsole ()
 
 openDebugger ()
 
 quit ()
 
number rand ()
 
 registerEasingFunction (function easingFunc)
 
 registerSerializableClass (function klass)
 
 run ()
 
 setSerializationDebugMode (bool debugMode)
 
 srand (uint seed)
 
 startRepl ()
 
 trace (string msg)
 
 warn (string msg)
 

Variables

const action_AnimationComplete = 47
 eventType_SpriteLayer action: all animations for every SpriteLayer have completed More...
 
const action_AnimationEnd = 9
 eventType_SpriteAnimate action: a sprite animation has completed More...
 
const action_AnimationLoop = 8
 eventType_SpriteAnimate action: a sprite animation has completed and is looping back to the start More...
 
const action_AnimationStart = 44
 eventType_SpriteLayer action: starting animations for all SpriteLayers More...
 
const action_CollideSprite = 0
 
const action_CollideWall = 1
 eventType_SpriteAnimate action: a sprite has hit the edge of the sprite layer More...
 
const action_DrawPortComplete = 43
 eventType_SpriteLayer action: all drawing for every SpriteLayer has completed More...
 
const action_ErasePort = 40
 eventType_SpriteLayer action: about to start drawing each SpriteLayer More...
 
const action_ExitLayer = 4
 eventType_SpriteAnimate action: a sprite has moved outside the layer boundaries. More...
 
const action_FadeComplete = 10
 eventType_SpriteAnimate action: a sprite fadeTo() has completed More...
 
const action_FadeInComplete = 11
 eventType_SpriteAnimate action: a sprite fade-in has completed More...
 
const action_FadeOutComplete = 12
 eventType_SpriteAnimate action: a sprite fade-out has completed More...
 
const action_JointBreak = 13
 
const action_LayerFadeInComplete = 49
 eventType_SpriteLayer action: the fade-in of a layer has been completed More...
 
const action_LayerFadeOutComplete = 50
 eventType_SpriteLayer action: the fade-out of a layer has been completed More...
 
const action_Offscreen = 2
 eventType_SpriteAnimate action: a sprite has gone completely offscreen (GUI Only) More...
 
const action_Onscreen = 3
 eventType_SpriteAnimate action: a sprite that was off screen has moved onscreen (GUI Only) More...
 
const action_PostAnimateLayer = 46
 eventType_SpriteLayer action: all animations for a particular SpriteLayer have completed More...
 
const action_PostDrawLayer = 42
 eventType_SpriteLayer action: completed rendering for a particular SpriteLayer More...
 
const action_PreAnimateLayer = 45
 eventType_SpriteLayer action: about to start animations for a particular SpriteLayer More...
 
const action_PreDrawLayer = 41
 eventType_SpriteLayer action: about to render a particular SpriteLayer More...
 
const action_ZoomComplete = 48
 eventType_SpriteLayer action: zooming a particular sprite layer is complete More...
 
const all_events = 0
 a special catch-all for events that weren't handled by specific event handlers More...
 
const all_Frames = 0
 
const animate_Bidirectional = 2
 
const animate_EndToStart = 1
 
const animate_Looping = 4
 
const animate_NoLooping = 0
 
const animate_StartToEnd = 0
 
const animate_Unidirectional = 0
 
string[] argv
 contains the arguments passed on the command line More...
 
ConfigManager cfg
 
const collide_AlphaChannel = 4
 
const collide_BoundingBox = 2
 
const collide_CollisionRadius = 3
 
const collide_Last = 4
 
const collide_None = 0
 
const collide_Point = 1
 
const duration_Constant = -1
 
const duration_Instantaneous = 0
 
const easeInBack = 25
 
const easeInBounce = 22
 
const easeInCirc = 19
 
const easeInCubic = 4
 
const easeInExpo = 16
 
const easeInOutBack = 27
 
const easeInOutBounce = 24
 
const easeInOutCirc = 21
 
const easeInOutCubic = 6
 
const easeInOutExpo = 18
 
const easeInOutQuad = 3
 
const easeInOutQuint = 12
 
const easeInOutSine = 15
 
const easeInQuad = 1
 
const easeInQuart = 7
 
const easeInQuint = 10
 
const easeInSine = 13
 
const easeOutBack = 26
 
const easeOutBounce = 23
 
const easeOutCirc = 20
 
const easeOutCubic = 5
 
const easeOutExpo = 17
 
const easeOutQuad = 2
 
const easeOutQuart = 8
 
const easeOutQuint = 11
 
const easeOutSine = 14
 
const eventType_KeyDown = 4
 the user pushed down on a key More...
 
const eventType_KeyPress = 6
 the user pressed and released a key More...
 
const eventType_KeyUp = 5
 the user released a key More...
 
const eventType_MouseDown = 7
 the user pressed a mouse button More...
 
const eventType_MouseEnter = 22
 the user moved the mouse into a tracking area (NOT IMPLEMENTED) More...
 
const eventType_MouseLeave = 23
 the user moved the mouse out of a tracking area (NOT IMPLEMENTED) More...
 
const eventType_MouseMove = 9
 the user moved the mouse More...
 
const eventType_MouseUp = 8
 the user release a mouse button More...
 
const eventType_PortDraw = 24
 a port needs to be redrawn More...
 
const eventType_PortResized = 15
 a port was resized More...
 
const eventType_ScrollWheel = 16
 the user moved the scroll wheel More...
 
const eventType_Shutdown = 2
 one time application shutdown event More...
 
const eventType_SoundEvent = 14
 a sound finished or looped More...
 
const eventType_SpriteAnimate = 17
 a sprite finished an animation (Optional) More...
 
const eventType_SpriteBreak = 21
 joined sprites broke apart (Chipmunk Physics only) More...
 
const eventType_SpriteCollide = 20
 a collision between sprites More...
 
const eventType_SpriteLayer = 18
 something happening to a sprite layer More...
 
const eventType_SpriteTouch = 19
 sprite touched event (Optional) More...
 
const eventType_Timer = 3
 a timer fire event More...
 
EventManager evt
 
const facing_East = 64
 
const facing_Ignore = 256
 
const facing_North = 0
 
const facing_South = 128
 
const facing_West = 192
 
const fit_Fill = 4
 
const fit_FillKeepProportions = 5
 
const fit_Height = 1
 
const fit_Inside = 3
 
const fit_None = 0
 
const fit_Width = 2
 
const flipped_Both = 192
 
const flipped_Horizontal = 64
 
const flipped_Ignore = 256
 
const flipped_None = 0
 
const flipped_Vertical = 128
 
FileManager fs
 
GraphicsManager gfx
 
boolean hasGraphics
 
boolean hasNetwork
 
boolean hasSound
 
const init_AppendToExisting = 2
 
const init_CreateUniqueNewFile = 0
 
const init_OverwriteExisting = 1
 
const init_StdErr = 4
 
const init_StdOut = 3
 
const key_Backspace = 8
 
const key_Break = 1
 
const key_Clear = 4
 
const key_Delete = 127
 
const key_DownArrow = 31
 
const key_End = 3
 
const key_Enter = 13
 
const key_Escape = 27
 
const key_F1 = 14
 
const key_F10 = 23
 
const key_F11 = 24
 
const key_F12 = 25
 
const key_F2 = 15
 
const key_F3 = 16
 
const key_F4 = 17
 
const key_F5 = 18
 
const key_F6 = 19
 
const key_F7 = 20
 
const key_F8 = 21
 
const key_F9 = 22
 
const key_FirstF = 14
 
const key_FirstPrintable = 32
 
const key_Help = 5
 
const key_Home = 2
 
const key_Insert = 26
 
const key_LastF = 25
 
const key_LeftArrow = 28
 
const key_Mute = 7
 
const key_PageDown = 12
 
const key_PageUp = 11
 
const key_Pause = 6
 
const key_Return = 13
 
const key_RightArrow = 29
 
const key_Tab = 9
 
const key_UpArrow = 30
 
const lftBot = 3
 
const lftTop = 0
 
const linearTween = 0
 
LogManager lm
 
boolean quitting
 
ResourceManager res
 
const rgtBot = 2
 
const rgtTop = 1
 
boolean running
 
const screenPos_FaceDown = 5
 
const screenPos_FaceUp = 4
 
const screenPos_Normal = 0
 
const screenPos_Rotated180 = 1
 
const screenPos_Rotated90Clockwise = 2
 
const screenPos_Rotated90CounterClockwise = 3
 
const ser_Animations = 8
 
const ser_Forces = 32
 
const ser_Full = 18303
 sprite layer serialization mode for recreating layer More...
 
const ser_HelperObjs = 8192
 
const ser_HelperRefs = 1024
 
const ser_ImageRefs = 256
 
const ser_InitialData = 16384
 
const ser_LayerDraw = 128
 
const ser_Micro = 3
 sprite layer serialization mode for minimal size More...
 
const ser_Motion = 16
 
const ser_Physics = 64
 
const ser_Positions = 1
 
const ser_SCMLRefs = 512
 
const ser_Sizes = 4
 
const ser_Update = 127
 sprite layer serialization mode for regular updates More...
 
const ser_ZOrder = 2
 
SoundManager snd
 
const soundEvent_DonePlaying = 0
 sound event type for completion of a sound More...
 
const soundEvent_FailedToPlay = 2
 sound event type for a sound error More...
 
const soundEvent_Looping = 1
 sound event type for a sound finishing and starting over More...
 
const start_FromFirstFrame = -1
 
const start_FromLastFrame = -2
 
const textStyle_Bold = 1
 
const textStyle_Centered = 16
 
const textStyle_Italic = 2
 
const textStyle_LeftJustified = 0
 
const textStyle_Plain = 0
 
const textStyle_RightJustified = 32
 
const textStyle_Underline = 4
 
const timer_Never = -1
 
const timer_OneShot = true
 
const timer_Repeating = false
 
TimerManager tm
 
const touch_MouseClick = 24
 
const touch_MouseDown = 22
 
const touch_MouseEnter = 20
 
const touch_MouseLeave = 21
 
const touch_MouseUp = 23
 

Class Documentation

struct pdg::TimerEvent

a timer fire event

Generated by the TimerManager when a timer fires

{ 
    emitter: {},            // the emitter that generated this event
    eventType: 3,           // the event type (eventType_Timer)
    id: 117440512,          // the timer id (auto-generated up by onTimeout())
    millisec: 1025448321,   // the millisecond time when the timer fired
    msElapsed: 18896        // the time elapsed since the timer was started or last fired
} 
See Also
eventType_Timer

Function Documentation

pdg::captureConsole ( )
pdg::cleanupSpriteLayer ( SpriteLayer  layer)
SpriteLayer pdg::createSpriteLayer ( Port  port = null)
SpriteLayer pdg::createSpriteLayerFromSCMLFile ( string  layerSCMLFilename,
boolean  addSprites = true,
Port  port = null 
)
TileLayer pdg::createTileLayer ( Port  port = null)
pdg::debug ( string  msg)
pdg::error ( string  msg)
pdg::fatal ( string  msg)
getConfigManager ( )

get the singleton instance of the ConfigManager used by the pdg framework

Returns
ConfigManager singleton object
getEventManager ( )

get the singleton instance of the EventManager used by the pdg framework

Returns
EventManager singleton object
getFileManager ( )

get the singleton instance of the FileManager used by the pdg framework

Returns
FileManager singleton object
getGraphicsManager ( )

get the singleton instance of the GraphicsManager used by the pdg framework

Returns
GraphicsManager singleton object
getLogManager ( )

get the singleton instance of the LogManager used by the pdg framework

Returns
LogManager singleton object
getResourceManager ( )

get the singleton instance of the ResourceManager used by the pdg framework

Returns
ResourceManager singleton object
getSoundManager ( )

get the singleton instance of the SoundManager used by the pdg framework

Returns
SoundManager singleton object
getTimerManager ( )

get the singleton instance of the TimerManager used by the pdg framework

Returns
TimerManager singleton object
pdg::idle ( )
pdg::info ( string  msg)
pdg::log ( string  msg)
IEventHandler pdg::on ( int  eventType,
function  func 
)
IEventHandler pdg::onKeyDown ( function  func)
IEventHandler pdg::onKeyPress ( function  func)
IEventHandler pdg::onKeyUp ( function  func)
IEventHandler pdg::onMouseDown ( function  func)
IEventHandler pdg::onMouseMove ( function  func)
IEventHandler pdg::onMouseUp ( function  func)
IEventHandler pdg::onShutdown ( function  func)
IEventHandler pdg::onTimer ( function  func)
pdg::openCommandPort ( int  port = 5757)
pdg::openConsole ( )
pdg::openDebugger ( )
pdg::quit ( )
number pdg::rand ( )
pdg::registerEasingFunction ( function  easingFunc)
pdg::registerSerializableClass ( function  klass)
pdg::run ( )
pdg::setSerializationDebugMode ( bool  debugMode)
pdg::srand ( uint  seed)
pdg::startRepl ( )
pdg::trace ( string  msg)
pdg::warn ( string  msg)

Variable Documentation

const all_Frames = 0
const animate_Bidirectional = 2
const animate_EndToStart = 1
const animate_Looping = 4
const animate_NoLooping = 0
const animate_StartToEnd = 0
const animate_Unidirectional = 0
argv

contains the arguments passed on the command line

If this was launched by being double-clicked, or on the command line with no arguments, then it will contain:

[ "/path/to/pdg", "main.js" ]

pdg.argv[0] will always be the path to the pdg application. There will always be a .js file on the path, even if one wasn't specifically passed in main.js will be added.

ConfigManager cfg
related
const collide_AlphaChannel = 4
const collide_BoundingBox = 2
const collide_CollisionRadius = 3
const collide_Last = 4
const collide_None = 0
const collide_Point = 1
const duration_Constant = -1
const duration_Instantaneous = 0
const easeInBack = 25
const easeInBounce = 22
const easeInCirc = 19
const easeInCubic = 4
const easeInExpo = 16
const easeInOutBack = 27
const easeInOutBounce = 24
const easeInOutCirc = 21
const easeInOutCubic = 6
const easeInOutExpo = 18
const easeInOutQuad = 3
const easeInOutQuint = 12
const easeInOutSine = 15
const easeInQuad = 1
const easeInQuart = 7
const easeInQuint = 10
const easeInSine = 13
const easeOutBack = 26
const easeOutBounce = 23
const easeOutCirc = 20
const easeOutCubic = 5
const easeOutExpo = 17
const easeOutQuad = 2
const easeOutQuart = 8
const easeOutQuint = 11
const easeOutSine = 14
EventManager evt
related
const facing_East = 64
const facing_Ignore = 256
const facing_North = 0
const facing_South = 128
const facing_West = 192
const fit_Fill = 4
const fit_FillKeepProportions = 5
const fit_Height = 1
const fit_Inside = 3
const fit_None = 0
const fit_Width = 2
const flipped_Both = 192
const flipped_Horizontal = 64
const flipped_Ignore = 256
const flipped_None = 0
const flipped_Vertical = 128
FileManager fs
related
GraphicsManager gfx
related
boolean hasGraphics
boolean hasNetwork
boolean hasSound
const init_AppendToExisting = 2
const init_CreateUniqueNewFile = 0
const init_OverwriteExisting = 1
const init_StdErr = 4
const init_StdOut = 3
const lftBot = 3
const lftTop = 0
const linearTween = 0
boolean quitting
ResourceManager res
related
const rgtBot = 2
const rgtTop = 1
boolean running
const screenPos_FaceDown = 5
const screenPos_FaceUp = 4
const screenPos_Normal = 0
const screenPos_Rotated180 = 1
const screenPos_Rotated90Clockwise = 2
const screenPos_Rotated90CounterClockwise = 3
const ser_Animations = 8
const ser_Forces = 32
ser_Full = 18303

sprite layer serialization mode for recreating layer

Everything needed to completely recreate the sprite layer.

See Also
ser_Micro
ser_Update
SpriteLayer.setSerializationFlags()
Warning
Helpers are not recreated.
Todo:
Support serialization of SCML-based sprites
const ser_HelperObjs = 8192
const ser_HelperRefs = 1024
const ser_ImageRefs = 256
const ser_InitialData = 16384
const ser_LayerDraw = 128
ser_Micro = 3

sprite layer serialization mode for minimal size

Only sends position and z-order updates. Ideal for sprite layers that do no animation of their own and are completely driven frame by frame from a master sprite layer, or perhaps for recording the paths of objects in a sprite layer for a rewind/replay.

See Also
ser_Update
ser_Full
SpriteLayer.setSerializationFlags()
const ser_Motion = 16
const ser_Physics = 64
const ser_Positions = 1
const ser_SCMLRefs = 512
const ser_Sizes = 4
ser_Update = 127

sprite layer serialization mode for regular updates

Used to update sprite layers that were created to be identical. Unlike the micro update, the updated info includes all the currently acting animations and forces, so it does not need to be updated every frame like the micro updates.

See Also
ser_Micro
ser_Full
SpriteLayer.setSerializationFlags()
const ser_ZOrder = 2
SoundManager snd
related
const start_FromFirstFrame = -1
const start_FromLastFrame = -2
const textStyle_Bold = 1
const textStyle_Centered = 16
const textStyle_Italic = 2
const textStyle_LeftJustified = 0
const textStyle_Plain = 0
const textStyle_RightJustified = 32
const textStyle_Underline = 4
const timer_Never = -1
const timer_OneShot = true
const timer_Repeating = false
TimerManager tm
related
const touch_MouseClick = 24
const touch_MouseDown = 22
const touch_MouseEnter = 20
const touch_MouseLeave = 21
const touch_MouseUp = 23

User Comments