Events

@:dox(show)observedDirty(instance:Screen, fromSerializedField:Bool):Void

Event when any observable value as changed on this instance.

@:dox(show)focusedVisualChange(current:Visual, previous:Visual):Void

Event when focusedVisual field changes.

@:dox(show)texturesDensityChange(current:Float, previous:Float):Void

Event when texturesDensity field changes.

@:dox(show)resize():Void

Resize event occurs once at startup, then each time any of native width, height or density changes.

@:dox(show)mouseDown(buttonId:Int, x:Float, y:Float):Void

@:dox(show)mouseUp(buttonId:Int, x:Float, y:Float):Void

@:dox(show)mouseWheel(x:Float, y:Float):Void

@:dox(show)mouseMove(x:Float, y:Float):Void

@:dox(show)touchDown(touchIndex:Int, x:Float, y:Float):Void

@:dox(show)touchUp(touchIndex:Int, x:Float, y:Float):Void

@:dox(show)touchMove(touchIndex:Int, x:Float, y:Float):Void

@:dox(show)pointerDown(info:TouchInfo):Void

@:dox(show)pointerUp(info:TouchInfo):Void

@:dox(show)pointerMove(info:TouchInfo):Void

@:dox(show)focus(visual:Visual):Void

@:dox(show)blur(visual:Visual):Void

Variables

@:value(false)observedDirty:Bool = false

Default is false, automatically set to true when any of this instance's observable variables has changed.

@:value(1.0)read onlydensity:Float = 1.0

Screen density computed from app's logical width/height settings and native width/height.

@:value(0)read onlywidth:Float = 0

Logical width used in app to position elements. Updated when the screen is resized.

@:value(0)read onlyheight:Float = 0

Logical height used in app to position elements. Updated when the screen is resized.

@:value(0)read onlyactualWidth:Float = 0

The actual width available on screen, including offsets, in the same unit as width. Updated when the screen is resized.

@:value(0)read onlyactualHeight:Float = 0

The actual height available on screen, including offsets, in the same unit as width. Updated when the screen is resized.

@:value(0)read onlyoffsetX:Float = 0

Logical x offset. Updated when the screen is resized.

@:value(0)read onlyoffsetY:Float = 0

Logical y offset. Updated when the screen is resized.

read onlynativeWidth:Float

Native width

read onlynativeHeight:Float

Native height

read onlynativeDensity:Float

Native pixel ratio/density.

@:value(0)read onlypointerX:Float = 0

Pointer x coordinate, computed from mouse and touch events. When using multiple touch inputs at the same time, x will be the mean value of all touches x value. Use this as a convenience when you don't want to deal with multiple positions.

@:value(0)read onlypointerY:Float = 0

Pointer y coordinate, computed from mouse and touch events. When using multiple touch inputs at the same time, y will be the mean value of all touches y value. Use this as a convenience when you don't want to deal with multiple positions.

@:value(0)read onlypointerDeltaX:Float = 0

Pointer x delta since last frame

@:value(0)read onlypointerDeltaY:Float = 0

Pointer y delta since last frame

@:value(0)read onlymouseX:Float = 0

Mouse x coordinate, computed from mouse events.

@:value(0)read onlymouseY:Float = 0

Mouse y coordinate, computed from mouse events.

@:value(0)read onlymouseDeltaX:Float = 0

Mouse x delta since last frame

@:value(0)read onlymouseDeltaY:Float = 0

Mouse y delta since last frame

@:value(0)read onlymouseWheelDeltaX:Float = 0

Mouse wheel x delta since last frame

@:value(0)read onlymouseWheelDeltaY:Float = 0

Mouse wheel y delta since last frame

@:value(new Touches())read onlytouches:Touches = new Touches()

Touches x and y coordinates by touch index.

@:value(null)@observefocusedVisual:Visual = null

Focused visual

@:value(1.0)@observetexturesDensity:Float = 1.0

Ideal textures density, computed from settings targetDensity and current screen state.

read onlyisPointerDown:Bool

Whether the screen is between a pointer down and an pointer up event or not.

Methods

inlinemouseAllowed(owner:Entity):Bool

Return true if mouse events are currently allowed for the given owner. This is only useful on very specific cases.

inlinemousePressed(buttonId:Int):Bool

inlinemousePressed(buttonId:Int, owner:Entity):Bool

inlinemouseJustPressed(buttonId:Int):Bool

inlinemouseJustPressed(buttonId:Int, owner:Entity):Bool

inlinemouseJustReleased(buttonId:Int):Bool

inlinemouseJustReleased(buttonId:Int, owner:Entity):Bool

inlinetouchPressed(touchIndex:Int):Bool

inlinetouchPressed(touchIndex:Int, owner:Entity):Bool

inlinetouchJustPressed(touchIndex:Int):Bool

inlinetouchJustPressed(touchIndex:Int, owner:Entity):Bool

inlinetouchJustReleased(touchIndex:Int):Bool

inlinetouchJustReleased(touchIndex:Int, owner:Entity):Bool

touchDeltaX(touchIndex:Int):Float

touchDeltaY(touchIndex:Int):Float

toTexture(done:(texture:Texture) ‑> Void):Void

toPixels(done:(pixels:UInt8Array, width:Int, height:Int) ‑> Void):Void

inlinetoPng(done:(data:Bytes) ‑> Void):Void

inlinetoPng(path:String, done:() ‑> Void):Void

Inherited Events

Defined by Entity

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by Entity

read onlyhasData:Bool

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

@editablecomponents:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by Entity

destroy():Void

Destroy this entity. This method is automatically protected from duplicate calls. That means calling multiple times an entity's destroy() method will run the destroy code only one time. As soon as destroy() is called, the entity is marked destroyed=true, even when calling destroy() method on a subclass (a macro is inserting a code to mark the object as destroyed at the beginning of every destroy() override function.

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

component<C>(?name:String, ?component:Null<C>):C