Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
Image Class Reference

A UI component for displaying images. More...

#include <image.h>

Inheritance diagram for Image:
[legend]

Public Member Functions

 Image (const std::string &image, int flip_x, int flip_y, int width, int height, Color color)
 
void update (float dt) override
 
int flip_x () const
 
Imageflip_x (int val)
 
int flip_y () const
 
Imageflip_y (int val)
 
int width () const
 
Imagewidth (int val)
 
int height () const
 
Imageheight (int val)
 
Color color () const
 
Imagecolor (Color color)
 
const Texturetexture () const
 
Imagetexture (const std::string &name)
 
Imagetexture (Texture &texture)
 
std::string type_name () const override
 Provides a consistent type name for the component.
 
- Public Member Functions inherited from Renderable
 Renderable ()
 
 Renderable (int layer)
 
 ~Renderable () override=default
 
Renderableorder_in_layer (int layer)
 
int order_in_layer () const
 
void set_render_strategy (Component &component)
 
virtual IRenderingStrategyrender_strategy () const
 
std::string type_name () const override
 Provides a consistent type name for the component.
 
Renderabledisable_draw () noexcept
 
Renderableenable_draw () noexcept
 
bool should_draw () const noexcept
 
- Public Member Functions inherited from Component
 Component ()
 
virtual ~Component ()=default
 
bool active () const noexcept
 Checks if the component is active.
 
Componentactive (bool value) noexcept
 
bool marked_for_deletion () const noexcept
 Activates the component.
 
Componentmark_for_deletion () noexcept
 
virtual void on_attach ()
 Called when the component is attached to a GameObject.
 
virtual void on_detach ()
 Called when the component is detached from a GameObject.
 
virtual void on_serialize (std::vector< uint8_t > &) const
 Serializes the component's state into a byte array.
 
virtual void on_deserialize (const std::vector< uint8_t > &, size_t &)
 Deserializes the component's state from a byte array.
 
const std::optional< std::reference_wrapper< GameObject > > & parent () const noexcept
 Gets the parent GameObject of this component.
 
std::optional< std::reference_wrapper< GameObject > > & parent () noexcept
 Gets the parent GameObject of this component.
 
Componentparent (GameObject &parent)
 
Componentparent (std::nullopt_t nullopt)
 
size_t add_on_attach (const std::function< void(Component &)> &action)
 Retrieves the type information of the component.
 
void remove_on_attach (size_t index)
 
size_t add_on_detach (const std::function< void(Component &)> &action)
 Adds an action to be performed when the component is attached.
 
void remove_on_detach (size_t index)
 

Additional Inherited Members

- Protected Attributes inherited from Renderable
std::unique_ptr< IRenderingStrategyrender_strategy_
 
int ordering_layer_ = 0
 
bool draw {true}
 

Detailed Description

A UI component for displaying images.

The Image component allows you to display images in the UI. You can set various properties such as flipping, size, and color tinting.

Usage:

  • Create an Image component with the desired image and properties.
  • Attach the Image component to a GameObject to display it in the UI.
  • Modify properties such as flip_x, flip_y, width, height, and color as needed.

Constructor & Destructor Documentation

◆ Image()

Image::Image ( const std::string &  image,
int  flip_x,
int  flip_y,
int  width,
int  height,
Color  color 
)

Member Function Documentation

◆ color() [1/2]

Color Image::color ( ) const

◆ color() [2/2]

Image & Image::color ( Color  color)

◆ flip_x() [1/2]

int Image::flip_x ( ) const

◆ flip_x() [2/2]

Image & Image::flip_x ( int  val)

◆ flip_y() [1/2]

int Image::flip_y ( ) const

◆ flip_y() [2/2]

Image & Image::flip_y ( int  val)

◆ height() [1/2]

int Image::height ( ) const

◆ height() [2/2]

Image & Image::height ( int  val)

◆ texture() [1/3]

const Texture & Image::texture ( ) const

◆ texture() [2/3]

Image & Image::texture ( const std::string &  name)

◆ texture() [3/3]

Image & Image::texture ( Texture texture)

◆ type_name()

std::string Image::type_name ( ) const
overridevirtual

Provides a consistent type name for the component.

Returns
A string representing the type name of the component. @CAUTION: All derived components must implement this method to ensure consistent serialization across different compilers and platforms.

Implements Component.

◆ update()

void Image::update ( float  dt)
overridevirtual

Implements Component.

◆ width() [1/2]

int Image::width ( ) const

◆ width() [2/2]

Image & Image::width ( int  val)

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