16#include <SDL3/SDL_video.h>
17#include <SDL3/SDL_init.h>
18#include <SDL3/SDL_render.h>
19#include <SDL3_ttf/SDL_ttf.h>
50 if ((
x != v.
x) || (
y != v.
y)) {
SDL_Texture * texture
SDL texture.
Definition classes.hpp:89
TTF_TextEngine * text_renderer
TTF engine what is tied to World::renderer to easly render text.
Definition classes.hpp:88
SDL_Window * window
SDL window.
Definition classes.hpp:86
bool checkIfCanMove(Vector2 pos, PixelMap *new_pixel_map)
Checks if position on the screen is avalible for movement.
Definition classes.cpp:137
PixelMap pixel_map
PixelMap what contains all phical object pixels.
Definition classes.hpp:92
SDL_AppResult redrawWorld()
Redraws pixels on the screen, calls recalcWorld() and addPixel().
Definition classes.cpp:213
SDL_AppResult initWorld()
Function what defines World::window, World::texture and World::font.
Definition classes.cpp:63
void clearWorld()
Complitely clears pixel_map.
Definition classes.cpp:58
TTF_Font * font
Fonts that are used for the text on the screen.
Definition classes.hpp:90
PixelType selected_pixel_type
Currently selected PixelType, used in addPixel().
Definition classes.hpp:214
void addPixel()
Adds new pixel to pixel_map in a radius of BRUSH_SPREAD.
Definition classes.cpp:110
void recalcWorld()
Recalculates position of each pixel in pixel_map according to their physic behavior.
Definition classes.cpp:147
static World * getIstance()
Function what returns the worlds instance. If it's nullptr inwokes World().
Definition classes.hpp:228
World(const World &obj)=delete
Remove copy constructor.
Vector2 window_size
Window width and height in pixels devided by PIXEL_SIZE.
Definition classes.hpp:91
bool mouse_is_down
Stores current state of the mouse button, used in redrawWorld() to detect then addPixel() should be i...
Definition classes.hpp:213
static World * instance
Poiner to the one existing instance of the world.
Definition classes.hpp:85
SDL_Color bg_color
Background color of the screen.
Definition classes.hpp:93
SDL_Renderer * renderer
SDL renderer.
Definition classes.hpp:87
World()
Class constructor, here we define World::bg_color and World::selected_pixel_type.
Definition classes.cpp:47
PixelType
Enum that represents pixel type as a physical object.
Definition classes.hpp:29
std::map< std::pair< int, int >, Pixel > PixelMap
Map with key being std::pair<int, int> that represents pixel position in 2D space on the screen,...
Definition classes.hpp:73
Enum that represents pixel type as a physical object.
Definition classes.hpp:63
PixelType type
PixelType.
Definition classes.hpp:65
SDL_Color color
Color of the pixel.
Definition classes.hpp:64
Struct what represends objects position in 2D space.
Definition classes.hpp:39
int y
Y coordinate.
Definition classes.hpp:41
int x
X coordinate.
Definition classes.hpp:40
bool operator!=(Vector2 v)
Compares Vector2's.
Definition classes.hpp:49