BGE


Static Methods

getNewMemoryScratchRegion( width: float, height: float, ): ScratchRegion

static

Parameters

  • width (float)
  • height (float)

Returns

isBackFaceDrawMode(drawMode: SceneObjectDrawMode): boolean

static

Parameters

Returns

  • boolean

isDirectDrawMode(drawMode: SceneObjectDrawMode): boolean

static

Parameters

Returns

  • boolean

isOrientedDrawMode(drawMode: SceneObjectDrawMode): boolean

static

Parameters

Returns

  • boolean

isScreenAlignedDrawMode(drawMode: SceneObjectDrawMode): boolean

static

The draw modes that keep an object square to the screen rather than turning it in 3D - the billboard modes. directScaled belongs here even though isOrientedDrawMode groups it with the oriented modes: it faces the camera like directToCamera and only differs in taking its size from how far away it is (a Doom-style sprite).

Parameters

Returns

  • boolean

isWireFrameDrawMode(drawMode: SceneObjectDrawMode): boolean

static

Parameters

Returns

  • boolean

isSolidDrawMode(drawMode: SceneObjectDrawMode): boolean

static

Parameters

Returns

  • boolean

isFullDrawMode(drawMode: SceneObjectDrawMode): boolean

static

Parameters

Returns

  • boolean

getDrawModeName(drawMode: SceneObjectDrawMode): string

static

The name of a draw mode, as written in the SceneObjectDrawMode enum - handy for debug overlays and for examples that let you cycle through the draw modes.

Parameters

Returns

  • string — the mode's name, or "unknown" for a value outside the enum

getDrawModeBooleanLookupArray(defaultValue?: boolean): dynamic

static

Parameters

  • defaultValue (boolean, optional, default: false)

Returns

  • dynamic

getDotProductFromSurfaceToCamera( rendererObj: BGE.Renderer, facePoint: BGE.Math.Vector, faceNormal: BGE.Math.Vector, ): float

static

Parameters

  • rendererObj (BGE.Renderer)
  • facePoint (BGE.Math.Vector)
  • faceNormal (BGE.Math.Vector)

Returns

  • float

isNormalFacingCamera( rendererObj: BGE.Renderer, facePoint: BGE.Math.Vector, faceNormal: BGE.Math.Vector, ): boolean

static

Parameters

  • rendererObj (BGE.Renderer)
  • facePoint (BGE.Math.Vector)
  • faceNormal (BGE.Math.Vector)

Returns

  • boolean

HSVtoRGBA( hPercent: float, sPercent: float, vPercent: float, a?: integer, ): integer

static

Parameters

  • hPercent (float)
  • sPercent (float)
  • vPercent (float)
  • a (integer, optional, default: -1)

Returns

  • integer

RGBAtoRGBA( red: integer, green: integer, blue: integer, alpha?: float, ): integer

static

Parameters

  • red (integer)
  • green (integer)
  • blue (integer)
  • alpha (float, optional, default: 1)

Returns

  • integer

GetColor(name: string): integer

static

Looks up a BGE.Colors value by name (case-insensitive). Falls back to White for a name that isn't a known color.

Parameters

  • name (string)

Returns

  • integer

GetColorRGB(name: string): integer

static

Looks up a BGE.ColorsRGB value by name (case-insensitive). Falls back to White for a name that isn't a known color.

Parameters

  • name (string)

Returns

  • integer

getRandomColorRGB( r?: integer, g?: integer, b?: integer, ): integer

static

A random color as a packed RGB integer (0xRRGGBB, no alpha byte) - the format Drawable.color/Drawable.outlineRGBA expect. Use getRandomColorRGBA for the packed-RGBA format the Renderer.draw* calls take.

Parameters

  • r (integer, optional, default: 255) — exclusive upper bound for the red channel
  • g (integer, optional, default: 255) — exclusive upper bound for the green channel
  • b (integer, optional, default: 255) — exclusive upper bound for the blue channel

Returns

  • integer — packed RGB color

getRandomColorRGBA( r?: integer, g?: integer, b?: integer, a?: integer, ): integer

static

Parameters

  • r (integer, optional, default: 255)
  • g (integer, optional, default: 255)
  • b (integer, optional, default: 255)
  • a (integer, optional, default: 255)

Returns

  • integer

colorBrightness(rgba: integer, brightness: float): integer

static

Parameters

  • rgba (integer)
  • brightness (float)

Returns

  • integer

colorOpacity(rgba: integer, opacity: float): integer

static

Parameters

  • rgba (integer)
  • opacity (float)

Returns

  • integer

registryWrite( registry_section: string, key: string, value: dynamic, ): void

static

Parameters

  • registry_section (string)
  • key (string)
  • value (dynamic)

Returns

  • void

registryRead( registry_section: string, key: string, default_value?: dynamic, ): dynamic

static

Parameters

  • registry_section (string)
  • key (string)
  • default_value (dynamic, optional, default: "invalid")

Returns

  • dynamic

getNumberOfLinesInAString(text: string): integer

static

Gets the number of lines in a string by counting the newlines

Parameters

  • text (string)

Returns

  • integer

lastInStr(text: string, substring: string): integer

static

Finds the index of the last time a substring appears in a string

Parameters

  • text (string)
  • substring (string)

Returns

  • integer

numberToFixed(num: float, precision: integer): string

static

Given a float number, returns the number with a fixed numbers of decimals as a string

Parameters

  • num (float)
  • precision (integer)

Returns

  • string

arrayToStr(things: dynamic): string

static

Parameters

  • things (dynamic)

Returns

  • string

stringToFloat(input: string): float

static

Parameters

  • input (string)

Returns

  • float

TexturePacker_GetRegions( atlas: dynamic, bitmap: ifDraw2d, ): roAssociativeArray

static

TODO: figure this out... is useful for sprites with different size frames

Parameters

  • atlas (dynamic)
  • bitmap (ifDraw2d)

Returns

  • roAssociativeArray

ArrayInsert( array: dynamic, index: integer, value: dynamic, ): dynamic

static

Parameters

  • array (dynamic)
  • index (integer)
  • value (dynamic)

Returns

  • dynamic

DrawCircleOutline( draw2d: ifDraw2d, line_count: integer, x: float, y: float, radius: float, rgba: integer, ): void

static

Parameters

  • draw2d (ifDraw2d)
  • line_count (integer)
  • x (float)
  • y (float)
  • radius (float)
  • rgba (integer)

Returns

  • void

DrawRectangleOutline( draw2d: ifDraw2d, x: float, y: float, width: float, height: float, rgba: integer, ): void

static

Parameters

  • draw2d (ifDraw2d)
  • x (float)
  • y (float)
  • width (float)
  • height (float)
  • rgba (integer)

Returns

  • void

isValidEntity(entity: EntityWithId): boolean

static

Parameters

Returns

  • boolean

buttonNameFromCode(buttonCode: integer): string

static

Parameters

  • buttonCode (integer)

Returns

  • string

cloneArray(original?: Array.<dynamic>): dynamic

static

Clone an array (shallow)

Parameters

  • original (Array.<dynamic>, optional, default: "[]") — the original array to be clones

Returns

  • dynamic — A shallow copy of the original array

pointArraysEqual(a?: dynamic, b?: dynamic): boolean

static

Check if two arrays of points are teh same - that is, if each point, in order has same x and y values

Parameters

  • a (dynamic, optional, default: "[]") — the first array
  • b (dynamic, optional, default: "[]") — the second array

Returns

  • boolean — true if both arrays have same number of points and x and y values are the same for each point

isTrue(value: dynamic): boolean

static

Parameters

  • value (dynamic)

Returns

  • boolean

bytesToInteger( bytes: dynamic, offset?: integer, isLittleEndian?: boolean, ): integer

static

Parameters

  • bytes (dynamic)
  • offset (integer, optional, default: 0)
  • isLittleEndian (boolean, optional, default: true)

Returns

  • integer

bytesToFloat( bytes: dynamic, offset?: integer, isLittleEndian?: boolean, ): float

static

Parameters

  • bytes (dynamic)
  • offset (integer, optional, default: 0)
  • isLittleEndian (boolean, optional, default: true)

Returns

  • float

subArray( array: ifArray, startIndex: integer, length: integer, ): roArray

static

Parameters

  • array (ifArray)
  • startIndex (integer)
  • length (integer)

Returns

  • roArray

decToHex(dec: integer): string

static

Parameters

  • dec (integer)

Returns

  • string

Enums

.SpritePlayMode

enumreadonly

Properties

  • Loop (default: "loop")
  • Forward (default: "forward")
  • Reverse (default: "reverse")
  • PingPong (default: "pingpong")

.CameraFrustumSide

enumreadonly

Properties

  • top (default: "top")
  • bottom (default: "bottom")
  • left (default: "left")
  • right (default: "right")
  • near (default: "near")

.SceneObjectType

enumreadonly

Properties

  • Line (default: "Line")
  • Rectangle (default: "Rectangle")
  • Text (default: "Text")
  • Bitmap (default: "Bitmap")
  • Polygon (default: "Polygon")
  • Billboard (default: "Billboard")
  • Model (default: "Model")
  • Plane (default: "Plane")

.SceneObjectDrawMode

enumreadonly

Properties

  • matchCamera (default: 0) — Rotations are ignored
  • directToCamera (default: 1) — Do not orient in 3d space
  • directScaled (default: 2) — Do not orient in 3d space, but scale in relation to distance from camera
  • oriented (default: 3) — Orient in 3d space
  • orientedDrawBackFace (default: 4) — Orient the object, and draw any back faces
  • wireFrame (default: 5) — Just draw a wire frame
  • wireFrameDrawBackFace (default: 6) — Just draw a wire frame, including back faces
  • solid (default: 7) — Draw a solid polygon
  • solidDrawBackFace (default: 8) — Draw a solid polygon, including back faces

.Colors

enumreadonly

Named colors as packed RGBA integers (0xRRGGBBAA), fully opaque. Values match RGBAtoRGBA(r, g, b) for the same named color.

Properties

  • Black (default: 255)
  • White (default: 4294967295)
  • Red (default: 4278190335)
  • Lime (default: 16711935)
  • Blue (default: 65535)
  • Yellow (default: 4294902015)
  • Cyan (default: 16777215)
  • Aqua (default: 16777215)
  • Magenta (default: 4278255615)
  • Pink (default: 4278255615)
  • Fuchsia (default: 4278255615)
  • Silver (default: 3233857791)
  • Gray (default: 2155905279)
  • Grey (default: 2155905279)
  • Maroon (default: 2147483903)
  • Olive (default: 2155872511)
  • Green (default: 8388863)
  • Purple (default: 2147516671)
  • Teal (default: 8421631)
  • Navy (default: 33023)

.ColorsRGB

enumreadonly

Named colors as packed RGB integers (0xRRGGBB, no alpha byte) - the same values as BGE.Colors, right-shifted by 8.

Properties

  • Black (default: 0)
  • White (default: 16777215)
  • Red (default: 16711680)
  • Lime (default: 65280)
  • Blue (default: 255)
  • Yellow (default: 16776960)
  • Cyan (default: 65535)
  • Aqua (default: 65535)
  • Magenta (default: 16711935)
  • Pink (default: 16711935)
  • Fuchsia (default: 16711935)
  • Silver (default: 12632256)
  • Gray (default: 8421504)
  • Grey (default: 8421504)
  • Maroon (default: 8388608)
  • Olive (default: 8421376)
  • Green (default: 32768)
  • Purple (default: 8388736)
  • Teal (default: 32896)
  • Navy (default: 128)

Other

Canvas

static

Contains a roku roBitmap which all game objects get drawn to.

Parameters

  • gameEngine (Game)
  • canvasWidth (integer) — width of canvas
  • canvasHeight (integer) — height of canvas
  • options (RendererOptions, optional, default: "{useBitmapPooling: true}")

Properties

  • bitmap (ifDraw2D) — bitmap GameEntity images get drawn to
  • offset (BGE.Math.Vector) — Position offset from screen coordinates (z value ignored)
  • scale (BGE.Math.Vector) — Scale (z value ignored)
  • renderer (Renderer) — Renderer for this canvas
  • rendererOptions (RendererOptions)

Returns

Game

static

Main Game Engine class which runs everything The main game loop is as follows:

  1. Update - For each GameEntity:
  1. Collisions - For each GameEntity:
  • Run Entity's onPreCollision() function
  • For any collisions, runs Entity's onCollision() function
  • Runs entity's onPostCollision() function (At any time, the Entity in question may Delete() itself. Before every entity interaction, the entity is checked to make sure it is still valid in case it was deleted in the last interaction)
  1. Draw - For each GameEntity, sorted by zIndex
  • Runs the Entity onDrawBegin() function
  • For each drawable in the Entity, run the draw() function
  • Run the Entity onDrawEnd() function
  1. Draw all debug items in game space (e.g. colliders, screen safe zones, etc).

  2. UI - For the tree of widgets in the UI Container

  • Run onUpdate()
  • Run draw()
  1. Debug UI - Draw all debug windows in the tree of the Debug UI

Parameters

  • canvasWidth (integer) — Width of the canvas the game is drawn to
  • canvasHeight (integer) — Height of the canvas the game is drawn to
  • uiWidth (integer, optional, default: 0) — Width of the UI canvas - if 0, will be same as screen
  • uiHeight (integer, optional, default: 0) — Height of the UI canvas - if 0, will be same as screen

Properties

  • sortedEntities (dynamic)
  • compositor (roCompositor)
  • screen (roScreen)
  • canvas (BGE.Canvas)
  • uiCanvas (BGE.Canvas)
  • dummyScreen (roScreen)
  • currentRoom (Room) — Reference to the current room in play
  • currentRoomArgs (dynamic) — Any special arguments for the current room
  • Entities (dynamic) — All of the GameEntities by room => => GameEntity
  • Statics (dynamic) — All static variables for a given object type
  • Rooms (dynamic) — The room definitions by name (the room creation functions)
  • Interfaces (dynamic) — The interface definitions by name
  • Bitmaps (dynamic) — The loaded bitmaps by name
  • Sounds (dynamic) — The loaded sounds by name
  • Fonts (dynamic) — The loaded fonts by name
  • Models (dynamic) — The loaded Models by name
  • gameUi (BGE.UI.UiContainer) — Container for all UI
  • debugUi (BGE.UI.UiContainer) — Container for Debug UI

Returns

GameEntity

static

Every thing (character, player, object, etc) in the game should extend this class. This class has a number of empty methods that are designed to be overridden in subclasses. For example, override onInput() to handle input event, and onUpdate() to handle updating each frame

Parameters

  • game (Game) — The game engine that this entity is going to be assigned to
  • gameEngine (Game)
  • args (roAssociativeArray, optional, default: "{}") — Any extra properties to be added to this entity

Properties

  • name (string) — Constant - name of this Entity
  • id (dynamic) — Constant - Unique Id
  • game (Game)
  • enabled (boolean) — Is this GameEntity enabled
  • persistent (boolean) — Does this entity persist across room changes?
  • pauseable (boolean) — When the game is paused, does this entity pause too?
  • position (dynamic) — position of where this entity is in game world
  • velocity (dynamic) — Speed of this entity, in units/second (not units/frame) - added to position each frame scaled by elapsed time
  • rotation (dynamic) — Rotation of entity - applies to all images
  • scale (dynamic) — Scale of entity - applies to all images
  • colliders (roAssociativeArray) — The colliders for this entity by name
  • drawables (dynamic) — The array of drawables to draw for this entity
  • drawablesByName (roAssociativeArray) — Associative array of drawables by name
  • tagsList (dynamic) — Game Entities can be tagged with any number of tags so they can be easily identified (e.g. "enemy", "wall", etc.)
  • transformationMatrix (dynamic) — The Current Transformation Matrix
  • motionChecker (MotionChecker)

Returns

GameInput

static

Class that contains all information about the current input during a given frame from the remote

Parameters

  • buttonCode (integer) — button to use for the data
  • heldTimeMs (integer) — how long was this button held for

Properties

  • button (string) — The name of the button associated with the current input
  • buttonCode (integer) — The code for the input
  • press (boolean) — Was the button pressed since the last frame
  • held (boolean) — Was the button held down since last frame
  • release (boolean) — Was the button released this frame
  • heldTimeMs (integer) — How many milliseconds was the current input held for
  • x (float) — Current horizontal directional input: left -> -1, right -> 1
  • y (float) — Current vertical directional input, in world space (+y is up, matching ' the engine's world coordinate convention - the renderer flips this when ' projecting to raster/canvas space): up -> 1, down -> -1

Returns

Example

CODE
' -------Button Code Reference--------
' Button  Pressed Released  Held
' ------------------------------
' Back         0      100   1000
' Up           2      102   1002
' Down         3      103   1003
' Left         4      104   1004
' Right        5      105   1005
' OK           6      106   1006
' Replay       7      107   1007
' Rewind       8      108   1008
' FastForward  9      109   1009
' Options     10      110   1010
' Play        13      113   1013

GameTimer

static

Wrapper for Roku's roTimeSpan that allows time adjustment

Returns

Room

static

Extends: GameEntity

Parameters

  • gameEngine (Game)
  • args (roAssociativeArray, optional, default: "{}")

Returns

CircleCollider

static

Extends: Collider

Collider with the shape of a circle centered at (offset.x, offset.y), with given radius

Parameters

  • colliderName (string) — name of this collider
  • args (roAssociativeArray, optional, default: "{}") — additional properties (e.g {radius: 10})

Properties

  • radius (integer) — Radius of the collider

Returns

Collider

static

Colliders are attached to GameEntities and when two colliders intersect, it triggers the onCollision() method in the GameEntity

Parameters

  • colliderName (string) — the name this collider will be identified by
  • args (roAssociativeArray, optional, default: "{}") — additional properties to be added to this collider

Properties

Returns

RectangleCollider

static

Extends: Collider

Collider with the shape of a rectangle with bottom left at (offset.x, offset.y) - i.e. top left is at (offset.x, offset.y - height) - with given width and height

Parameters

  • colliderName (string) — name of this collider
  • args (roAssociativeArray, optional, default: "{}") — additional properties (e.g {width: 10, height: 20})

Properties

  • width (float)
  • height (float)

Returns

AnimatedImage

static

Extends: Image

Parameters

  • owner (GameEntity)
  • regions (dynamic)
  • args (roAssociativeArray, optional, default: "{}")

Properties

  • index (integer) — The current index of image - this would not normally be changed manually, but if you wanted to stop on a specific image in the spritesheet this could be set.
  • animationDurationMs (float) — The time in milliseconds for a single cycle through the animation to play.
  • animationTween (string) — The name of the tween to use for choosing the next image
  • regions (dynamic) — ------------Never To Be Manually Changed----------------- ' These values should never need to be manually changed.
  • animationTimer (dynamic)
  • tweensReference (dynamic)

Returns

Drawable

static

Abstract drawable class - all drawables extend from this

Parameters

  • owner (GameEntity)
  • args (roAssociativeArray, optional, default: "{}")

Properties

  • name (string) — -------------Values That Can Be Changed------------
  • offset (dynamic) — The offset of the image from the owner's position
  • scale (dynamic) — The image scale
  • rotation (dynamic) — Rotation of the image
  • color (integer) — This can be used to tint the image with the provided color if desired. White makes no change to the original image.
  • outlineRGBA (integer) — RGB color for the outline stroke. Leave invalid for no outline at all.
  • outlineWidth (integer) — Thickness of the outline stroke, in pixels. Only used when outlineRGBA is set.
  • alpha (float) — Change the image alpha (transparency).
  • enabled (boolean) — Whether or not the image will be drawn.
  • transformationMatrix (dynamic)
  • motionChecker (MotionChecker)
  • shouldRedraw (boolean)
  • geometryVersion (integer) — Bumped every time this drawable's geometry changes in a way the ' position/rotation/scale dirty-checking can't see - a rectangle being resized, for ' instance. SceneObject compares against it to know it has to recompute projected ' geometry even though nothing moved. Bump it via invalidateGeometry().
  • anchor (dynamic) — Normalized anchor point (0-1 on each axis) this drawable pivots around, where (0,0) is ' the top left corner (today's default behavior for every existing drawable) and (1,1) is ' the bottom right. Change it via setAnchor(), not by assigning directly - the renderer ' needs to know the geometry changed.
  • anchorIsSet (boolean) — Whether setAnchor() has ever been called. Image consults this to decide whether to keep ' honoring whatever pretranslation is already on its region (e.g. from a sprite atlas ' pivot) or to override it - see Image.applyAnchorToRegion().
  • owner (GameEntity) — owner GameEntity
  • width (float)
  • height (float)
  • sceneObjects (dynamic)
  • drawMode (SceneObjectDrawMode)
  • isShaded (boolean)

Returns

DrawableLine

static

Extends: Drawable

Parameters

  • owner (GameEntity)
  • startPos (BGE.Math.Vector)
  • endPos (BGE.Math.Vector)
  • args (roAssociativeArray, optional, default: "{}")

Properties

  • startPosition (BGE.Math.Vector)
  • endPosition (BGE.Math.Vector)

Returns

DrawablePlane

static

Extends: BGE.Image

Used to draw a "infinite" plane in 3d space Ideally used for a ground or floor

Parameters

  • owner (BGE.GameEntity)
  • region (roRegion)
  • plane (BGE.Math.Plane)
  • args (object, optional, default: "{}")

Properties

  • plane (BGE.Math.Plane)

Returns

DrawablePolygon

static

Extends: Drawable

Parameters

  • owner (GameEntity)
  • points (dynamic, optional, default: "[]")
  • args (roAssociativeArray, optional, default: "{}")

Properties

  • points (dynamic) — the set of points defining a convex polygon

Returns

DrawableRectangle

static

Extends: Drawable

Draws a rectangle, filled and/or outlined.

The rectangle's top left corner sits at the drawable's own world position (its offset transformed by the owning entity), extending width to the right and height downwards on screen - the same anchoring an Image uses, so the two are interchangeable.

In the direct (billboard) draw modes - which is what a 2D game gets, since a Camera2d resolves matchCamera to directToCamera - this is a plain axis-aligned rectangle. In the oriented/solid/wireFrame draw modes it becomes a quad that rotates and foreshortens in 3D like any other billboard (see examples/3d's RectanglesRoom).

Set color for the fill and outlineRGBA for the outline (both packed RGB, no alpha byte - alpha is separate). Leaving outlineRGBA unset means no outline at all; set filled = false for an outline-only rectangle.

Parameters

  • owner (GameEntity)
  • width (float)
  • height (float)
  • args (roAssociativeArray, optional, default: "{}")

Properties

  • filled (boolean) — Whether the rectangle's interior is filled with color. Set false for an outline-only ' rectangle, which needs outlineRGBA set too or nothing is drawn at all.

Returns

MIN_TEXT_REGION_SIZE

staticreadonly

Default: 256

DrawableText

static

Extends: Drawable

Class to draw text

Parameters

  • owner (GameEntity)
  • text (string, optional, default: "\"\"")
  • font (roFont, optional, default: "invalid")
  • args (roAssociativeArray, optional, default: "{}")

Properties

  • text (string) — The text to write on the screen
  • font (roFont) — The Font object to use ( get this from the font registry)
  • alignment (BGE.UI.HorizAlignment) — The Horizontal alignment for the text
  • textColor (integer) — The color the text is drawn in
  • lastTextValue (string)
  • lastTextColor (integer)
  • tempCanvas (roBitmap)
  • tempRegion (roRegion)
  • lastAlignment (BGE.UI.HorizAlignment)

Returns

Image

static

Extends: BGE.Drawable

Used to draw a bitmap image to the screen

Parameters

  • owner (BGE.GameEntity)
  • region (roRegion)
  • args (roAssociativeArray, optional, default: "{}")

Properties

  • regionId (string) — An optional unique name for the region, used for caching image data. If not provided, the name of the drawable will be used as the region name.
  • region (roRegion) — ------------Never To Be Manually Changed----------------- ' These values should never need to be manually changed.

Returns

Model3dTexture

static

Parameters

  • srcImage (ifRegion)
  • points (dynamic)

Properties

  • srcImage (ifRegion)
  • points (dynamic)

Returns

Model3dFace

static

Properties

  • vertices (dynamic)
  • normal (BGE.Math.Vector)
  • Texture (Model3dTexture)
  • brightness (float)
  • priority (float)
  • color (integer)

Model3d

static

Parameters

  • faces (dynamic)

Properties

  • faces (dynamic)
  • name (string)

Returns

DrawableModel

static

Extends: Drawable

Parameters

Properties

Returns

AnimationFrameDescription

static

Properties

  • startFrame (integer)
  • frameCount (integer)

SpriteAnimation

static

CReate a new SpriteAnimation

Parameters

  • name (string) — Name of the animation
  • frameList (dynamic) — Wither an array of cell indexes, or an object {startFrame, frameCount}
  • frameRate (integer) — Frames per second the animation should play at
  • playMode (SpritePlayMode, optional, default: "SpritePlayMode.Loop") — Play mode for the sprite: loop, forward, reverse, pingpong

Properties

  • name (string) — Name of the animation
  • frameRate (integer) — Frames per second the animation should play at
  • frameList (dynamic) — Array of the regions of the each cell of this animation
  • playMode (SpritePlayMode) — Play mode for the sprite: loop, forward, reverse, pingpong

Returns

Sprite

static

Extends: AnimatedImage

Parameters

  • owner (GameEntity)
  • spriteSheet (ifDraw2d)
  • cellWidth (integer)
  • cellHeight (integer)
  • args (roAssociativeArray, optional, default: "{}")

Properties

  • spriteSheet (ifDraw2d) — roBitmap to pick cells from
  • cellWidth (integer) — Width of each animation cell in the sprite image in pixels
  • cellHeight (integer) — Height of each animation cell in the sprite image in pixels
  • animations (roAssociativeArray) — Lookup map of animation name -> SpriteAnimation object
  • activeAnimation (SpriteAnimation) — The current animation being played

Returns

RoomChangeInfo

static

Properties

  • room (Room)
  • args (roAssociativeArray)

GarbageCollectionInfo

static

Properties

  • count (integer)
  • orphaned (integer)
  • root (integer)

DebugColors

static

Properties

  • colliders (integer)
  • safe_action_zone (integer)
  • safe_title_zone (integer)

EntityWithId

static

Properties

  • id (dynamic)

PositionXY

static

Properties

  • x (float)
  • y (float)

SizeWH

static

Properties

  • width (float)
  • height (float)

RendererResourceSize

staticreadonly

Default: 400

TriangleDrawThreshold

staticreadonly

Default: 4

TriangleQuickDrawThreshold

staticreadonly

Default: 64

TriangleQuickDrawThresholdForSimulator

staticreadonly

Default: 32

LevelOfDetailOptions

static

Properties

  • levelOffset (integer)
  • levelOfDetail (integer)

RendererOptions

static

Properties

  • useBitmapPooling (boolean)

Renderer

static

Wrapper for Draw2D calls, so that we can keep track of how much is being drawn per frame

Parameters

  • draw2d (ifDraw2d)
  • mainGame (BGE.Game, optional, default: "invalid")
  • cam (BGE.Camera, optional, default: "invalid")
  • options (RendererOptions, optional, default: "{useBitmapPooling: true}")

Properties

  • nextSceneObjectId (integer)
  • minimumFrameRateTarget (integer) — Frame rate target - the game will reduce quality if this target is not met
  • onlyDrawWhenInFrame (boolean)
  • drawDebugCells (boolean)
  • drawDebugTrianglePoints (boolean)
  • camera (Camera)
  • triangleCache (dynamic)
  • frameCount (integer)
  • bmpPool (BGE.ScratchBitmapPool)
  • game (BGE.Game)
  • name (string)
  • statsString (string)
  • resources (dynamic)
  • dummyScreen (roScreen)

Returns

DrawPinnedCornersOptions

static

Properties

  • splitIntoFour (boolean)
  • alwaysUseTLtoBR (boolean)

ScratchBitmap

static

Parameters

  • id (string)
  • w (integer)
  • h (integer)

Properties

  • bitmap (roBitmap)
  • id (string)

Returns

ScratchRegion

static

Parameters

Properties

Returns

ScratchBitmapPool

static

Parameters

  • doPooling (boolean, optional, default: true)
  • initialCount (integer, optional, default: 10)

Returns

TriangleCacheEntry

static

Parameters

  • triangle (BGE.RendererHelpers.TriangleBitmap)

Properties

  • triangle (BGE.RendererHelpers.TriangleBitmap)
  • timeLastUsed (integer)

Returns

TriangleCache

static

Parameters

  • cacheKeepSeconds (integer, optional, default: 60)

Returns

Camera

static

Properties

  • orientation (dynamic) — A vector pointed in the direction of the camera
  • position (BGE.Math.Vector)
  • motionChecker (MotionChecker)
  • frameSize (BGE.Math.Vector)
  • projectionVersion (integer) — Bumped whenever something about the camera's projection - as opposed to its ' position or orientation - changes. MotionChecker watches only position and ' orientation, so without this a frame-size or field-of-view change is invisible to ' every dirty check in the renderer, and a stationary culled object stays culled ' through a projection change that should have brought it back into view.
  • zoom (float) — TODO: do something with zoom!
  • worldToCamera (dynamic)
  • name (string)

Returns

Camera2d

static

Extends: Camera

Properties

  • top (float)
  • bottom (float)
  • right (float)
  • left (float)
  • near (float)
  • far (float)
  • name (string)

CameraFrustumNormals

static

Properties

  • top (BGE.Math.Vector)
  • bottom (BGE.Math.Vector)
  • left (BGE.Math.Vector)
  • right (BGE.Math.Vector)
  • near (BGE.Math.Vector)

CameraFrustumRays

static

Properties

  • topLeft (BGE.Math.Ray)
  • topRight (BGE.Math.Ray)
  • bottomLeft (BGE.Math.Ray)
  • bottomRight (BGE.Math.Ray)

Camera3d

static

Extends: Camera

Properties

MAX_DRAW_MODE

staticreadonly

Default: 8

SceneObject

static

Parameters

Properties

  • name (string)
  • id (string) — Unique Id
  • drawable (Drawable)
  • type (SceneObjectType)
  • negDistanceFromCamera (float) — The negative distance from the camera, used for depth sorting
  • worldPosition (dynamic)
  • transformationMatrix (dynamic) — The Current Transformation Matrix
  • lastFrameWasCulled (boolean) — Whether the last frame's draw was skipped because the frustum rejected this object. ' Only a genuine cull latches: nothing moved, so re-running the check would give the ' same answer, and skipping it is what makes a static off-screen object free. A draw ' that was attempted and failed must not latch - findCanvasPosition() and ' performDraw() both already retry on the following frame, and treating their failure ' as a cull is what made one bad frame permanent. See issue #48.
  • lastFrameDidDraw (boolean) — Whether the last frame's draw actually happened. Distinct from lastFrameWasCulled ' because a frame has three possible outcomes, not two: drew, was culled by the ' frustum, or entered the draw path and failed. Only a cull may latch; a failure must ' retry; and the failure state is also what makes the frustum check reachable, which ' is what puts an object into the culled state in the first place.
  • hasValidWorldPosition (boolean)
  • hasValidCanvasPosition (boolean)
  • wasEnabledLastFrame (boolean)
  • isFirstFrameSinceEnabled (boolean)
  • isLowEndDevice (boolean)
  • lastGeometryVersion (integer) — The drawable's geometryVersion as of the last completed draw - see geometryChanged()
  • lastDrawMode (integer) — The draw mode this object last drew in - see drawModeChanged()
  • lastProjectionVersion (integer) — The camera's projectionVersion as of the last draw - see projectionChanged()

Returns

TransformTempBitmapDetails

static

Properties

  • origin (BGE.Math.Vector)
  • rotation (float)
  • scaleX (float)
  • scaleY (float)

TempBitmapDrawResult

static

Properties

  • worked (boolean)
  • didFastDraw (boolean)

SceneObjectBillboard

static

Extends: SceneObject

Parameters

Properties

  • worldPoints (BGE.Math.CornerPoints)
  • canvasPoints (BGE.Math.CornerPoints)
  • canvasPosition (BGE.Math.Vector)
  • useTempBitmapMap (dynamic)

Returns

SceneObjectImage

static

Extends: SceneObjectBillboard

Parameters

  • name (string)
  • drawableObj (Image)

Properties

  • drawable (Image)
  • frameNumber (integer)

Returns

SceneObjectLine

static

Extends: SceneObject

Parameters

Properties

Returns

SceneObjectModel

static

Extends: SceneObjectBillboard

Parameters

Properties

Returns

PerspectiveCalculationResult

static

Properties

  • actual (BGE.Math.CornerPoints)
  • mapped (BGE.Math.CornerPoints)
  • horizon (dynamic)

PerspectiveSlice

static

Properties

  • srcWidth (float)
  • srcHeight (float)
  • srcTopLeft (BGE.PositionXY)
  • destHeight (float)
  • scaleX (float)
  • scaleY (float)

SCENE_OBJECT_PLANE_NEAR_DISTANCE

staticreadonly

Default: 0

SCENE_OBJECT_PLANE_FAR_DISTANCE

staticreadonly

Default: 512

SCENE_OBJECT_PLANE_SLICE_COUNT

staticreadonly

Default: 50

SceneObjectPlane

static

Extends: SceneObject

Parameters

Properties

Returns

SceneObjectPolygon

static

Extends: SceneObjectBillboard

Parameters

Properties

Returns

SceneObjectRectangle

static

Extends: SceneObjectBillboard

Draws a DrawableRectangle. Extends SceneObjectBillboard, so a rectangle orients and foreshortens in 3D in the oriented draw modes and stays screen-aligned in the direct ones, exactly like an image does.

Unlike an image, though, a rectangle has no texture to sample: it's a single flat color. So it never needs the inherited pinned-corners path - filling the projected quad produces identical pixels for far less work, and DrawableRectangle never has to hold a bitmap of its own. This is how SceneObjectPolygon draws, for the same reason.

It does still cache that fill into a temp bitmap in the oriented draw modes, exactly like a polygon: filling a rotated quad means rasterizing two triangles through scratch bitmaps, which is far too expensive to repeat every frame for an object that hasn't moved. In the direct (billboard) draw modes there's nothing worth caching - the draw is already a single DrawRect - so those skip the temp bitmap entirely.

Parameters

Properties

Returns

SceneObjectText

static

Extends: SceneObjectBillboard

Parameters

Properties

Returns

MotionChecker

static

Properties

  • previousTransform (dynamic)
  • movedLastFrame (boolean)

SomeConst

staticreadonly

Default: 23

TagList

static

Returns