Komodo Engine
C PROJECT_LOGO=
Komodo.Core.ECS.Components.SpriteComponent Class Reference

Represents any 2D texture to be drawn in a Komodo.Core.ECS.Systems.Render2DSystem More...

Inheritance diagram for Komodo.Core.ECS.Components.SpriteComponent:
Komodo.Core.ECS.Components.Drawable2DComponent Komodo.Core.ECS.Components.Component

Public Member Functions

 SpriteComponent (Engine.Graphics.Texture texture, Effect shader)
 Creates a SpriteComponent with a given Komodo.Core.Engine.Graphics.Texture. More...
 
 SpriteComponent (string texturePath, Effect shader)
 Creates a SpriteComponent with a filepath to a compiled Microsoft.Xna.Framework.Graphics.Texture2D content file. More...
 

Public Attributes

override Vector2 Center => Texture != null ? new Vector2(Texture.Width / 2, Texture.Height / 2) : Vector2.Zero
 

Properties

override float Height [get]
 Y dimensional extremity. More...
 
Texture Texture [get, set]
 Raw texture data loaded from disk. More...
 
string TexturePath [get, set]
 Path of the Komodo.Core.Engine.Graphics.Texture if the SpriteComponent was provided a texture filepath via SpriteComponent.SpriteComponent(string, Effect). More...
 
override float Width [get]
 X dimensional extremity. More...
 
- Properties inherited from Komodo.Core.ECS.Components.Drawable2DComponent
abstract Vector2 Center [get]
 Center point of the rendered Component. More...
 
abstract float Height [get]
 Height of the rendered Component. More...
 
bool IsBillboard [get, set]
 Flags whether or not to draw the Drawable2DComponent as a billboard in 3D space, always facing the relevant Komodo.Core.ECS.Components.CameraComponent. More...
 
Effect Shader [get, set]
 Shader to use when rendering the Component. If Shader is null, the Komodo.Core.Game.DefaultSpriteShader will be used. More...
 
abstract float Width [get]
 Width of the rendered Component. More...
 
- Properties inherited from Komodo.Core.ECS.Components.Component
GameGame [get]
 Each Component maintains a reference to the Komodo.Core.Game instance. More...
 
Guid ID [get]
 Unique identifier for the Component. More...
 
bool IsEnabled [get, set]
 Enabled Components are managed by their corresponding Komodo.Core.ECS.Systems.ISystem, otherwise the Component is ignored. More...
 
bool IsInitialized [get, set]
 Uninitialized Components are initialized by their corresponding Komodo.Core.ECS.Systems.ISystem, otherwise the Component is initialized on the next Komodo.Core.ECS.Systems.ISystem.Initialize, Komodo.Core.ECS.Systems.ISystem.PreUpdate, or Komodo.Core.ECS.Systems.ISystem.PostUpdate methods. More...
 
Entity Parent [get, set]
 Each Component belongs to a Komodo.Core.ECS.Entities.Entity and maintains a reference to the parent Komodo.Core.ECS.Entities.Entity. More...
 
Vector3 Position [get, set]
 Each Component has a position relative to their Parent. More...
 
Vector3?? WorldPosition [get]
 The sum of Position and the Parent's Komodo.Core.ECS.Entities.Entity.Position, representing the Component's position in world space. More...
 
Vector3?? Rotation [get, set]
 Derived from the Parent's Komodo.Core.ECS.Entities.Entity.Rotation. More...
 
Matrix?? RotationMatrix [get]
 Derived from the Parent's Komodo.Core.ECS.Entities.Entity.RotationMatrix. More...
 
Quaternion?? RotationQuaternion [get]
 Derived from the Parent's Komodo.Core.ECS.Entities.Entity.RotationQuaternion. More...
 
Vector3?? Scale [get, set]
 Derived from the Parent's Komodo.Core.ECS.Entities.Entity.Scale. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Komodo.Core.ECS.Components.Drawable2DComponent
 Drawable2DComponent (bool isEnabled=true, Entity parent=null)
 
- Protected Member Functions inherited from Komodo.Core.ECS.Components.Component
 Component (bool isEnabled=true, Entity parent=null)
 

Detailed Description

Represents any 2D texture to be drawn in a Komodo.Core.ECS.Systems.Render2DSystem

Constructor & Destructor Documentation

◆ SpriteComponent() [1/2]

Komodo.Core.ECS.Components.SpriteComponent.SpriteComponent ( Engine.Graphics.Texture  texture,
Effect  shader 
)

Creates a SpriteComponent with a given Komodo.Core.Engine.Graphics.Texture.

Parameters
textureTexture reference containing the raw texture data.
shaderShader used for rendering in a Microsoft.Xna.Framework.Graphics.SpriteBatch.

◆ SpriteComponent() [2/2]

Komodo.Core.ECS.Components.SpriteComponent.SpriteComponent ( string  texturePath,
Effect  shader 
)

Creates a SpriteComponent with a filepath to a compiled Microsoft.Xna.Framework.Graphics.Texture2D content file.

The Microsoft.Xna.Framework.Graphics.Texture2D will be loaded from disk once the relevant Komodo.Core.ECS.Systems.Render2DSystem.Initialize, Komodo.Core.ECS.Systems.Render2DSystem.PreUpdate, or Komodo.Core.ECS.Systems.Render2DSystem.PostUpdate is called.

Parameters
texturePathFile path to a compiled Microsoft.Xna.Framework.Graphics.Model content file.
shaderShader used for rendering in a Microsoft.Xna.Framework.Graphics.SpriteBatch.

Property Documentation

◆ Height

override float Komodo.Core.ECS.Components.SpriteComponent.Height
get

Y dimensional extremity.

◆ Texture

Texture Komodo.Core.ECS.Components.SpriteComponent.Texture
getset

Raw texture data loaded from disk.

◆ TexturePath

string Komodo.Core.ECS.Components.SpriteComponent.TexturePath
getset

◆ Width

override float Komodo.Core.ECS.Components.SpriteComponent.Width
get

X dimensional extremity.