Image

Extends: BGE.Drawable

Used to draw a bitmap image to the screen

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.

Constructor

new Image( owner: BGE.GameEntity, region: roRegion, args?: roAssociativeArray, ): Image

Parameters

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

Instance Methods

getPretranslation(): BGE.Math.Vector

Returns

  • BGE.Math.Vector

setAnchor(x: float, y: float): void

Parameters

  • x (float)
  • y (float)

Returns

  • void

applyAnchorToRegion(): void

protected

Pushes the anchor-derived pretranslation onto the region so Roku's own DrawObject/ DrawScaledObject picks it up natively in the plain 2D draw path - see getPretranslation(), which reads it straight back off the region.

Returns

  • void

addToScene(rendererObj: Renderer): BGE.SceneObject

Parameters

Returns

addToScene(rendererObj: Renderer): BGE.SceneObject

Inherited from BGE.Image#addToScene

Overrides: BGE.Drawable#addToScene

Adds the Drawable object to the given render scene.

Parameters

Returns

getSceneObjects(): dynamic

Inherited from BGE.Drawable#getSceneObjects

Overrides: BGE.Drawable#getSceneObjects

Every SceneObject this Drawable currently represents - usually one (a Drawable added to just the game canvas), but can be more than one if the same Drawable instance was also added to a second renderer (e.g. the UI canvas). Useful for consumer code that needs to identify "my own" SceneObject out of a list the renderer hands back (e.g. Renderer.getOverlapClusters()) - comparing two custom class instances directly with = is not supported by BrightScript at runtime (a "Type Mismatch" error, regardless of any as-cast at the BrighterScript type- checker level, which only affects compile-time typing, not the underlying VM operator), so compare SceneObject.id (a string) instead.

Returns

  • dynamic

removeFromScene(rendererScene: Renderer): void

Inherited from BGE.Drawable#removeFromScene

Overrides: BGE.Drawable#removeFromScene

Parameters

Returns

  • void

computeTransformationMatrix(): void

Inherited from BGE.Drawable#computeTransformationMatrix

Overrides: BGE.Drawable#computeTransformationMatrix

Returns

  • void

invalidateGeometry(): void

Inherited from BGE.Drawable#invalidateGeometry

Overrides: BGE.Drawable#invalidateGeometry

Marks this drawable's geometry as changed, so the renderer recomputes its world and canvas geometry on the next frame. Movement is dirty-checked automatically (see MotionChecker), but a change in shape - resizing a rectangle, replacing a polygon's points - isn't visible to that check and has to be declared.

Returns

  • void

getAnchor(): BGE.Math.Vector

Inherited from BGE.Drawable#getAnchor

Overrides: BGE.Drawable#getAnchor

Returns

  • BGE.Math.Vector

setAnchor(x: float, y: float): void

Inherited from BGE.Image#setAnchor

Overrides: BGE.Drawable#setAnchor

Sets the normalized anchor point this drawable pivots around. (0,0) is top left (the default), (0.5, 1) is bottom-center, etc. This isn't movement, so it can't be picked up by the per-frame MotionChecker dirty-check - invalidateGeometry() tells the renderer to recompute this drawable's projected geometry even though nothing moved.

Parameters

  • x (float)
  • y (float)

Returns

  • void

movedLastFrame(includeOwner?: boolean): boolean

Inherited from BGE.Drawable#movedLastFrame

Overrides: BGE.Drawable#movedLastFrame

Parameters

  • includeOwner (boolean, optional, default: false)

Returns

  • boolean

update(): void

Inherited from BGE.Drawable#update

Overrides: BGE.Drawable#update

Returns

  • void

onResume(pausedTimeMs: integer): void

Inherited from BGE.Drawable#onResume

Overrides: BGE.Drawable#onResume

Parameters

  • pausedTimeMs (integer)

Returns

  • void

isEnabled(): boolean

Inherited from BGE.Drawable#isEnabled

Overrides: BGE.Drawable#isEnabled

Returns

  • boolean

getSize(): SizeWH

Inherited from BGE.Drawable#getSize

Overrides: BGE.Drawable#getSize

Returns

getDrawnSize(): SizeWH

Inherited from BGE.Drawable#getDrawnSize

Overrides: BGE.Drawable#getDrawnSize

Returns

getWorldPosition(): BGE.Math.Vector

Inherited from BGE.Drawable#getWorldPosition

Overrides: BGE.Drawable#getWorldPosition

Returns

  • BGE.Math.Vector

getPretranslation(): BGE.Math.Vector

Inherited from BGE.Image#getPretranslation

Overrides: BGE.Drawable#getPretranslation

Returns

  • BGE.Math.Vector

getFillColorRGBA(ignoreColor?: boolean): integer

Inherited from BGE.Drawable#getFillColorRGBA

Overrides: BGE.Drawable#getFillColorRGBA

Parameters

  • ignoreColor (boolean, optional, default: false)

Returns

  • integer

getOutlineColorRGBA(ignoreColor?: boolean): integer

Inherited from BGE.Drawable#getOutlineColorRGBA

Overrides: BGE.Drawable#getOutlineColorRGBA

Parameters

  • ignoreColor (boolean, optional, default: false)

Returns

  • integer

hasOutline(): boolean

Inherited from BGE.Drawable#hasOutline

Overrides: BGE.Drawable#hasOutline

Whether this drawable should be stroked with an outline, which is the case once outlineRGBA has been given a color. Setting outlineRGBA is what turns outline drawing on - there is no separate flag - so this is the check the renderer uses to skip all outline work for the (common) drawables that don't want one.

Returns

  • boolean — true if an outline should be drawn for this drawable

getSceneObjectName(extraBit?: string): string

protected

Inherited from BGE.Drawable#getSceneObjectName

Overrides: BGE.Drawable#getSceneObjectName

Parameters

  • extraBit (string, optional, default: "\"\"")

Returns

  • string

addSceneObjectToRenderer( sceneObj: SceneObject, renderScene: Renderer, ): SceneObject

protected

Inherited from BGE.Drawable#addSceneObjectToRenderer

Overrides: BGE.Drawable#addSceneObjectToRenderer

Parameters

Returns

drawRegionToCanvas( region: ifDraw2d, additionalRotation?: BGE.Math.Vector, ignoreColor?: boolean, drawTo?: ifDraw2D, ): void

protected

Inherited from BGE.Drawable#drawRegionToCanvas

Overrides: BGE.Drawable#drawRegionToCanvas

Parameters

  • region (ifDraw2d)
  • additionalRotation (BGE.Math.Vector, optional, default: "invalid")
  • ignoreColor (boolean, optional, default: false)
  • drawTo (ifDraw2D, optional, default: "invalid")

Returns

  • void

forEachSceneObject( operation: function, context: roAssociativeArray, ): void

Inherited from BGE.Drawable#forEachSceneObject

Overrides: BGE.Drawable#forEachSceneObject

Parameters

  • operation (function)
  • context (roAssociativeArray)

Returns

  • void

isOnScreen(): boolean

Inherited from BGE.Drawable#isOnScreen

Overrides: BGE.Drawable#isOnScreen

Whether this drawable was actually drawn (not culled) in at least one of the renderers it's registered with, as of the last frame. True before this has ever been added to a renderer (nothing to say it's off-screen yet), so game code can use this to skip expensive per-frame work for an off-screen entity without it defaulting to "invisible" before the first frame ever draws. See GameEntity.isOnScreen() and issue #75.

Returns

  • boolean

addToScene(rendererObj: Renderer): BGE.SceneObject

Inherited from BGE.Image#addToScene

Overrides: BGE.Drawable#addToScene

Adds the Drawable object to the given render scene.

Parameters

Returns

setAnchor(x: float, y: float): void

Inherited from BGE.Image#setAnchor

Overrides: BGE.Drawable#setAnchor

Sets the normalized anchor point this drawable pivots around. (0,0) is top left (the default), (0.5, 1) is bottom-center, etc. This isn't movement, so it can't be picked up by the per-frame MotionChecker dirty-check - invalidateGeometry() tells the renderer to recompute this drawable's projected geometry even though nothing moved.

Parameters

  • x (float)
  • y (float)

Returns

  • void

getPretranslation(): BGE.Math.Vector

Inherited from BGE.Image#getPretranslation

Overrides: BGE.Drawable#getPretranslation

Returns

  • BGE.Math.Vector