C# 클래스 Descent.GUI.GUIElement

A single element of the user interface that, itself, can contain sub-elements
상속: Microsoft.Xna.Framework.DrawableGameComponent
파일 보기 프로젝트 열기: nezbo/Descent 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
children Collection
defaultBG Microsoft.Xna.Framework.Graphics.Texture2D
manager Descent.Messaging.Events.EventManager
texts Collection

공개 메소드들

메소드 설명
AddChild ( GUIElement child ) : void

Adds the given GUIElement to the set of children within this one.

AddDrawable ( string target, Drawable visual, Rectangle rectangle ) : void

Add the drawable to be displayed on the screen bounding the given rectangle.

AddDrawable ( string target, Drawable visual, Vector2 position ) : void

Add the drawable to be displayed at the given position in this GUIElement.

AddText ( string target, string text, Vector2 position ) : void

Adds the given string to be drawn on the screen on all children (or this) with the target name.

AddText ( string target, string text, Vector2 position, Color color ) : void

Adds the given string to be drawn on the screen on all children (or this) with the target name.

ClearChildren ( ) : void

Removes all children.

Disable ( string target ) : void

Disables all elements below (and including) the target element. They will not take inputs or display anything.

Draw ( SpriteBatch draw ) : void

Draws this GUIElement and then all children on top of it

GUIElement ( Microsoft.Xna.Framework.Game game, string name, int x, int y, int width, int height ) : System

Creates a GUIElement with the given boundaries.

HandleClick ( int x, int y ) : bool

Determines if a click is within the GUIElement and acts upon the click if possible.

HandleKeyPress ( Keys key ) : void

Reacts to the given key type if this GUIElement is focused.

HasFocus ( ) : bool

Tells if the element handled the last click request.

HasPoint ( int x, int y ) : bool

Checks if the given point is within the boundaries of the GUIElement.

LostFocus ( ) : void

Indicate to the element (and all its children) that it has lost focus.

Move ( int x, int y ) : void

Moves this element (and all sub-elements) by the specified amount.

SetBackground ( string assetName ) : void

Changes the background to the given asset and enables background drawing.

SetClickAction ( string target, GUIElement>.Action action ) : void

Replace (if any) the current On Click action with the one given.

SetDrawBackground ( bool toDraw ) : void

Makes the current GUIElement draw a background beneath itself.

SetFont ( SpriteFont newFont ) : void

Sets the font that this GUIElement draws its texts with.

Update ( GameTime gameTime ) : void

보호된 메소드들

메소드 설명
ActOnDirectClick ( int x, int y ) : void

This memthod can be overwritten if you need to act on clicks that are directly targetting this guielement and not its sub-elements.

WordWrap ( string text, Vector2 position ) : string

Word Wraps the given string so when displayed at the given position, it will not draw outside the width of the GUIElement. If too long, the text will however draw outside the bottom of the box.

비공개 메소드들

메소드 설명
DrawsBackground ( ) : bool
VisualClicked ( int x, int y ) : bool

메소드 상세

ActOnDirectClick() 보호된 메소드

This memthod can be overwritten if you need to act on clicks that are directly targetting this guielement and not its sub-elements.
protected ActOnDirectClick ( int x, int y ) : void
x int The x-coordinate of the direct click.
y int The y-coordinate of the direct click.
리턴 void

AddChild() 공개 메소드

Adds the given GUIElement to the set of children within this one.
public AddChild ( GUIElement child ) : void
child GUIElement The new child
리턴 void

AddDrawable() 공개 메소드

Add the drawable to be displayed on the screen bounding the given rectangle.
public AddDrawable ( string target, Drawable visual, Rectangle rectangle ) : void
target string The target GUIElement for the action
visual Drawable The drawable to display
rectangle Microsoft.Xna.Framework.Rectangle The drawable should be stretched to be drawn at the rectangle
리턴 void

AddDrawable() 공개 메소드

Add the drawable to be displayed at the given position in this GUIElement.
public AddDrawable ( string target, Drawable visual, Vector2 position ) : void
target string The target GUIElement for the action
visual Drawable The drawable to display
position Vector2 Where the upper-left corner of the drawable should be
리턴 void

AddText() 공개 메소드

Adds the given string to be drawn on the screen on all children (or this) with the target name.
public AddText ( string target, string text, Vector2 position ) : void
target string Only GUIElements with this name should display the text.
text string The text to be drawn to the screen.
position Vector2 Where the upper-left corner of the text should be
리턴 void

AddText() 공개 메소드

Adds the given string to be drawn on the screen on all children (or this) with the target name.
public AddText ( string target, string text, Vector2 position, Color color ) : void
target string Only GUIElements with this name should display the text.
text string The text to be drawn to the screen.
position Vector2 Where the upper-left corner of the text should be
color Color The color that the text should be drawn in
리턴 void

ClearChildren() 공개 메소드

Removes all children.
public ClearChildren ( ) : void
리턴 void

Disable() 공개 메소드

Disables all elements below (and including) the target element. They will not take inputs or display anything.
public Disable ( string target ) : void
target string What to disable.
리턴 void

Draw() 공개 메소드

Draws this GUIElement and then all children on top of it
public Draw ( SpriteBatch draw ) : void
draw Microsoft.Xna.Framework.Graphics.SpriteBatch The SpriteBatch to draw on
리턴 void

GUIElement() 공개 메소드

Creates a GUIElement with the given boundaries.
public GUIElement ( Microsoft.Xna.Framework.Game game, string name, int x, int y, int width, int height ) : System
game Microsoft.Xna.Framework.Game
name string The name of the element
x int The x-coordinate of the upper-left corner
y int The y-coordinate of the upper-left corner
width int The width of the element
height int The height of the element
리턴 System

HandleClick() 공개 메소드

Determines if a click is within the GUIElement and acts upon the click if possible.
public HandleClick ( int x, int y ) : bool
x int The x-coordinate of the click
y int The y-coordinate of the click
리턴 bool

HandleKeyPress() 공개 메소드

Reacts to the given key type if this GUIElement is focused.
public HandleKeyPress ( Keys key ) : void
key Keys The key that has been pressed and wasn't pressed before
리턴 void

HasFocus() 공개 메소드

Tells if the element handled the last click request.
public HasFocus ( ) : bool
리턴 bool

HasPoint() 공개 메소드

Checks if the given point is within the boundaries of the GUIElement.
public HasPoint ( int x, int y ) : bool
x int The x-coordinate of the point
y int The y-coordinate of the point
리턴 bool

LostFocus() 공개 메소드

Indicate to the element (and all its children) that it has lost focus.
public LostFocus ( ) : void
리턴 void

Move() 공개 메소드

Moves this element (and all sub-elements) by the specified amount.
public Move ( int x, int y ) : void
x int The number of pixels it should be moved on the x-axis.
y int The number of pixels it should be moved on the y-axis.
리턴 void

SetBackground() 공개 메소드

Changes the background to the given asset and enables background drawing.
public SetBackground ( string assetName ) : void
assetName string The name of the asset in the Content project.
리턴 void

SetClickAction() 공개 메소드

Replace (if any) the current On Click action with the one given.
public SetClickAction ( string target, GUIElement>.Action action ) : void
target string The target GUIElement for the action
action GUIElement>.Action The new On Click action
리턴 void

SetDrawBackground() 공개 메소드

Makes the current GUIElement draw a background beneath itself.
public SetDrawBackground ( bool toDraw ) : void
toDraw bool True if the current GUIElement should draw background
리턴 void

SetFont() 공개 메소드

Sets the font that this GUIElement draws its texts with.
public SetFont ( SpriteFont newFont ) : void
newFont Microsoft.Xna.Framework.Graphics.SpriteFont The new font to draw with.
리턴 void

Update() 공개 메소드

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
리턴 void

WordWrap() 보호된 메소드

Word Wraps the given string so when displayed at the given position, it will not draw outside the width of the GUIElement. If too long, the text will however draw outside the bottom of the box.
protected WordWrap ( string text, Vector2 position ) : string
text string The text to word wrap
position Vector2 Where the upper-left corner of the drawable should be
리턴 string

프로퍼티 상세

children 보호되어 있는 프로퍼티

protected Collection children
리턴 Collection

defaultBG 보호되어 있는 정적으로 프로퍼티

protected static Texture2D,Microsoft.Xna.Framework.Graphics defaultBG
리턴 Microsoft.Xna.Framework.Graphics.Texture2D

manager 보호되어 있는 정적으로 프로퍼티

protected static EventManager,Descent.Messaging.Events manager
리턴 Descent.Messaging.Events.EventManager

texts 보호되어 있는 프로퍼티

protected Collection texts
리턴 Collection