C#Code
C#Code
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes
Libraries.Sprites.ClickableSprite2DProperty Class Reference
Inheritance diagram for Libraries.Sprites.ClickableSprite2DProperty:
Libraries.Sprites.PointInSprite2DProperty Libraries.Sprites.PointInSprite2DProperty Libraries.Sprites.BaseSpriteProperty Libraries.Sprites.BaseSpriteProperty Libraries.Sprites.BaseSpriteProperty Libraries.Sprites.BaseSpriteProperty Libraries.ObjectProperties.BaseObjectProperty Libraries.ObjectProperties.BaseObjectProperty Libraries.ObjectProperties.BaseObjectProperty Libraries.ObjectProperties.BaseObjectProperty Libraries.BaseObject Libraries.BaseObject Libraries.BaseObject Libraries.BaseObject

List of all members.

Classes

class  StoreDelegate

Public Member Functions

 ClickableSprite2DProperty ()
override StringType GetPropertyType ()
void StoreDelegateAndData (CallbackDelegate delegateUse, object data)
override void Update (int timePassed, Sprite2D sprite)
override bool CheckPointOnSprite (Sprite2D sprite, Microsoft.Xna.Framework.Vector2 point)
override void Clear ()
void RegisterForMouseClick (Libraries.Messaging.MouseInputMessageHandler.MouseButton button, Libraries.Messaging.MouseInputMessageHandler manager, bool ignoreIfPaused)
void RegisterForMouseClick (Libraries.Messaging.MouseInputMessageHandler.MouseButton button, Libraries.Messaging.MouseInputMessageHandler manager)
void HandleMouseClickDelegate (object message)
void SetClickAreaSize (Vector2 area)
delegate void ClickableSpriteDelegate (object data)
 ClickableSprite2DProperty ()
override StringType GetPropertyType ()
void StoreDelegateAndData (ClickableSpriteDelegate delegateUse, object data)
override void Update (int timePassed, Sprite2D sprite)
override bool CheckPointOnSprite (Sprite2D sprite, Microsoft.Xna.Framework.Vector2 point)
override void Clear ()
void RegisterForMouseClick (Libraries.Messaging.MouseInputMessageHandler.MouseButton button, Libraries.Messaging.MouseInputMessageHandler manager)
void HandleMouseClickDelegate (object message)

Static Public Attributes

static readonly StringType s_clickableSprite2DProperty = new StringType("ClickableSprite2DProperty")
 Type that represents the property.

Protected Member Functions

bool IsClickInArea (Vector2 displayPos)

Private Attributes

List< StoreDelegatem_delegates
Libraries.Messaging.MouseInputMessageHandler.MouseButton m_clickButton
 Mouse button to check for the click when registering with the mouse input manager.
bool m_clickOccured
 True if a click occured and should be handled next update, false if no click occured.
Vector2 m_clickPos
 Position the click occured at.
Libraries.Messaging.MouseInputMessageHandler m_registeredWith
 Who the property is registered with to get input.
Vector2 m_rectArea
 Rectangle bounding area around the sprite button.
ClickableSpriteDelegate m_delegateUse
 Delegate to use when clicking the sprite.
object m_data
 Data to send with the delegate when the sprite is clicked.

Detailed Description

Sprite2D property. Checks if a point is inside a 2D sprite. If so, then it can run a callback delegate to notify someone of the click occuring. Can be registered with the mouse input manager.


Constructor & Destructor Documentation

Libraries.Sprites.ClickableSprite2DProperty.ClickableSprite2DProperty ( )

Default constructor.

Libraries.Sprites.ClickableSprite2DProperty.ClickableSprite2DProperty ( )

Default constructor.


Member Function Documentation

override bool Libraries.Sprites.ClickableSprite2DProperty.CheckPointOnSprite ( Sprite2D  sprite,
Microsoft.Xna.Framework.Vector2  point 
) [virtual]

Check if a given point would be on the sprite.

sprite - Sprite the property is in.
point - Position to check for in the sprite.

Return:
Value is true if the point was on the sprite, false if not.

Reimplemented from Libraries.Sprites.PointInSprite2DProperty.

override bool Libraries.Sprites.ClickableSprite2DProperty.CheckPointOnSprite ( Sprite2D  sprite,
Microsoft.Xna.Framework.Vector2  point 
) [virtual]

Check if a given point would be on the sprite. If so, run the delegate.

sprite - Sprite the property is in.
point - Position to check for in the sprite.

Return:
Value is true if the point was on the sprite, false if not.

Reimplemented from Libraries.Sprites.PointInSprite2DProperty.

override void Libraries.Sprites.ClickableSprite2DProperty.Clear ( ) [virtual]

Clear the data objects stored in the object.

Reimplemented from Libraries.Sprites.PointInSprite2DProperty.

override void Libraries.Sprites.ClickableSprite2DProperty.Clear ( ) [virtual]

Clear the data objects stored in the object.

Reimplemented from Libraries.Sprites.PointInSprite2DProperty.

delegate void Libraries.Sprites.ClickableSprite2DProperty.ClickableSpriteDelegate ( object  data)

Delegate type to use for clickable events. Can send data to whoever the delegate is from. Use this to notify things when clickable sprites are clicked.

override StringType Libraries.Sprites.ClickableSprite2DProperty.GetPropertyType ( ) [virtual]

Sprite2D property. Checks if a point is inside a 2D sprite. Can check for transparency as well. Should not be used for sprites that are scaled or rotated (for now).

Reimplemented from Libraries.Sprites.PointInSprite2DProperty.

override StringType Libraries.Sprites.ClickableSprite2DProperty.GetPropertyType ( ) [virtual]

Sprite2D property. Checks if a point is inside a 2D sprite. Can check for transparency as well. Should not be used for sprites that are scaled or rotated (for now).

Reimplemented from Libraries.Sprites.PointInSprite2DProperty.

void Libraries.Sprites.ClickableSprite2DProperty.HandleMouseClickDelegate ( object  message)

Delegate used to register with the mouse input manager for mouse clicks.

message - Message recieved, what input message it is.
void Libraries.Sprites.ClickableSprite2DProperty.HandleMouseClickDelegate ( object  message)

Delegate used to register with the mouse input manager for mouse clicks.

message - Message recieved, what input message it is.
bool Libraries.Sprites.ClickableSprite2DProperty.IsClickInArea ( Vector2  displayPos) [protected]

Check if a position is in the clickable rect area of the sprite button.

displayPos - Display position of the sprite.

Return:
Value is true if the current click position is in the clickable area. If the clickable area is 0, then the click will always be in the clickable area.
void Libraries.Sprites.ClickableSprite2DProperty.RegisterForMouseClick ( Libraries.Messaging.MouseInputMessageHandler.MouseButton  button,
Libraries.Messaging.MouseInputMessageHandler  manager 
)

Register the property to the given mouse manager for the given input type.

button - Mouse button to check for.
void Libraries.Sprites.ClickableSprite2DProperty.RegisterForMouseClick ( Libraries.Messaging.MouseInputMessageHandler.MouseButton  button,
Libraries.Messaging.MouseInputMessageHandler  manager,
bool  ignoreIfPaused 
)

Register the property to the given mouse manager for the given input type.

button - Mouse button to check for.
manager - Manager to register the button input with.
ignoreIfPaused - True if the button should be marked as ignore if paused, false if not.
void Libraries.Sprites.ClickableSprite2DProperty.RegisterForMouseClick ( Libraries.Messaging.MouseInputMessageHandler.MouseButton  button,
Libraries.Messaging.MouseInputMessageHandler  manager 
)

Register the property to the given mouse manager for the given input type. Defaults to ignore if the mouse manager sees the game is paused.

button - Mouse button to check for.
manager - Manager to register the button input with.
ignoreIfPaused - True if the button should be marked as ignore if paused, false if not.
void Libraries.Sprites.ClickableSprite2DProperty.SetClickAreaSize ( Vector2  area)

Set the clickable area of the sprite. From the top left of the sprite + area is the clickable part of the button.

area - Size of the clickable area of the button.
void Libraries.Sprites.ClickableSprite2DProperty.StoreDelegateAndData ( CallbackDelegate  delegateUse,
object  data 
)

Store the delegate to run when the click occurs and the data to send. Data can be null, depending on what the delegate is expecting. More than one delegate can be stored. Adding a delegate puts it on the end of a list.

delegateUse - Delegate to run on click.
data - Data to send.
void Libraries.Sprites.ClickableSprite2DProperty.StoreDelegateAndData ( ClickableSpriteDelegate  delegateUse,
object  data 
)

Store the delegate to run when the click occurs and the data to send. Data can be null, depending on what the delegate is expecting.

delegateUse - Delegate to run on click.
data - Data to send.
override void Libraries.Sprites.ClickableSprite2DProperty.Update ( int  timePassed,
Sprite2D  sprite 
) [virtual]

Update the property.

timePassed - How long the update is for.
sprite - The sprite the property is in. This way the property can make changes to the sprite.

Reimplemented from Libraries.Sprites.PointInSprite2DProperty.

override void Libraries.Sprites.ClickableSprite2DProperty.Update ( int  timePassed,
Sprite2D  sprite 
) [virtual]

Update the property.

timePassed - How long the update is for.
sprite - The sprite the property is in. This way the property can make changes to the sprite.

Reimplemented from Libraries.Sprites.PointInSprite2DProperty.


Member Data Documentation

Libraries Messaging MouseInputMessageHandler MouseButton Libraries::Sprites.ClickableSprite2DProperty::m_clickButton [private]

Mouse button to check for the click when registering with the mouse input manager.

True if a click occured and should be handled next update, false if no click occured.

Position the click occured at.

Data to send with the delegate when the sprite is clicked.

Delegates and data to use when the sprite is clicked. Use to do things like add a event and make a sound run, etc.

Delegate to use when clicking the sprite.

Rectangle bounding area around the sprite button.

Who the property is registered with to get input.

static readonly StringType Libraries::Sprites.ClickableSprite2DProperty::s_clickableSprite2DProperty = new StringType("ClickableSprite2DProperty") [static]

Type that represents the property.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Properties