3DRadSpace  v1.0.0a
Scripting documentation
_3DRadSpaceDll.Sprite Class Reference

2D Screen images class. More...

Inheritance diagram for _3DRadSpaceDll.Sprite:
_3DRadSpaceDll.GameObject

Public Member Functions

 Sprite (string name, bool active, string resource, Vector2 pos, Vector2 scale, Vector2 center_rot=default, float rotation=0, Rectangle? section=default, Color mask=default, SpriteEffects effects=default, int layer=1)
 Sprite object constructor. More...
 
 Sprite ()
 Empty Sprite constructor. More...
 
void Load (ContentManager content, GraphicsDevice gd)
 Loads the texture. Notice this is not overloading the function from the GameObject class. More...
 
override void Draw (SpriteBatch spriteBatch, Matrix? view, Matrix? projection)
 Draws the sprite. More...
 
override void EditorDraw (SpriteBatch spriteBatch, Matrix? view, Matrix? projection)
 Drawing the sprite but for the editor. More...
 
override void Update (MouseState mouse, KeyboardState keyboard, GameTime time)
 Updates the sprite (if it is clicked) More...
 
void Dispose ()
 Frees the loaded texture. More...
 
- Public Member Functions inherited from _3DRadSpaceDll.GameObject
 GameObject ()
 Default constructor. More...
 
void Enable ()
 Enables object. More...
 
void Disable ()
 Disables object. More...
 
void Toggle ()
 Switches object on/off state. More...
 
void Show ()
 Shows the object. More...
 
void Hide ()
 Hides the object. More...
 
virtual void Load (ContentManager content)
 Loads the resource(s). More...
 
virtual void Trigger ()
 This is specific to objects like ExitFade, NetServer,etc More...
 
override bool Equals (object obj)
 Determines whether the specified object is equal to the current object. More...
 
override int GetHashCode ()
 Returns the hash code calculated from a string representing the data inside the object. More...
 
override string ToString ()
 Returns the object's name More...
 
void RunOnce ()
 Runs the object one Update loop. If used on a active object it will be stopped. More...
 

Protected Member Functions

void Dispose (bool disposing)
 Protected Dispose(). More...
 

Properties

bool IsUsedByCam2D [get, set]
 Checks if this object is being used by a Camera2D. More...
 
Texture2D Texture [get]
 Texture used to draw the sprite. More...
 
Vector2 Size [get, set]
 Size of the sprite. More...
 
new float Rotation [get, set]
 Rotation of the sprite in radians. More...
 
new Vector2 Position [get, set]
 Position of the sprite More...
 
Rectangle? SpriteSheetSection [get, set]
 Section of a sprite sheet. If not used, set this to null; More...
 
Color Mask [get, set]
 Color mask. More...
 
Vector2 Center [get, set]
 Center of rotation. More...
 
SpriteEffects Effects [get, set]
 Effects applied to the sprite. More...
 
float Layer [get, set]
 Layer depth of the sprite. More...
 
- Properties inherited from _3DRadSpaceDll.GameObject
string Name [get, set]
 Object Name. Used as a string identifier. More...
 
object Tag [get, set]
 Tag object. More...
 
bool Enabled [get, set]
 Checks if object is enabled. More...
 
bool Hidden [get, set]
 Checks if object is being drawn. More...
 
List< ObjectBehiavourBehiavours [get, set]
 Relation with other objects More...
 
Quaternion RotationQuaternion [get]
 Rotation in a Quaterion system. More...
 
string Resource [get, set]
 Resource file More...
 

Events

onClick OnClick
 Event called if the sprite is clicked More...
 
- Events inherited from _3DRadSpaceDll.GameObject
onDraw OnDraw
 Called when object is being drawn on frame. More...
 
onUpdate OnUpdate
 Called when object is being updated on the update logic loop. More...
 
onObjectDestroy OnRemoval
 Called when object is being deleted. More...
 
onObjectLoad OnObjectLoad
 Called when a object resource is being loaded. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from _3DRadSpaceDll.GameObject
static implicit operator bool (GameObject o)
 Checks if the object exists. Same as GameObject != null. More...
 
static bool operator== (GameObject a, GameObject b)
 Checks if two GameObjects are equal. More...
 
static bool operator!= (GameObject a, GameObject b)
 The opposite of the equality operator. More...
 
- Public Attributes inherited from _3DRadSpaceDll.GameObject
Vector3 Position
 Object position More...
 
Vector3 Rotation
 Rotation in a Euler angles system. More...
 
List< int > SelectedObjects
 Used for editor. More...
 

Detailed Description

2D Screen images class.

Constructor & Destructor Documentation

◆ Sprite() [1/2]

_3DRadSpaceDll.Sprite.Sprite ( string  name,
bool  active,
string  resource,
Vector2  pos,
Vector2  scale,
Vector2  center_rot = default,
float  rotation = 0,
Rectangle?  section = default,
Color  mask = default,
SpriteEffects  effects = default,
int  layer = 1 
)

Sprite object constructor.

Parameters
nameObject Name
activeIs this object active?
resourceResource image.
pos2D Position.
scaleSize of the sprite.
center_rotCenter of rotation.
rotationRotation in radians(?)
sectionSprite sheet section.
maskMask Color.
effectsFlipping effects.
layerDrawing layer

◆ Sprite() [2/2]

_3DRadSpaceDll.Sprite.Sprite ( )

Empty Sprite constructor.

Member Function Documentation

◆ Dispose() [1/2]

void _3DRadSpaceDll.Sprite.Dispose ( )

Frees the loaded texture.

◆ Dispose() [2/2]

void _3DRadSpaceDll.Sprite.Dispose ( bool  disposing)
protected

Protected Dispose().

Parameters
disposing

◆ Draw()

override void _3DRadSpaceDll.Sprite.Draw ( SpriteBatch  spriteBatch,
Matrix?  view,
Matrix?  projection 
)
virtual

Draws the sprite.

Parameters
spriteBatchspriteBatch used for drawing.
viewUse a null value.
projectionUse a null value.

Reimplemented from _3DRadSpaceDll.GameObject.

◆ EditorDraw()

override void _3DRadSpaceDll.Sprite.EditorDraw ( SpriteBatch  spriteBatch,
Matrix?  view,
Matrix?  projection 
)
virtual

Drawing the sprite but for the editor.

Parameters
spriteBatch
view
projection

Reimplemented from _3DRadSpaceDll.GameObject.

◆ Load()

void _3DRadSpaceDll.Sprite.Load ( ContentManager  content,
GraphicsDevice  gd 
)

Loads the texture. Notice this is not overloading the function from the GameObject class.

Parameters
contentContent manager.
gdGraphics device. Expected to be given by the editor.

◆ Update()

override void _3DRadSpaceDll.Sprite.Update ( MouseState  mouse,
KeyboardState  keyboard,
GameTime  time 
)
virtual

Updates the sprite (if it is clicked)

Parameters
mouse
keyboard
time

Reimplemented from _3DRadSpaceDll.GameObject.

Property Documentation

◆ Center

Vector2 _3DRadSpaceDll.Sprite.Center
getset

Center of rotation.

◆ Effects

SpriteEffects _3DRadSpaceDll.Sprite.Effects
getset

Effects applied to the sprite.

◆ IsUsedByCam2D

bool _3DRadSpaceDll.Sprite.IsUsedByCam2D
getset

Checks if this object is being used by a Camera2D.

◆ Layer

float _3DRadSpaceDll.Sprite.Layer
getset

Layer depth of the sprite.

◆ Mask

Color _3DRadSpaceDll.Sprite.Mask
getset

Color mask.

◆ Position

new Vector2 _3DRadSpaceDll.Sprite.Position
getset

Position of the sprite

◆ Rotation

new float _3DRadSpaceDll.Sprite.Rotation
getset

Rotation of the sprite in radians.

◆ Size

Vector2 _3DRadSpaceDll.Sprite.Size
getset

Size of the sprite.

◆ SpriteSheetSection

Rectangle? _3DRadSpaceDll.Sprite.SpriteSheetSection
getset

Section of a sprite sheet. If not used, set this to null;

◆ Texture

Texture2D _3DRadSpaceDll.Sprite.Texture
get

Texture used to draw the sprite.

Event Documentation

◆ OnClick

onClick _3DRadSpaceDll.Sprite.OnClick

Event called if the sprite is clicked