chomik 0.2.1
experimental and minimalistic programming language

My name is Pawel Biernacki.
I am a software engineer.
This site is my hobby project.

Loading...
Searching...
No Matches
sdl_chomik.h
Go to the documentation of this file.
1#ifndef SDL_CHOMIK_H
2#define SDL_CHOMIK_H
3
4#include <SDL2/SDL.h>
5#include <SDL2/SDL_image.h>
6#include <SDL2/SDL_timer.h>
7#include <SDL2/SDL_ttf.h>
8
9#include "chomik.h"
10
11namespace sdl_chomik
12{
13 class image;
14 class font;
15
17 {
18 private:
19 SDL_Window* win;
20 SDL_Renderer * my_renderer;
21
22 std::vector<std::unique_ptr<image>> vector_of_images;
23
24 std::vector<std::unique_ptr<font>> vector_of_fonts;
25
26 int window_width, window_height;
27
28 bool close = false;
29
30 public:
31 machine(int w, int h);
32 virtual ~machine();
33
36
37 SDL_Renderer * get_renderer() { return my_renderer; }
38
39 void add_image(std::unique_ptr<image> && i)
40 {
41 vector_of_images.push_back(std::move(i));
42 }
43
44 void add_font(std::unique_ptr<font> && f)
45 {
46 vector_of_fonts.push_back(std::move(f));
47 }
48
49
50 virtual void create_predefined_variables() override;
51
52 virtual bool get_is_user_defined_executable(const chomik::signature & s) const override;
53
54 virtual void execute_user_defined_executable(const chomik::signature & s) override;
55
56 int get_last_created_image_index() const { return vector_of_images.size()-1; }
57
58 int get_last_created_font_index() const { return vector_of_fonts.size()-1; }
59 };
60
61 class image
62 {
63 private:
64 SDL_Texture* tex;
65 public:
66 image(machine & m, const std::string & file_path);
67 virtual ~image();
68
69 void render(machine & m, int x, int y);
70 };
71
72 class font
73 {
74 private:
75 TTF_Font * my_font;
76 public:
77 font(machine & m, const std::string & file_path, int font_size);
78 virtual ~font();
79 void render(machine & m, const std::string & t, int x, int y);
80 };
81
82}
83
84
85#endif
Definition chomik.h:3425
Definition chomik.h:473
Definition sdl_chomik.h:73
font(machine &m, const std::string &file_path, int font_size)
void render(machine &m, const std::string &t, int x, int y)
Definition sdl_chomik.h:62
image(machine &m, const std::string &file_path)
void render(machine &m, int x, int y)
Definition sdl_chomik.h:17
virtual void execute_user_defined_executable(const chomik::signature &s) override
void add_font(std::unique_ptr< font > &&f)
Definition sdl_chomik.h:44
int get_last_created_font_index() const
Definition sdl_chomik.h:58
virtual bool get_is_user_defined_executable(const chomik::signature &s) const override
virtual void create_predefined_variables() override
void add_image(std::unique_ptr< image > &&i)
Definition sdl_chomik.h:39
SDL_Renderer * get_renderer()
Definition sdl_chomik.h:37
int get_last_created_image_index() const
Definition sdl_chomik.h:56
machine(int w, int h)
Definition sdl_chomik.h:12

copyright by Pawel Biernacki

Vantaa 2022