C# Класс 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.
Наследование: FlxBasic
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
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)

Свойство Тип Описание
_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

Свойство Тип Описание
UpdateHelpers void
drawFX void

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
UpdateHelpers ( ) : void
drawFX ( ) : void

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

Описание методов

Fade() публичный Метод

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.
Результат void

Fill() публичный Метод

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.
Результат void

Flash() публичный Метод

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.
Результат void

FlxCamera() публичный Метод

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.
Результат System

copyFrom() публичный Метод

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.
Результат FlxCamera

destroy() публичный Метод

Clean up memory.
public destroy ( ) : void
Результат void

focusOn() публичный Метод

Move the camera focus to this location instantly.
public focusOn ( FlxPoint point ) : void
point FlxPoint Where you want the camera to focus.
Результат void

follow() публичный Метод

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().
Результат void

getContainerSprite() публичный Метод

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
Результат object

setBounds() публичный Метод

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).
Результат void

shake() публичный Метод

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).
Результат void

stopFX() публичный Метод

Just turns off all the camera effects instantly.
public stopFX ( ) : void
Результат void

update() публичный Метод

Updates the camera scroll as well as special effects like screen-shake or fades.
public update ( ) : void
Результат void

Описание свойств

BgColor публичное свойство

The natural background color of the camera. Defaults to FlxG.bgColor. NOTE: can be transparent for crazy FX!
public Color BgColor
Результат Color

Bounds публичное свойство

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
Результат FlxRect

Buffer публичное свойство

The actual bitmap data of the camera display itself.
public RenderTarget2D,Microsoft.Xna.Framework.Graphics Buffer
Результат Microsoft.Xna.Framework.Graphics.RenderTarget2D

Deadzone публичное свойство

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
Результат FlxRect

DefaultZoom публичное статическое свойство

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
Результат float

FlashOffsetX публичное свойство

public float FlashOffsetX
Результат float

FlashOffsetY публичное свойство

public float FlashOffsetY
Результат float

FlashSprite публичное свойство

public FlxObject,flxSharp.flxSharp FlashSprite
Результат FlxObject

Scroll публичное свойство

Stores the basic parallax scrolling values.
public FlxPoint,flxSharp.flxSharp Scroll
Результат FlxPoint

Target публичное свойство

Tells the camera to follow this FlxObject object around.
public FlxObject,flxSharp.flxSharp Target
Результат FlxObject

_color защищенное свойство

Internal, help with color transforming the flash bitmap.
protected Color _color
Результат Color

_point защищенное свойство

Internal, to help avoid costly allocations.
protected FlxPoint,flxSharp.flxSharp _point
Результат FlxPoint

_zoom защищенное свойство

Indicates how far the camera is zoomed in.
protected float _zoom
Результат float

fxFadeAlpha защищенное свойство

Internal, used to control the "fade" special effect.
protected float fxFadeAlpha
Результат float

fxFadeColor защищенное свойство

Internal, used to control the "fade" special effect.
protected Color fxFadeColor
Результат Color

fxFadeComplete защищенное свойство

Internal, used to control the "fade" special effect.
protected Action,System fxFadeComplete
Результат System.Action

fxFadeDuration защищенное свойство

Internal, used to control the "fade" special effect.
protected float fxFadeDuration
Результат float

fxFlashAlpha защищенное свойство

Internal, used to control the "flash" special effect.
protected float fxFlashAlpha
Результат float

fxFlashColor защищенное свойство

Internal, used to control the "flash" special effect.
protected Color fxFlashColor
Результат Color

fxFlashComplete защищенное свойство

Internal, used to control the "flash" special effect.
protected Action,System fxFlashComplete
Результат System.Action

fxFlashDuration защищенное свойство

Internal, used to control the "flash" special effect.
protected float fxFlashDuration
Результат float

fxShakeComplete защищенное свойство

Internal, used to control the "shake" special effect.
protected Action,System fxShakeComplete
Результат System.Action

fxShakeDirection защищенное свойство

Internal, used to control the "shake" special effect.
protected uint fxShakeDirection
Результат uint

fxShakeDuration защищенное свойство

Internal, used to control the "shake" special effect.
protected float fxShakeDuration
Результат float

fxShakeIntensity защищенное свойство

Internal, used to control the "shake" special effect.
protected float fxShakeIntensity
Результат float

fxShakeOffset защищенное свойство

Internal, used to control the "shake" special effect.
protected FlxPoint,flxSharp.flxSharp fxShakeOffset
Результат FlxPoint

screen публичное свойство

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
Результат FlxSprite

transform публичное свойство

public Matrix transform
Результат Matrix