Golias Engine
A C++ 20 'game engine' built with SDL3 with wide platform support.
Classes | Public Member Functions | List of all members
RenderingCanvas Class Reference

#include <rendering_canvas.h>

Public Member Functions

 RenderingCanvas (RenderingDevice *device)
 
 ~RenderingCanvas ()
 
bool initialize (int window_width, int window_height)
 
void shutdown ()
 
void begin (const Color &color=Color::BLACK)
 
void end ()
 
void set_camera (const glm::mat4 &view_projection)
 
void reset_camera ()
 
void set_viewport_size (int width, int height)
 
void set_scale_mode (ScaleMode mode)
 
void draw_rect (float x, float y, float width, float height, const Color &color=Color::WHITE, float rotation=0.0f)
 
void draw_rect_outlined (float x, float y, float width, float height, const Color &color=Color::WHITE, float thickness=1.0f)
 
void draw_circle (float x, float y, float radius, const Color &color=Color::WHITE, int segments=32)
 
void draw_circle_outlined (float x, float y, float radius, const Color &color=Color::WHITE, float thickness=1.0f, int segments=32)
 
void draw_arc (float x, float y, float radius, float start_angle, float end_angle, const Color &color=Color::WHITE, int segments=32)
 
void draw_line (float x1, float y1, float x2, float y2, const Color &color=Color::WHITE, float thickness=1.0f)
 
void draw_triangle (float x1, float y1, float x2, float y2, float x3, float y3, const Color &color=Color::WHITE)
 
void draw_polygon (const Vector< glm::vec2 > &points, const Color &color=Color::WHITE)
 
void draw_texture (RID texture, float x, float y, float width=0, float height=0, const Color &tint=Color::WHITE, float rotation=0.0f)
 
void draw_custom (RID shader, float x, float y, float width, float height, RID texture=INVALID_RID, const Color &color=Color::WHITE)
 
void draw_texture_ex (float x, float y, float width, float height, RID texture=INVALID_RID, const Rect &source={0, 0, 0, 0}, const Color &color=Color::WHITE, float rotation=0.0f, bool flip_h=false, bool flip_v=false, const CanvasMaterial *material=nullptr)
 
template<typename... Args>
void draw_text (Font font, float x, float y, const Color &color, const char *format_str, Args &&... args)
 
void draw_text (Font font, float x, float y, const Color &color, const String &text)
 
void draw_text (float x, float y, const Color &color, const String &text)
 
Font load_font_from_file (const char *filepath, int size)
 
RID load_texture (const char *filepath)
 
RID load_texture (const char *filepath, const TextureDescription &desc)
 
Texture load_texture_from_file (const char *filepath)
 
Texture load_texture_from_file (const char *filepath, const TextureDescription &desc)
 
void get_texture_size (RID texture, uint32_t &out_width, uint32_t &out_height)
 
RID load_texture_from_memory (void *data, int width, int height, int channels=4)
 
void unload_texture (RID texture)
 
RID load_shader_from_source (const char *vertex_src, const char *fragment_src)
 
RID load_shader_from_file (const char *filepath)
 
RID load_shader_from_source (const char *source)
 
void destroy_shader (RID shader)
 
void set_blend_mode (BlendMode mode)
 
void set_line_width (float width)
 
void present ()
 
RenderingDeviceget_rendering_device () const
 

Constructor & Destructor Documentation

◆ RenderingCanvas()

RenderingCanvas::RenderingCanvas ( RenderingDevice device)
explicit

◆ ~RenderingCanvas()

RenderingCanvas::~RenderingCanvas ( )

Member Function Documentation

◆ begin()

void RenderingCanvas::begin ( const Color color = Color::BLACK)

◆ destroy_shader()

void RenderingCanvas::destroy_shader ( RID  shader)

◆ draw_arc()

void RenderingCanvas::draw_arc ( float  x,
float  y,
float  radius,
float  start_angle,
float  end_angle,
const Color color = Color::WHITE,
int  segments = 32 
)

◆ draw_circle()

void RenderingCanvas::draw_circle ( float  x,
float  y,
float  radius,
const Color color = Color::WHITE,
int  segments = 32 
)

◆ draw_circle_outlined()

void RenderingCanvas::draw_circle_outlined ( float  x,
float  y,
float  radius,
const Color color = Color::WHITE,
float  thickness = 1.0f,
int  segments = 32 
)

◆ draw_custom()

void RenderingCanvas::draw_custom ( RID  shader,
float  x,
float  y,
float  width,
float  height,
RID  texture = INVALID_RID,
const Color color = Color::WHITE 
)
Deprecated:
Use draw_texture_ex with a CanvasMaterial (optional) instead

◆ draw_line()

void RenderingCanvas::draw_line ( float  x1,
float  y1,
float  x2,
float  y2,
const Color color = Color::WHITE,
float  thickness = 1.0f 
)

◆ draw_polygon()

void RenderingCanvas::draw_polygon ( const Vector< glm::vec2 > &  points,
const Color color = Color::WHITE 
)

◆ draw_rect()

void RenderingCanvas::draw_rect ( float  x,
float  y,
float  width,
float  height,
const Color color = Color::WHITE,
float  rotation = 0.0f 
)

◆ draw_rect_outlined()

void RenderingCanvas::draw_rect_outlined ( float  x,
float  y,
float  width,
float  height,
const Color color = Color::WHITE,
float  thickness = 1.0f 
)

◆ draw_text() [1/3]

void RenderingCanvas::draw_text ( float  x,
float  y,
const Color color,
const String text 
)

◆ draw_text() [2/3]

template<typename... Args>
void RenderingCanvas::draw_text ( Font  font,
float  x,
float  y,
const Color color,
const char *  format_str,
Args &&...  args 
)

◆ draw_text() [3/3]

void RenderingCanvas::draw_text ( Font  font,
float  x,
float  y,
const Color color,
const String text 
)

◆ draw_texture()

void RenderingCanvas::draw_texture ( RID  texture,
float  x,
float  y,
float  width = 0,
float  height = 0,
const Color tint = Color::WHITE,
float  rotation = 0.0f 
)

◆ draw_texture_ex()

void RenderingCanvas::draw_texture_ex ( float  x,
float  y,
float  width,
float  height,
RID  texture = INVALID_RID,
const Rect source = {0, 0, 0, 0},
const Color color = Color::WHITE,
float  rotation = 0.0f,
bool  flip_h = false,
bool  flip_v = false,
const CanvasMaterial material = nullptr 
)

TODO: get from engine DT

◆ draw_triangle()

void RenderingCanvas::draw_triangle ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3,
const Color color = Color::WHITE 
)

◆ end()

void RenderingCanvas::end ( )

◆ get_rendering_device()

RenderingDevice * RenderingCanvas::get_rendering_device ( ) const

◆ get_texture_size()

void RenderingCanvas::get_texture_size ( RID  texture,
uint32_t &  out_width,
uint32_t &  out_height 
)

◆ initialize()

bool RenderingCanvas::initialize ( int  window_width,
int  window_height 
)

◆ load_font_from_file()

Font RenderingCanvas::load_font_from_file ( const char *  filepath,
int  size 
)

◆ load_shader_from_file()

RID RenderingCanvas::load_shader_from_file ( const char *  filepath)

◆ load_shader_from_source() [1/2]

RID RenderingCanvas::load_shader_from_source ( const char *  source)

◆ load_shader_from_source() [2/2]

RID RenderingCanvas::load_shader_from_source ( const char *  vertex_src,
const char *  fragment_src 
)

◆ load_texture() [1/2]

RID RenderingCanvas::load_texture ( const char *  filepath)

◆ load_texture() [2/2]

RID RenderingCanvas::load_texture ( const char *  filepath,
const TextureDescription desc 
)

◆ load_texture_from_file() [1/2]

Texture RenderingCanvas::load_texture_from_file ( const char *  filepath)

◆ load_texture_from_file() [2/2]

Texture RenderingCanvas::load_texture_from_file ( const char *  filepath,
const TextureDescription desc 
)

◆ load_texture_from_memory()

RID RenderingCanvas::load_texture_from_memory ( void *  data,
int  width,
int  height,
int  channels = 4 
)

◆ present()

void RenderingCanvas::present ( )

◆ reset_camera()

void RenderingCanvas::reset_camera ( )

◆ set_blend_mode()

void RenderingCanvas::set_blend_mode ( BlendMode  mode)

◆ set_camera()

void RenderingCanvas::set_camera ( const glm::mat4 &  view_projection)

◆ set_line_width()

void RenderingCanvas::set_line_width ( float  width)

◆ set_scale_mode()

void RenderingCanvas::set_scale_mode ( ScaleMode  mode)

◆ set_viewport_size()

void RenderingCanvas::set_viewport_size ( int  width,
int  height 
)

◆ shutdown()

void RenderingCanvas::shutdown ( )

◆ unload_texture()

void RenderingCanvas::unload_texture ( RID  texture)

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