C# Class flxSharp.flxSharp.FlxCamera

The camera class is used to display the game's visuals in the Flash player. By default one camera is created automatically, that is the same size as the Flash player. You can add more cameras or even replace the main camera using utilities in FlxG.
Inheritance: FlxBasic
Afficher le fichier Open project: jlorek/flxSharp Class Usage Examples

Méthodes publiques

Свойство Type Description
BgColor Color
Bounds FlxRect
Buffer Microsoft.Xna.Framework.Graphics.RenderTarget2D
Deadzone FlxRect
DefaultZoom float
FlashOffsetX float
FlashOffsetY float
FlashSprite FlxObject
Scroll FlxPoint
Target FlxObject
screen FlxSprite
transform Matrix

Protected Properties

Свойство Type Description
_color Color
_point FlxPoint
_zoom float
fxFadeAlpha float
fxFadeColor Color
fxFadeComplete System.Action
fxFadeDuration float
fxFlashAlpha float
fxFlashColor Color
fxFlashComplete System.Action
fxFlashDuration float
fxShakeComplete System.Action
fxShakeDirection uint
fxShakeDuration float
fxShakeIntensity float
fxShakeOffset FlxPoint

Private Properties

Свойство Type Description
UpdateHelpers void
drawFX void

Méthodes publiques

Méthode Description
Fade ( Color color, float duration = 1, System.Action onComplete = null, bool force = false ) : void

The screen is gradually filled with this color.

Fill ( Color color, bool blendAlpha = true ) : void

Fill the camera with the specified color.

Flash ( Color color, float duration = 1, System.Action onComplete = null, bool force = false ) : void

The screen is filled with this color and gradually returns to normal.

FlxCamera ( float x, float y, int width, int height, float zoom ) : System

Instantiates a new camera at the specified location, with the specified size and zoom level.

copyFrom ( FlxCamera camera ) : FlxCamera

Copy the bounds, focus object, and deadzone info from an existing camera.

destroy ( ) : void

Clean up memory.

focusOn ( FlxPoint point ) : void

Move the camera focus to this location instantly.

follow ( FlxObject target, uint style = StyleLockon ) : void

Tells this camera object what FlxObject to track.

getContainerSprite ( ) : object

Fetches a reference to the Flash Sprite object that contains the camera display in the Flash display list. Uses include 3D projection, advanced display list modification, and more. NOTE: We don't recommend modifying this directly unless you are fairly experienced. For simple changes to the camera display, like scaling, rotation, and color tinting, we recommend using the existing FlxCamera variables.

setBounds ( float x, float y, float width, float height, System.Boolean updateWorld = false ) : void

Specify the boundaries of the level or where the camera is allowed to move.

shake ( float intensity = 0.05f, float duration = 0.5f, System.Action onComplete = null, bool force = true, uint direction = ShakeBothAxes ) : void

A simple screen-shake effect.

stopFX ( ) : void

Just turns off all the camera effects instantly.

update ( ) : void

Updates the camera scroll as well as special effects like screen-shake or fades.

Private Methods

Méthode Description
UpdateHelpers ( ) : void
drawFX ( ) : void

Internal helper function, handles the actual drawing of all the special effects.

Method Details

Fade() public méthode

The screen is gradually filled with this color.
public Fade ( Color color, float duration = 1, System.Action onComplete = null, bool force = false ) : void
color Color The color you want to use.
duration float How long it takes for the fade to finish.
onComplete System.Action A function you want to run when the fade finishes.
force bool Force the effect to reset.
Résultat void

Fill() public méthode

Fill the camera with the specified color.
public Fill ( Color color, bool blendAlpha = true ) : void
color Color The color to fill with in 0xAARRGGBB hex format.
blendAlpha bool Whether to blend the alpha value or just wipe the previous contents. Default is true.
Résultat void

Flash() public méthode

The screen is filled with this color and gradually returns to normal.
public Flash ( Color color, float duration = 1, System.Action onComplete = null, bool force = false ) : void
color Color The color you want to use.
duration float How long it takes for the flash to fade.
onComplete System.Action A function you want to run when the flash finishes.
force bool Force the effect to reset.
Résultat void

FlxCamera() public méthode

Instantiates a new camera at the specified location, with the specified size and zoom level.
public FlxCamera ( float x, float y, int width, int height, float zoom ) : System
x float X location of the camera's display in pixels. Uses native, 1:1 resolution, ignores zoom.
y float Y location of the camera's display in pixels. Uses native, 1:1 resolution, ignores zoom.
width int The width of the camera display in pixels.
height int The height of the camera display in pixels.
zoom float The initial zoom level of the camera. A zoom level of 2 will make all pixels display at 2x resolution.
Résultat System

copyFrom() public méthode

Copy the bounds, focus object, and deadzone info from an existing camera.
public copyFrom ( FlxCamera camera ) : FlxCamera
camera FlxCamera The camera you want to copy from.
Résultat FlxCamera

destroy() public méthode

Clean up memory.
public destroy ( ) : void
Résultat void

focusOn() public méthode

Move the camera focus to this location instantly.
public focusOn ( FlxPoint point ) : void
point FlxPoint Where you want the camera to focus.
Résultat void

follow() public méthode

Tells this camera object what FlxObject to track.
public follow ( FlxObject target, uint style = StyleLockon ) : void
target FlxObject The object you want the camera to track. Set to null to not follow anything.
style uint Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
Résultat void

getContainerSprite() public méthode

Fetches a reference to the Flash Sprite object that contains the camera display in the Flash display list. Uses include 3D projection, advanced display list modification, and more. NOTE: We don't recommend modifying this directly unless you are fairly experienced. For simple changes to the camera display, like scaling, rotation, and color tinting, we recommend using the existing FlxCamera variables.
public getContainerSprite ( ) : object
Résultat object

setBounds() public méthode

Specify the boundaries of the level or where the camera is allowed to move.
public setBounds ( float x, float y, float width, float height, System.Boolean updateWorld = false ) : void
x float The smallest X value of your level (usually 0).
y float The smallest Y value of your level (usually 0).
width float The largest X value of your level (usually the level width).
height float The largest Y value of your level (usually the level height).
updateWorld System.Boolean Whether the global quad-tree's dimensions should be updated to match (default: false).
Résultat void

shake() public méthode

A simple screen-shake effect.
public shake ( float intensity = 0.05f, float duration = 0.5f, System.Action onComplete = null, bool force = true, uint direction = ShakeBothAxes ) : void
intensity float Percentage of screen size representing the maximum distance that the screen can move while shaking.
duration float The length in seconds that the shaking effect should last.
onComplete System.Action A function you want to run when the shake effect finishes.
force bool Force the effect to reset (default = true, unlike flash() and fade()!).
direction uint Whether to shake on both axes, just up and down, or just side to side (use class constants SHAKE_BOTH_AXES, SHAKE_VERTICAL_ONLY, or SHAKE_HORIZONTAL_ONLY).
Résultat void

stopFX() public méthode

Just turns off all the camera effects instantly.
public stopFX ( ) : void
Résultat void

update() public méthode

Updates the camera scroll as well as special effects like screen-shake or fades.
public update ( ) : void
Résultat void

Property Details

BgColor public_oe property

The natural background color of the camera. Defaults to FlxG.bgColor. NOTE: can be transparent for crazy FX!
public Color BgColor
Résultat Color

Bounds public_oe property

The edges of the camera's range, i.e. where to stop scrolling. Measured in game pixels and world coordinates.
public FlxRect,flxSharp.flxSharp Bounds
Résultat FlxRect

Buffer public_oe property

The actual bitmap data of the camera display itself.
public RenderTarget2D,Microsoft.Xna.Framework.Graphics Buffer
Résultat Microsoft.Xna.Framework.Graphics.RenderTarget2D

Deadzone public_oe property

You can assign a "dead zone" to the camera in order to better control its movement. The camera will always keep the focus object inside the dead zone, unless it is bumping up against the bounds rectangle's edges. The deadzone's coordinates are measured from the camera's upper left corner in game pixels. For rapid prototyping, you can use the preset deadzones (e.g. STYLE_PLATFORMER) with follow().
public FlxRect,flxSharp.flxSharp Deadzone
Résultat FlxRect

DefaultZoom public_oe static_oe property

While you can alter the zoom of each camera after the fact, this variable determines what value the camera will start at when created.
public static float DefaultZoom
Résultat float

FlashOffsetX public_oe property

public float FlashOffsetX
Résultat float

FlashOffsetY public_oe property

public float FlashOffsetY
Résultat float

FlashSprite public_oe property

public FlxObject,flxSharp.flxSharp FlashSprite
Résultat FlxObject

Scroll public_oe property

Stores the basic parallax scrolling values.
public FlxPoint,flxSharp.flxSharp Scroll
Résultat FlxPoint

Target public_oe property

Tells the camera to follow this FlxObject object around.
public FlxObject,flxSharp.flxSharp Target
Résultat FlxObject

_color protected_oe property

Internal, help with color transforming the flash bitmap.
protected Color _color
Résultat Color

_point protected_oe property

Internal, to help avoid costly allocations.
protected FlxPoint,flxSharp.flxSharp _point
Résultat FlxPoint

_zoom protected_oe property

Indicates how far the camera is zoomed in.
protected float _zoom
Résultat float

fxFadeAlpha protected_oe property

Internal, used to control the "fade" special effect.
protected float fxFadeAlpha
Résultat float

fxFadeColor protected_oe property

Internal, used to control the "fade" special effect.
protected Color fxFadeColor
Résultat Color

fxFadeComplete protected_oe property

Internal, used to control the "fade" special effect.
protected Action,System fxFadeComplete
Résultat System.Action

fxFadeDuration protected_oe property

Internal, used to control the "fade" special effect.
protected float fxFadeDuration
Résultat float

fxFlashAlpha protected_oe property

Internal, used to control the "flash" special effect.
protected float fxFlashAlpha
Résultat float

fxFlashColor protected_oe property

Internal, used to control the "flash" special effect.
protected Color fxFlashColor
Résultat Color

fxFlashComplete protected_oe property

Internal, used to control the "flash" special effect.
protected Action,System fxFlashComplete
Résultat System.Action

fxFlashDuration protected_oe property

Internal, used to control the "flash" special effect.
protected float fxFlashDuration
Résultat float

fxShakeComplete protected_oe property

Internal, used to control the "shake" special effect.
protected Action,System fxShakeComplete
Résultat System.Action

fxShakeDirection protected_oe property

Internal, used to control the "shake" special effect.
protected uint fxShakeDirection
Résultat uint

fxShakeDuration protected_oe property

Internal, used to control the "shake" special effect.
protected float fxShakeDuration
Résultat float

fxShakeIntensity protected_oe property

Internal, used to control the "shake" special effect.
protected float fxShakeIntensity
Résultat float

fxShakeOffset protected_oe property

Internal, used to control the "shake" special effect.
protected FlxPoint,flxSharp.flxSharp fxShakeOffset
Résultat FlxPoint

screen public_oe property

Sometimes it's easier to just work with a FlxSprite than it is to work directly with the BitmapData buffer. This sprite reference will allow you to do exactly that.
public FlxSprite,flxSharp.flxSharp screen
Résultat FlxSprite

transform public_oe property

public Matrix transform
Résultat Matrix