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

#include <definitions.hpp>

Inheritance diagram for Window:

Public Member Functions

 Window (std::string title="Calamity App", Rect dimensions=Rect({0, 0}, {480, 272}), RenderLogicalPresentation presentation=RenderLogicalPresentation::LETTERBOX, WindowFlags flags=WindowFlags::RESIZABLE, Color clearColor=Color::BLACK, bool fullscreen=false)
 
 ~Window ()
 
void resetLogicalPresentation ()
 
void exit ()
 
void initialize ()
 
void render (Graphics &graphics, Engine *engine)
 
void physicsUpdate ()
 
void update (float deltaTime)
 
void setActiveCamera (Camera *camera)
 
CameragetActiveCamera () const
 
template<class Archive >
void save (Archive &ar) const
 
template<class Archive >
void load (Archive &ar)
 

Public Attributes

std::string title
 
WindowFlags flags
 
RenderLogicalPresentation presentation
 
Rect dimensions
 
Color clearColor
 
std::unique_ptr< Noderoot
 
bool fullscreen
 
int id = 0
 
SDL_Window * window = nullptr
 
SDL_Renderer * renderer = nullptr
 

Detailed Description

Window

The Window class represents a window on the screen. It contains a root node which is the parent of all nodes that are rendered to that window.

When constructing a window, you can define the screen size, window title, presentation type, clear color and fullscreen mode:

auto window = std::make_shared<Window>("my window title", Rect({0, 0}, {480, 272}), RenderLogicalPresentation::LETTERBOX, WindowFlags::RESIZABLE, Color::BLACK, true);
static const Color BLACK
Definition definitions.hpp:59
SDL_Window * window
Definition definitions.hpp:86
Definition definitions.hpp:294

Any window created must also be appended to the Engine class:

engine.appendWindow(window);

Afterwards, any nodes that are children of the window's root node will be rendered to the screen:

window->root->addChild(myNode);

Constructor & Destructor Documentation

◆ Window()

Window::Window ( std::string  title = "Calamity App",
Rect  dimensions = Rect({0, 0}, {480, 272}),
RenderLogicalPresentation  presentation = RenderLogicalPresentation::LETTERBOX,
WindowFlags  flags = WindowFlags::RESIZABLE,
Color  clearColor = Color::BLACK,
bool  fullscreen = false 
)

◆ ~Window()

Window::~Window ( )

Member Function Documentation

◆ exit()

void Window::exit ( )

◆ getActiveCamera()

Camera * Window::getActiveCamera ( ) const

◆ initialize()

void Window::initialize ( )

◆ load()

template<class Archive >
void Window::load ( Archive &  ar)

◆ physicsUpdate()

void Window::physicsUpdate ( )

◆ render()

void Window::render ( Graphics graphics,
Engine engine 
)

◆ resetLogicalPresentation()

void Window::resetLogicalPresentation ( )

◆ save()

template<class Archive >
void Window::save ( Archive &  ar) const
inline

◆ setActiveCamera()

void Window::setActiveCamera ( Camera camera)

◆ update()

void Window::update ( float  deltaTime)

Member Data Documentation

◆ clearColor

Color Window::clearColor

◆ dimensions

Rect Window::dimensions

◆ flags

WindowFlags Window::flags

◆ fullscreen

bool Window::fullscreen

◆ id

int Window::id = 0

◆ presentation

RenderLogicalPresentation Window::presentation

◆ renderer

SDL_Renderer* Window::renderer = nullptr

◆ root

std::unique_ptr<Node> Window::root

◆ title

std::string Window::title

◆ window

SDL_Window* Window::window = nullptr

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