C# 클래스 XnaFlixel.FlxButton

A simple button class that calls a function when clicked by the mouse. Supports labels, highlight states, and parallax scrolling.
상속: FlxGroup
파일 보기 프로젝트 열기: jsbeckr/XnaFlixel

보호된 프로퍼티들

프로퍼티 타입 설명
_callback FlxButtonClick
_initialized bool
_off FlxSprite
_offT FlxText
_on FlxSprite
_onT FlxText
_onToggle bool
_pressed bool
_sf Microsoft.Xna.Framework.Vector2

공개 메소드들

메소드 설명
Destroy ( ) : void

Called by the game state when state is changed (if this object belongs to the state)

FlxButton ( int x, int y, FlxButtonClick callback ) : Microsoft.Xna.Framework

Creates a new FlxButton object with a gray background and a callback function on the UI thread.

LoadGraphic ( FlxSprite image, FlxSprite imageHighlight ) : FlxButton

Set your own image as the button background.

LoadText ( FlxText text, FlxText textHighlight ) : FlxButton

Add a text label to the button.

Render ( SpriteBatch spriteBatch ) : void
Update ( ) : void

Called by the game loop automatically, handles mouseover and click detection.

보호된 메소드들

메소드 설명
visibility ( bool on ) : void

Internal function for handling the visibility of the off and on graphics.

비공개 메소드들

메소드 설명
OnMouseUp ( object sender, FlxMouseEvent mouseEvent ) : void

Internal function for handling the actual callback call (for UI thread dependent calls like FlxU.openURL()).

메소드 상세

Destroy() 공개 메소드

Called by the game state when state is changed (if this object belongs to the state)
public Destroy ( ) : void
리턴 void

FlxButton() 공개 메소드

Creates a new FlxButton object with a gray background and a callback function on the UI thread.
public FlxButton ( int x, int y, FlxButtonClick callback ) : Microsoft.Xna.Framework
x int The X position of the button.
y int The Y position of the button.
callback FlxButtonClick The function to call whenever the button is clicked.
리턴 Microsoft.Xna.Framework

LoadGraphic() 공개 메소드

Set your own image as the button background.
public LoadGraphic ( FlxSprite image, FlxSprite imageHighlight ) : FlxButton
image FlxSprite A FlxSprite object to use for the button background.
imageHighlight FlxSprite A FlxSprite object to use for the button background when highlighted (optional).
리턴 FlxButton

LoadText() 공개 메소드

Add a text label to the button.
public LoadText ( FlxText text, FlxText textHighlight ) : FlxButton
text FlxText A FlxText object to use to display text on this button (optional).
textHighlight FlxText A FlxText object that is used when the button is highlighted (optional).
리턴 FlxButton

Render() 공개 메소드

public Render ( SpriteBatch spriteBatch ) : void
spriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
리턴 void

Update() 공개 메소드

Called by the game loop automatically, handles mouseover and click detection.
public Update ( ) : void
리턴 void

visibility() 보호된 메소드

Internal function for handling the visibility of the off and on graphics.
protected visibility ( bool on ) : void
on bool Whether the button should be on or off.
리턴 void

프로퍼티 상세

_callback 보호되어 있는 프로퍼티

This function is called when the button is clicked.
protected FlxButtonClick _callback
리턴 FlxButtonClick

_initialized 보호되어 있는 프로퍼티

Whether or not the button has initialized itself yet.
protected bool _initialized
리턴 bool

_off 보호되어 있는 프로퍼티

Stores the 'off' or normal button state graphic.
protected FlxSprite _off
리턴 FlxSprite

_offT 보호되어 있는 프로퍼티

Stores the 'off' or normal button state label.
protected FlxText _offT
리턴 FlxText

_on 보호되어 있는 프로퍼티

Stores the 'on' or highlighted button state graphic.
protected FlxSprite _on
리턴 FlxSprite

_onT 보호되어 있는 프로퍼티

Stores the 'on' or highlighted button state label.
protected FlxText _onT
리턴 FlxText

_onToggle 보호되어 있는 프로퍼티

Used for checkbox-style behavior.
protected bool _onToggle
리턴 bool

_pressed 보호되어 있는 프로퍼티

Tracks whether or not the button is currently pressed.
protected bool _pressed
리턴 bool

_sf 보호되어 있는 프로퍼티

Helper variable for correcting its members' scrollFactor objects.
protected Vector2,Microsoft.Xna.Framework _sf
리턴 Microsoft.Xna.Framework.Vector2