Initialization to prevent unforseen consequences
This commit is contained in:
parent
5162b49007
commit
01f749b81f
3 changed files with 15 additions and 15 deletions
|
|
@ -11,10 +11,10 @@ class TextureAtlas {
|
||||||
Rectangle full_view() const;
|
Rectangle full_view() const;
|
||||||
const Texture2D get_texture() const;
|
const Texture2D get_texture() const;
|
||||||
private:
|
private:
|
||||||
int offset_x;
|
int offset_x = 0;
|
||||||
int offset_y;
|
int offset_y = 0;
|
||||||
int width;
|
int width = 0;
|
||||||
int height;
|
int height = 0;
|
||||||
Texture2D* texture;
|
Texture2D* texture;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class Entity{
|
||||||
void queue_free();
|
void queue_free();
|
||||||
bool get_free_flag();
|
bool get_free_flag();
|
||||||
private:
|
private:
|
||||||
bool free_queued;
|
bool free_queued = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,11 +29,11 @@ class Pacman : public Entity{
|
||||||
const int fps = 24;
|
const int fps = 24;
|
||||||
private:
|
private:
|
||||||
TextureAtlas texture;
|
TextureAtlas texture;
|
||||||
int facing;
|
int facing = 0;
|
||||||
Rectangle getTextureRect() const;
|
Rectangle getTextureRect() const;
|
||||||
public:
|
public:
|
||||||
unsigned char frame;
|
unsigned char frame = 0.;
|
||||||
float time;
|
float time = 0.;
|
||||||
|
|
||||||
Pacman();
|
Pacman();
|
||||||
Pacman(Vector2 position);
|
Pacman(Vector2 position);
|
||||||
|
|
|
||||||
14
src/world.h
14
src/world.h
|
|
@ -19,13 +19,13 @@ class World {
|
||||||
public:
|
public:
|
||||||
World();
|
World();
|
||||||
~World();
|
~World();
|
||||||
bool debug;
|
bool debug = false;
|
||||||
std::vector<Entity*> entities; /// Main subjects of game world.
|
std::vector<Entity*> entities; /// Main subjects of game world.
|
||||||
Entity** grid; /// Grid representation
|
Entity** grid; /// Grid representation
|
||||||
float seconds_per_tick; /// Internal clock speed
|
float seconds_per_tick = 0.; /// Internal clock speed
|
||||||
int width;
|
int width = 0;
|
||||||
int height;
|
int height = 0;
|
||||||
int bound_offset;
|
int bound_offset = 1;
|
||||||
|
|
||||||
void setup(); /// Sets up game world.
|
void setup(); /// Sets up game world.
|
||||||
/// Should be called once when entites are set.
|
/// Should be called once when entites are set.
|
||||||
|
|
@ -42,9 +42,9 @@ class World {
|
||||||
void load_atlas();
|
void load_atlas();
|
||||||
Texture2D* get_atlas();
|
Texture2D* get_atlas();
|
||||||
int indexify_position(Vector2 vector);
|
int indexify_position(Vector2 vector);
|
||||||
int points;
|
int points = 0;
|
||||||
private:
|
private:
|
||||||
float clock;
|
float clock = 0.;
|
||||||
void update_grid();
|
void update_grid();
|
||||||
Texture2D texture_atlas;
|
Texture2D texture_atlas;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue