Корабът Радецки - Eight ball pool v 1.0
The documnetation for our physics-themed project.
drawable.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <raylib.h>
4#include <iostream>
5#include <list>
6
7// DrawableManager - Consists of functions which make drawable management easier
8// The point of this is so you can create Drawables at any point in the program
9
10namespace DrawableManager
11{
13 {
14 private:
15 int id;
16
21 public:
22 Drawable();
23 virtual ~Drawable() = default;
24
25 virtual void Create() {}; // Gets called once whenever the program is initializing itself
26 virtual void Update() {}; // Gets called once per frame
27 virtual void Draw() {}; // Gets called once per frame (after Update)
28
29 int GetID()
30 {
31 return id;
32
38 }
39 };
40
44 void CreateAll();
45
49 void UpdateAll();
50
54 void DrawAll();
55
60
66 void DestroyDrawableFromID(int id);
67
77 Drawable* GetDrawableFromID(int id);
78};
Definition: drawable.hpp:13
virtual void Draw()
Definition: drawable.hpp:27
Drawable()
Sets the sprites' IDs.
Definition: drawable.cpp:8
virtual void Create()
Definition: drawable.hpp:25
virtual void Update()
Definition: drawable.hpp:26
virtual ~Drawable()=default
int GetID()
Definition: drawable.hpp:29
Definition: drawable.cpp:4
void DestroyDrawableFromID(int id)
Iterates through drawablePool and destroys the Drawable corresponding to the ID.
Definition: drawable.cpp:55
void UpdateAll()
Calls the Update() function for every Drawable in the drawablePool.
Definition: drawable.cpp:26
Drawable * GetDrawableFromID(int id)
Get the Drawable From ID object.
Definition: drawable.cpp:73
void CreateAll()
Calls the Create() function for every Drawable in the drawablePool.
Definition: drawable.cpp:18
void DestroyAllDrawables()
Destroys every Drawable in the drawablePool and clears drawablePool.
Definition: drawable.cpp:42
void DrawAll()
Calls the Draw() function for every Drawable in the drawablePool.
Definition: drawable.cpp:34