cangine
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
cangine::QuadRendererComponent Class Reference

Component that draws its game object as a textured rectangle. More...

#include <quadrenderer_component.hpp>

Inheritance diagram for cangine::QuadRendererComponent:
Inheritance graph
[legend]
Collaboration diagram for cangine::QuadRendererComponent:
Collaboration graph
[legend]

Public Member Functions

void firstFrame () override
 Called once before the first frame update.
 
void frame (double deltaTime) override
 Called every frame to update the component.
 
virtual void setTexture (Texture &t)
 Sets the texture applied to the quad.
 
virtual void setRectWidth (int widthIn)
 Sets the rectangle width.
 
virtual void setRectHeight (int heightIn)
 Sets the rectangle height.
 
virtual void setRectColor (Color colorIn)
 Sets the rectangle fill color.
 
Rectangle * getRect ()
 Returns the underlying rectangle.
 
Vector3 getRectPos ()
 Returns the rectangle's position.
 
Vector2 getRectSize ()
 Returns the rectangle's size.
 
- Public Member Functions inherited from cangine::IComponent
 IComponent (GameObject *gameObject=nullptr)
 Constructs the component, optionally bound to a game object.
 
virtual ~IComponent ()
 
GameObject * getGameObject () const
 Returns the game object this component is attached to.
 
virtual void onMouseEvent (const MouseEvent *e)
 Called when a mouse event is dispatched to the owning object.
 

Protected Attributes

QuadRenderer * qr
 Renderer used to draw the quad.
 
Texture * texture
 Texture applied to the quad, if any.
 
Transform * transform
 Cached transform of the owning object.
 
Rectangle rect
 Rectangle geometry to draw.
 

Additional Inherited Members

- Public Attributes inherited from cangine::IComponent
bool isUnique = true
 If true, only one of this component type may exist per object.
 

Detailed Description

Component that draws its game object as a textured rectangle.

Each frame it submits a rectangle (sized/colored via the setters, placed by the object's Transform) to the QuadRenderer.

Member Function Documentation

◆ firstFrame()

void cangine::QuadRendererComponent::firstFrame ( )
overridevirtual

Called once before the first frame update.

Reimplemented from cangine::IComponent.

◆ frame()

void cangine::QuadRendererComponent::frame ( double  deltaTime)
overridevirtual

Called every frame to update the component.

Parameters
deltaTimeSeconds elapsed since the previous frame.

Reimplemented from cangine::IComponent.

◆ getRect()

Rectangle * cangine::QuadRendererComponent::getRect ( )

Returns the underlying rectangle.

Returns
Pointer to the rectangle geometry.

◆ getRectPos()

Vector3 cangine::QuadRendererComponent::getRectPos ( )

Returns the rectangle's position.

Returns
Rectangle position.

◆ getRectSize()

Vector2 cangine::QuadRendererComponent::getRectSize ( )

Returns the rectangle's size.

Returns
Width and height as a vector.

◆ setRectColor()

void cangine::QuadRendererComponent::setRectColor ( Color  colorIn)
virtual

Sets the rectangle fill color.

Parameters
colorInNew color.

Reimplemented in cangine::PanelComponent.

◆ setRectHeight()

void cangine::QuadRendererComponent::setRectHeight ( int  heightIn)
virtual

Sets the rectangle height.

Parameters
heightInNew height.

Reimplemented in cangine::PanelComponent.

◆ setRectWidth()

void cangine::QuadRendererComponent::setRectWidth ( int  widthIn)
virtual

Sets the rectangle width.

Parameters
widthInNew width.

Reimplemented in cangine::PanelComponent.

◆ setTexture()

void cangine::QuadRendererComponent::setTexture ( Texture &  t)
virtual

Sets the texture applied to the quad.

Parameters
tTexture to use.

Member Data Documentation

◆ qr

QuadRenderer* cangine::QuadRendererComponent::qr
protected

Renderer used to draw the quad.

◆ rect

Rectangle cangine::QuadRendererComponent::rect
protected

Rectangle geometry to draw.

◆ texture

Texture* cangine::QuadRendererComponent::texture
protected

Texture applied to the quad, if any.

◆ transform

Transform* cangine::QuadRendererComponent::transform
protected

Cached transform of the owning object.


The documentation for this class was generated from the following files: