C# Class fliXNA_xbox.FlxG

显示文件 Open project: bpercevic/flixel-XNA Class Usage Examples

Public Properties

Property Type Description
bgColor Color
camera FlxCamera
cameras List
console FlxConsole
content Microsoft.Xna.Framework.Content.ContentManager
defaultFont Microsoft.Xna.Framework.Graphics.SpriteFont
defaultWholeScreenViewport Microsoft.Xna.Framework.Graphics.Viewport
elapsed float
globalSeed float
graphics GraphicsDeviceManager
graphicsDevice GraphicsDevice
height float
hud FlxGroup
keys FlxKeyboard
mouse FlxMouse
mute bool
pad1 FlxGamepad
pad2 FlxGamepad
pad3 FlxGamepad
pad4 FlxGamepad
rotation float
safeZone FlxRect
sounds FlxGroup
storage Microsoft.Xna.Framework.Storage.StorageDevice
viewport Microsoft.Xna.Framework.Graphics.Viewport
viewports List
volume float
width float
zoom float

Public Methods

Method Description
addCamera ( FlxCamera NewCamera ) : FlxCamera
collide ( FlxObject ObjectOrGroup1 = null, FlxObject ObjectOrGroup2 = null, Func NotifyCallback = null ) : System.Boolean

Returns true if the two FlxObjects collide. Optional callback function of return type bool with two FlxObject parameters will be called if true.

log ( Object data ) : bool

Log something to the debugger console in Visual Studio

overlap ( FlxObject ObjectOrGroup1 = null, FlxObject ObjectOrGroup2 = null, Func NotifyCallback = null, Func ProcessCallback = null ) : System.Boolean

Returns true if the two FlxObjects overlap. Optional Callback function of return type bool with two FlxObject parameters will be called if true.

play ( SoundEffect EmbeddedSound, float Volume = 1.0f, bool Looped = false ) : FlxSound

Play a sound, not with FlxSound but with SoundEffect from the XNA framework because the sound is disposed of properly by the xbox itself. CURRENTLY NOT WORKING The sound starts but cuts off in about half of a second.

switchState ( FlxState State ) : void

Call this to switch to a new state @use FlxG.switchState(new NewState());

Private Methods

Method Description
gametime ( GameTime dt ) : void
init ( ) : void

Initiate all the things needed by the engine

loadSound ( SoundEffect EmbeddedSound, float Volume, bool Looped, bool AutoDestroy, bool AutoPlay ) : FlxSound
random ( ) : float

Internal random float from 0 to 1

shake ( float Intensity = 0.025f, float Duration = 0.5f, System.Action OnComplete = null, bool Force = true, uint Direction ) : void

Shake the screen

snap ( float XorY, float Grid ) : float
update ( GameTime dt ) : void

Internal function for updating Camera, State, Console, and Elapsed Time

updateCameras ( ) : void
updateInputs ( ) : void

Internal function for keeping input states current

Method Details

addCamera() public static method

public static addCamera ( FlxCamera NewCamera ) : FlxCamera
NewCamera FlxCamera
return FlxCamera

collide() public static method

Returns true if the two FlxObjects collide. Optional callback function of return type bool with two FlxObject parameters will be called if true.
public static collide ( FlxObject ObjectOrGroup1 = null, FlxObject ObjectOrGroup2 = null, Func NotifyCallback = null ) : System.Boolean
ObjectOrGroup1 FlxObject
ObjectOrGroup2 FlxObject
NotifyCallback Func
return System.Boolean

log() public static method

Log something to the debugger console in Visual Studio
public static log ( Object data ) : bool
data Object
return bool

overlap() public static method

Returns true if the two FlxObjects overlap. Optional Callback function of return type bool with two FlxObject parameters will be called if true.
public static overlap ( FlxObject ObjectOrGroup1 = null, FlxObject ObjectOrGroup2 = null, Func NotifyCallback = null, Func ProcessCallback = null ) : System.Boolean
ObjectOrGroup1 FlxObject
ObjectOrGroup2 FlxObject
NotifyCallback Func
ProcessCallback Func
return System.Boolean

play() public static method

Play a sound, not with FlxSound but with SoundEffect from the XNA framework because the sound is disposed of properly by the xbox itself. CURRENTLY NOT WORKING The sound starts but cuts off in about half of a second.
public static play ( SoundEffect EmbeddedSound, float Volume = 1.0f, bool Looped = false ) : FlxSound
EmbeddedSound Microsoft.Xna.Framework.Audio.SoundEffect
Volume float
Looped bool
return FlxSound

switchState() public static method

Call this to switch to a new state @use FlxG.switchState(new NewState());
public static switchState ( FlxState State ) : void
State FlxState
return void

Property Details

bgColor public_oe static_oe property

Controls the background color of the Game
public static Color bgColor
return Color

camera public_oe static_oe property

Reference to the Game Camera
public static FlxCamera,fliXNA_xbox camera
return FlxCamera

cameras public_oe static_oe property

Array of cameras, used for splitscreen
public static List cameras
return List

console public_oe static_oe property

Unused Console reference Not yet implemented
public static FlxConsole,fliXNA_xbox console
return FlxConsole

content public_oe static_oe property

Reference to the ContentManager, important for retrieving Content such as images and sound
public static ContentManager,Microsoft.Xna.Framework.Content content
return Microsoft.Xna.Framework.Content.ContentManager

defaultFont public_oe static_oe property

The default font that you can use for text
public static SpriteFont,Microsoft.Xna.Framework.Graphics defaultFont
return Microsoft.Xna.Framework.Graphics.SpriteFont

defaultWholeScreenViewport public_oe static_oe property

A viewport that references the whole screen, used to render the HUD
public static Viewport,Microsoft.Xna.Framework.Graphics defaultWholeScreenViewport
return Microsoft.Xna.Framework.Graphics.Viewport

elapsed public_oe static_oe property

Time elapsed since last frame
public static float elapsed
return float

globalSeed public_oe static_oe property

Internal random number helper
public static float globalSeed
return float

graphics public_oe static_oe property

Reference to the GraphicsDeviceManager
public static GraphicsDeviceManager graphics
return GraphicsDeviceManager

graphicsDevice public_oe static_oe property

Reference to the GraphicsDevice
public static GraphicsDevice graphicsDevice
return GraphicsDevice

height public_oe static_oe property

Reference to the Height of the Viewport
public static float height
return float

hud public_oe static_oe property

Built-In FlxGroup to handle HUD elements since scrollFactor is not yet working
public static FlxGroup,fliXNA_xbox hud
return FlxGroup

keys public_oe static_oe property

Reference to Keyboard input
public static FlxKeyboard,fliXNA_xbox keys
return FlxKeyboard

mouse public_oe static_oe property

Reference to Mouse input
public static FlxMouse mouse
return FlxMouse

mute public_oe static_oe property

Whether all the sounds are mute
public static bool mute
return bool

pad1 public_oe static_oe property

Reference to Gamepad input for Player One
public static FlxGamepad,fliXNA_xbox pad1
return FlxGamepad

pad2 public_oe static_oe property

Reference to Gamepad input for Player Two
public static FlxGamepad,fliXNA_xbox pad2
return FlxGamepad

pad3 public_oe static_oe property

Reference to Gamepad input for Player Three
public static FlxGamepad,fliXNA_xbox pad3
return FlxGamepad

pad4 public_oe static_oe property

Reference to Gamepad input for Player Four
public static FlxGamepad,fliXNA_xbox pad4
return FlxGamepad

rotation public_oe static_oe property

Can be used to rotate the camera
public static float rotation
return float

safeZone public_oe static_oe property

Reference of the Safe Zone, useful for making sure your objects are visible across various televisions
public static FlxRect,fliXNA_xbox safeZone
return FlxRect

sounds public_oe static_oe property

A list of all the sounds being played in the game
public static FlxGroup,fliXNA_xbox sounds
return FlxGroup

storage public_oe static_oe property

Reference to a storage device, perhaps the harddrive on the Xbox? Not yet implemented
public static StorageDevice,Microsoft.Xna.Framework.Storage storage
return Microsoft.Xna.Framework.Storage.StorageDevice

viewport public_oe static_oe property

The current viewport
public static Viewport,Microsoft.Xna.Framework.Graphics viewport
return Microsoft.Xna.Framework.Graphics.Viewport

viewports public_oe static_oe property

Array of viewports, could be used for splitscreen
public static List viewports
return List

volume public_oe static_oe property

Can be used to change volume of all sounds, default is 1.0f which equals 100%
public static float volume
return float

width public_oe static_oe property

Reference to the Width of the Viewport
public static float width
return float

zoom public_oe static_oe property

Can be used to zoom the camera
public static float zoom
return float