Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
Loading...
Searching...
No Matches
Graphics Class Reference

#include <graphics.hpp>

Public Member Functions

 Graphics ()
 
SDL_Texture * loadTexture (const std::string &path, Window *window, TextureScaling scaling=TextureScaling::NEAREST) const
 
void exit ()
 
void renderComponent (const Sprite &sprite, Window *window) const
 
void renderComponent (const ShapeSprite &sprite, Window *window) const
 
void renderComponent (const Label &label, Window *window) const
 
void renderComponent (const AnimatedSprite &sprite, Window *window) const
 
void renderComponent (const Tilemap &tilemap, Window *window) const
 
TTF_TextEngine * getTextEngine () const
 

Detailed Description

Graphics

The Graphics service is mostly made for internal use. It allows rendering sprites, labels, and other components on screen.

For anything to actually render on the screen you also need a Window.

// Create the graphics class and a window with a 480x272 resolution, the window title of "my window title", letterbox presentation style and black clear color.
auto window = std::make_shared<Window>("my window title", Rect({0, 0}, {480, 272}), RenderLogicalPresentation::LETTERBOX, WindowFlags::RESIZABLE, Color::BLACK);
engine.appendWindow(window);
Graphics graphics = Graphics();
static const Color BLACK
Definition definitions.hpp:59
Definition graphics.hpp:26
Graphics()
Definition graphics.cpp:19
Definition definitions.hpp:294

Constructor & Destructor Documentation

◆ Graphics()

Graphics::Graphics ( )

Member Function Documentation

◆ exit()

void Graphics::exit ( )

◆ getTextEngine()

TTF_TextEngine * Graphics::getTextEngine ( ) const

◆ loadTexture()

SDL_Texture * Graphics::loadTexture ( const std::string &  path,
Window window,
TextureScaling  scaling = TextureScaling::NEAREST 
) const

◆ renderComponent() [1/5]

void Graphics::renderComponent ( const AnimatedSprite sprite,
Window window 
) const

◆ renderComponent() [2/5]

void Graphics::renderComponent ( const Label label,
Window window 
) const

◆ renderComponent() [3/5]

void Graphics::renderComponent ( const ShapeSprite sprite,
Window window 
) const

◆ renderComponent() [4/5]

void Graphics::renderComponent ( const Sprite sprite,
Window window 
) const

◆ renderComponent() [5/5]

void Graphics::renderComponent ( const Tilemap tilemap,
Window window 
) const

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