Initialization to prevent unforseen consequences

This commit is contained in:
Rendo 2026-03-14 15:25:25 +05:00
commit 01f749b81f
3 changed files with 15 additions and 15 deletions

View file

@ -11,10 +11,10 @@ class TextureAtlas {
Rectangle full_view() const;
const Texture2D get_texture() const;
private:
int offset_x;
int offset_y;
int width;
int height;
int offset_x = 0;
int offset_y = 0;
int width = 0;
int height = 0;
Texture2D* texture;
};

View file

@ -19,7 +19,7 @@ class Entity{
void queue_free();
bool get_free_flag();
private:
bool free_queued;
bool free_queued = false;
};
@ -29,11 +29,11 @@ class Pacman : public Entity{
const int fps = 24;
private:
TextureAtlas texture;
int facing;
int facing = 0;
Rectangle getTextureRect() const;
public:
unsigned char frame;
float time;
unsigned char frame = 0.;
float time = 0.;
Pacman();
Pacman(Vector2 position);

View file

@ -19,13 +19,13 @@ class World {
public:
World();
~World();
bool debug;
bool debug = false;
std::vector<Entity*> entities; /// Main subjects of game world.
Entity** grid; /// Grid representation
float seconds_per_tick; /// Internal clock speed
int width;
int height;
int bound_offset;
float seconds_per_tick = 0.; /// Internal clock speed
int width = 0;
int height = 0;
int bound_offset = 1;
void setup(); /// Sets up game world.
/// Should be called once when entites are set.
@ -42,9 +42,9 @@ class World {
void load_atlas();
Texture2D* get_atlas();
int indexify_position(Vector2 vector);
int points;
int points = 0;
private:
float clock;
float clock = 0.;
void update_grid();
Texture2D texture_atlas;
};