C# Class flxSharp.flxSharp.System.FlxGame

FlxGame is the heart of all flixel games, and contains a bunch of basic game loops and things. It is a long and sloppy file that you shouldn't have to worry about too much! It is basically only used to create your game object in the first place, after that FlxG and FlxState have all the useful stuff you actually need.
Afficher le fichier Open project: jlorek/flxSharp Class Usage Examples

Protected Properties

Свойство Type Description
Focus Microsoft.Xna.Framework.Graphics.Texture2D
InitialState FlxState
SoundTray Microsoft.Xna.Framework.Graphics.Texture2D
SoundTrayBars System.Array
SoundTrayTimer float

Private Properties

Свойство Type Description
createFocusScreen void
createSoundTray void
showSoundTray void

Méthodes publiques

Méthode Description
FlxGame ( FlxState State, int Width = 1280, int Height = 720, float Zoom = 1.0f, string ContentRootDirectory = "Content" ) : System

FlxGame constructor takes in the initial state and resolution of the screen.

FlxGame ( int gameSizeX, int gameSizeY, FlxState initialState, float zoom = 1.0f, int gameFramerate = 60, int flashFramerate, bool useSystemCursor = false ) : System

Instantiate a new game object.

Méthodes protégées

Méthode Description
Step ( ) : void

This is the main game update logic section. The onEnterFrame() handler is in charge of calling this the appropriate number of times each frame. This block handles state changes, replays, all that good stuff.

create ( EventArgs flashEvent ) : void

Used to instantiate the guts of the flixel game object once we have a valid reference to the root.

draw ( ) : void

Goes through the game state and draws all the game objects and special effects.

onEnterFrame ( EventArgs eventArgs = null ) : void

Handles the onEnterFrame call and figures out how many updates and draw calls to do.

onFocus ( EventArgs eventArgs = null ) : void

Internal event handler for input and focus.

onFocusLost ( EventArgs eventArgs = null ) : void

Internal event handler for input and focus.

onKeyDown ( EventArgs keyboardEvent ) : void

Internal event handler for input and focus.

onKeyUp ( EventArgs keyboardEvent ) : void

Internal event handler for input and focus.

onMouseDown ( EventArgs mouseEvent ) : void

Internal event handler for input and focus.

onMouseUp ( EventArgs mouseEvent ) : void

Internal event handler for input and focus.

onMouseWheel ( EventArgs mouseEvent ) : void

Internal event handler for input and focus.

switchState ( ) : void

If there is a state change requested during the update loop, this function handles actual destroying the old state and related processes, and calls creates on the new state and plugs it into the game object.

update ( ) : void

This function is called by step() and updates the actual game state. May be called multiple times per "frame" or draw call.

updateSoundTray ( float ms ) : void

This function just updates the soundtray object.

Private Methods

Méthode Description
createFocusScreen ( ) : void

Sets up the darkened overlay with the big white "play" button that appears when a flixel game loses focus.

createSoundTray ( ) : void

Sets up the "sound tray", the little volume meter that pops down sometimes.

showSoundTray ( bool silent = false ) : void

Makes the little volume tray slide out.

Method Details

FlxGame() public méthode

FlxGame constructor takes in the initial state and resolution of the screen.
public FlxGame ( FlxState State, int Width = 1280, int Height = 720, float Zoom = 1.0f, string ContentRootDirectory = "Content" ) : System
State FlxState The state you want to load
Width int The width of the screen
Height int The height of the screen
Zoom float
ContentRootDirectory string The directory of your content. It is set automatically by default but you can change it if you want to.
Résultat System

FlxGame() public méthode

Instantiate a new game object.
public FlxGame ( int gameSizeX, int gameSizeY, FlxState initialState, float zoom = 1.0f, int gameFramerate = 60, int flashFramerate, bool useSystemCursor = false ) : System
gameSizeX int The width of your game in game pixels, not necessarily final display pixels (see Zoom).
gameSizeY int The height of your game in game pixels, not necessarily final display pixels (see Zoom).
initialState FlxState The class name of the state you want to create and switch to first (e.g. MenuState).
zoom float The default level of zoom for the game's cameras (e.g. 2 = all pixels are now drawn at 2x). Default = 1.
gameFramerate int How frequently the game should update (default is 60 times per second).
flashFramerate int Sets the actual display framerate for Flash player (default is 30 times per second).
useSystemCursor bool Whether to use the default OS mouse pointer, or to use custom flixel ones.
Résultat System

Step() protected méthode

This is the main game update logic section. The onEnterFrame() handler is in charge of calling this the appropriate number of times each frame. This block handles state changes, replays, all that good stuff.
protected Step ( ) : void
Résultat void

create() protected méthode

Used to instantiate the guts of the flixel game object once we have a valid reference to the root.
protected create ( EventArgs flashEvent ) : void
flashEvent System.EventArgs Just a Flash system event, not too important for our purposes.
Résultat void

draw() protected méthode

Goes through the game state and draws all the game objects and special effects.
protected draw ( ) : void
Résultat void

onEnterFrame() protected méthode

Handles the onEnterFrame call and figures out how many updates and draw calls to do.
protected onEnterFrame ( EventArgs eventArgs = null ) : void
eventArgs System.EventArgs Flash event.
Résultat void

onFocus() protected méthode

Internal event handler for input and focus.
protected onFocus ( EventArgs eventArgs = null ) : void
eventArgs System.EventArgs Flash event.
Résultat void

onFocusLost() protected méthode

Internal event handler for input and focus.
protected onFocusLost ( EventArgs eventArgs = null ) : void
eventArgs System.EventArgs Flash event.
Résultat void

onKeyDown() protected méthode

Internal event handler for input and focus.
protected onKeyDown ( EventArgs keyboardEvent ) : void
keyboardEvent System.EventArgs Flash keyboard event.
Résultat void

onKeyUp() protected méthode

Internal event handler for input and focus.
protected onKeyUp ( EventArgs keyboardEvent ) : void
keyboardEvent System.EventArgs Flash keyboard event.
Résultat void

onMouseDown() protected méthode

Internal event handler for input and focus.
protected onMouseDown ( EventArgs mouseEvent ) : void
mouseEvent System.EventArgs Flash mouse event.
Résultat void

onMouseUp() protected méthode

Internal event handler for input and focus.
protected onMouseUp ( EventArgs mouseEvent ) : void
mouseEvent System.EventArgs Flash mouse event.
Résultat void

onMouseWheel() protected méthode

Internal event handler for input and focus.
protected onMouseWheel ( EventArgs mouseEvent ) : void
mouseEvent System.EventArgs Flash mouse event.
Résultat void

switchState() protected méthode

If there is a state change requested during the update loop, this function handles actual destroying the old state and related processes, and calls creates on the new state and plugs it into the game object.
protected switchState ( ) : void
Résultat void

update() protected méthode

This function is called by step() and updates the actual game state. May be called multiple times per "frame" or draw call.
protected update ( ) : void
Résultat void

updateSoundTray() protected méthode

This function just updates the soundtray object.
protected updateSoundTray ( float ms ) : void
ms float
Résultat void

Property Details

Focus protected_oe property

The "focus lost" screen (see createFocusScreen()).
protected Texture2D,Microsoft.Xna.Framework.Graphics Focus
Résultat Microsoft.Xna.Framework.Graphics.Texture2D

InitialState protected_oe property

Class type of the initial/first game state for the game, usually MenuState or something like that.
protected FlxState InitialState
Résultat FlxState

SoundTray protected_oe property

The sound tray display container (see createSoundTray()).
protected Texture2D,Microsoft.Xna.Framework.Graphics SoundTray
Résultat Microsoft.Xna.Framework.Graphics.Texture2D

SoundTrayBars protected_oe property

Helps display the volume bars on the sound tray.
protected Array,System SoundTrayBars
Résultat System.Array

SoundTrayTimer protected_oe property

Helps us auto-hide the sound tray after a volume change.
protected float SoundTrayTimer
Résultat float