Captures a screen grab of the game and stores it locally, optionally saving as a PNG.

@link http://www.photonstorm.com @author Richard Davey / Photon Storm

Constructor

new()

Methods

Static variables

staticread onlyscreenshot:Bitmap

Static methods

staticclearCaptureRegion():Void

Clears a previously defined capture region

staticclearHotKeys():Void

Clears all previously defined hotkeys

staticdefineCaptureRegion(X:Int, Y:Int, Width:Int, Height:Int):Void

Defines the region of the screen that should be captured. If you need it to be a fixed location then use this. If you want to grab the whole SWF size, you don't need to set this as that is the default. Remember that if your game is running in a zoom mode > 1 you need to account for this here.

Parameters:

X

The x coordinate (in Flash display space, not Flixel game world)

Y

The y coordinate (in Flash display space, not Flixel game world)

Width

The width of the grab region

Height

The height of the grab region

@:value({ HideMouse : false, SaveToFile : false })staticdefineHotKeys(Keys:Array<FlxKey>, SaveToFile:Bool = false, HideMouse:Bool = false):Void

Specify which key will capture a screen shot. Use the String value of the key in the same way FlxG.keys does (so "F1" for example) Optionally save the image to a file immediately. This uses the file systems "Save as" dialog window and pauses your game during the process.

Parameters:

Key

The key(s) you press to capture the screen (i.e. [F1, SPACE])

SaveToFile

If true it will immediately encodes the grab to a PNG and open a "Save As" dialog window when the hotkey is pressed

HideMouse

If true the mouse will be hidden before capture and displayed afterwards when the hotkey is pressed

@:value({ HideMouse : false, SaveToFile : false })staticgrab(?CaptureRegion:Rectangle, SaveToFile:Bool = false, HideMouse:Bool = false):Bitmap

Takes a screen grab immediately of the given region or a previously defined region

Parameters:

CaptureRegion

A Rectangle area to capture. This over-rides that set by "defineCaptureRegion". If neither are set the full SWF size is used.

SaveToFile

Boolean If set to true it will immediately encode the grab to a PNG and open a "Save As" dialog window

HideMouse

Boolean If set to true the mouse will be hidden before capture and displayed again afterwards

Returns:

Bitmap The screen grab as a Flash Bitmap image

Inherited Variables

Defined by FlxBasic

@:value(-1)ID:Int = -1

IDs seem like they could be pretty useful, huh? They're not actually used for anything yet though.

@:value(true)active:Bool = true

Controls whether update() is automatically called by FlxState/FlxGroup.

@:value(true)alive:Bool = true

Useful state for many game objects - "dead" (!alive) vs alive. kill() and revive() both flip this switch (along with exists, but you can override that).

camera:FlxCamera

Gets ot sets the first camera of this object.

cameras:Array<FlxCamera>

This determines on which FlxCameras this object will be drawn. If it is null / has not been set, it uses FlxCamera.defaultCameras, which is a reference to FlxG.cameras.list (all cameras) by default.

@:value(true)exists:Bool = true

Controls whether update() and draw() are automatically called by FlxState/FlxGroup.

@:value(true)visible:Bool = true

Controls whether draw() is automatically called by FlxState/FlxGroup.

Inherited Methods

Defined by FlxBasic

draw():Void

Override this function to control how the object is drawn. Doing so is rarely necessary, but can be very useful.

kill():Void

Handy function for "killing" game objects. Use reset() to revive them. Default behavior is to flag them as nonexistent AND dead. However, if you want the "corpse" to remain in the game, like to animate an effect or whatever, you should override this, setting only alive to false, and leaving exists true.

revive():Void

Handy function for bringing game objects "back to life". Just sets alive and exists back to true. In practice, this function is most often called by FlxObject#reset().