Methods - boxgaming/gx GitHub Wiki

GX API Reference

Scene

Method Description
GXSceneCreate Creates a new scene with the specified pixel width and height.
GXSceneWindowSize Scales the scene to the specified window size.
GXSceneScale Scales the scene by the specified scale factor.
GXSceneResize Resize the scene with the specified pixel width and height.
GXSceneDraw Draw the scene. This method is called automatically when GX is managing the event/game loop. Call this method for each page draw event when the event/game loop is being handled externally.
GXSceneMove Moves the scene position by the number of pixels specified by the dx and dy values.
GXScenePos Positions the scene at the specified x and y coordinates. The default position for a scene is (0,0). Negative x and y values are valid.
GXSceneX Returns the scene's current y position.
GXSceneY Returns the scene's current y position.
GXSceneWidth Returns the scene width.
GXSceneHeight Returns the scene height.
GXSceneColumns Returns the number of tile columns that can be displayed within the scene. This value will be zero unless a tiled map has been created or loaded.
GXSceneRows Returns the number of tile rows that can be displayed within the scene. This value will be zero unless a tiled map has been created or loaded.
GXSceneStart Start the game loop. This method will not return control to the calling program until the game loop is interrupted with the GXSceneStop method. Game events will be sent to the GXOnGameEvent method during the game loop execution.
GXSceneUpdate
GXSceneFollowEntity
GXSceneConstrain
GXSceneStop
GXSceneStop Stop the game loop. This method will cause the game loop to end and return control to the calling program.
GXSceneEmbedded

Entity

Method Description
GXEntityAnimate Animates a specified entity.
GXEntityAnimateStop Stops animation of the current animation sequence.
GXEntityAnimateMode Gets or sets the animation mode of a specified entity.
GXEntityCreate
GXScreenEntityCreate Creates a new game entity. In GX an entity is an object that can be placed into and interact with the game world. An entity has an x and y position, a height and width, as well as basic physics properties like velocity. An entity is created from a spritesheet image. Each row of the spritesheet should contain a separate animation sequence.
GXEntityVisible
GXEntityMove Move the specified entity relative to its current position.
GXEntityPos Position the entity at the specified x and y pixel coordinates.
GXEntityVX Gets or sets the horizontal velocity (vx) of the specified entity. The value of the horizontal velocity (vx) is specified as the number of pixels per second. A positive value indicates movement to the right. A negative value indicates movement to the left.
GXEntityVY Gets or sets the vertical velocity (vx) of the specified entity. The value of the vertical velocity (vx) is specified as the number of pixels per second. A positive value indicates downward movement. A negative value indicates upward movement.
GXEntityX Returns the horizontal (x) position of the specified entity.
GXEntityY Returns the vertical (y) position of the specified entity.
GXEntityWidth Returns the width of the specified entity.
GXEntityHeight Returns the height of the specified entity.
GXEntityFrameNext Advance to the next animation frame in the current animation sequence for a specified entity.
GXEntityFrameSet Set the current animation frame for a specified entity.
GXEntityFrame
GXEntitySequence
GXEntitySequences
GXEntityFrames
GXEntityFrames
GXEntityType
GXEntityMapLayer
GXEntityApplyGravity Gets or sets the "apply gravity" mode of a specified entity.
GXEntityCollisionOffset Sets the collision offset for a specified entity. By default the collision rectangle is set to the border of the entity as defined by its height and width. A smaller or larger area can be defined for collision detection with this method.
GXEntityCollisionOffsetLeft
GXEntityCollisionOffsetTop
GXEntityCollisionOffsetRight
GXEntityCollisionOffsetBottom
GXEntityCollide

Background

Method Description
GXBackgroundAdd Adds a new background image to the current scene.
GXBackgroundWrapFactor
GXBackgroundClear Removes all background images from the scene.

Map

Method Description
GXMapCreate
GXMapColumns Returns the width of the map in tile columns.
GXMapRows Returns the height of the map in tile rows.
GXMapLayers
GXMapLayerVisible
GXMapLayerVisible
GXMapLayerAdd
GXMapLayerInsert
GXMapLayerRemove
GXMapResize
GXMapDraw
GXMapTilePosAt
GXMapTile
GXMapTileDepth
GXMapTileAdd
GXMapTileRemove
GXMapVersion
GXMapSave
GXMapLoad
GXMapIsometric

Tileset

Method Description
GXTilesetCreate
GXTilesetReplaceImage
GXTilesetLoad
GXTilesetSave
GXTilesetPos
GXTilesetWidth
GXTilesetHeight
GXTilesetColumns
GXTilesetRows
GXTilesetFilename
GXTilesetImage
GXTilesetAnimationCreate
GXTilesetAnimationAdd
GXTilesetAnimationRemove
GXTilesetAnimationFrames
GXTilesetAnimationSpeed

Font

Method Description
GXFontCreate
GXFontWidth%
GXFontHeight%
GXFontCharSpacing%
GXFontLineSpacing
GXDrawText

Device Input

Method Description
GXKeyDown Returns a true or false value indicating whether the key identified by the keyCode% paramter is currently being pressed. Key codes constants are defined with the prefix "GXKEY_".
GXKeyInput
GXDeviceInputDetect
GXDeviceInputTest
GXDeviceName
GXDeviceTypeName
GXInputTypeName
GXKeyButtonName

Sound

Method Description
GXSoundLoad
GXSoundPlay
GXSoundRepeat
GXSoundVolume
GXSoundPause
GXSoundStop
GXSoundMuted

Miscellaneous

Method Description
GXFullScreen Gets or sets the fullscreen status. When set to true the scene content will stretch to fill the entire screen. This value is set to false by default.
GXFrame Returns the current frame. This is a frame counter that starts when GXSceneStart is called. It is initially set to zero and is incremented on each frame.
GXFrameRate Gets or sets the current frame rate (expressed in frames-per-second or FPS). The default value for the frame rate is 60.
GXSleep
GXMouseX
GXMouseY
GXGravity
GXHardwareAcceleration

Debugging

Method Description
GXDebug
GXDebugScreenEntities
GXDebugFont
GXDebugTileBorderColor
GXDebugEntityBorderColor
GXDebugEntityCollisionColor