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

Защищенные свойства (Protected)

Свойство Тип Описание
Focus Microsoft.Xna.Framework.Graphics.Texture2D
InitialState FlxState
SoundTray Microsoft.Xna.Framework.Graphics.Texture2D
SoundTrayBars System.Array
SoundTrayTimer float

Private Properties

Свойство Тип Описание
createFocusScreen void
createSoundTray void
showSoundTray void

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

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

Защищенные методы

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

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

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

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

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

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

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

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

Step() защищенный Метод

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

create() защищенный Метод

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

draw() защищенный Метод

Goes through the game state and draws all the game objects and special effects.
protected draw ( ) : void
Результат void

onEnterFrame() защищенный Метод

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

onFocus() защищенный Метод

Internal event handler for input and focus.
protected onFocus ( EventArgs eventArgs = null ) : void
eventArgs System.EventArgs Flash event.
Результат void

onFocusLost() защищенный Метод

Internal event handler for input and focus.
protected onFocusLost ( EventArgs eventArgs = null ) : void
eventArgs System.EventArgs Flash event.
Результат void

onKeyDown() защищенный Метод

Internal event handler for input and focus.
protected onKeyDown ( EventArgs keyboardEvent ) : void
keyboardEvent System.EventArgs Flash keyboard event.
Результат void

onKeyUp() защищенный Метод

Internal event handler for input and focus.
protected onKeyUp ( EventArgs keyboardEvent ) : void
keyboardEvent System.EventArgs Flash keyboard event.
Результат void

onMouseDown() защищенный Метод

Internal event handler for input and focus.
protected onMouseDown ( EventArgs mouseEvent ) : void
mouseEvent System.EventArgs Flash mouse event.
Результат void

onMouseUp() защищенный Метод

Internal event handler for input and focus.
protected onMouseUp ( EventArgs mouseEvent ) : void
mouseEvent System.EventArgs Flash mouse event.
Результат void

onMouseWheel() защищенный Метод

Internal event handler for input and focus.
protected onMouseWheel ( EventArgs mouseEvent ) : void
mouseEvent System.EventArgs Flash mouse event.
Результат void

switchState() защищенный Метод

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

update() защищенный Метод

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

updateSoundTray() защищенный Метод

This function just updates the soundtray object.
protected updateSoundTray ( float ms ) : void
ms float
Результат void

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

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

The "focus lost" screen (see createFocusScreen()).
protected Texture2D,Microsoft.Xna.Framework.Graphics Focus
Результат Microsoft.Xna.Framework.Graphics.Texture2D

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

Class type of the initial/first game state for the game, usually MenuState or something like that.
protected FlxState InitialState
Результат FlxState

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

The sound tray display container (see createSoundTray()).
protected Texture2D,Microsoft.Xna.Framework.Graphics SoundTray
Результат Microsoft.Xna.Framework.Graphics.Texture2D

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

Helps display the volume bars on the sound tray.
protected Array,System SoundTrayBars
Результат System.Array

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

Helps us auto-hide the sound tray after a volume change.
protected float SoundTrayTimer
Результат float