You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
879 B
C
47 lines
879 B
C
3 years ago
|
#ifndef WORLD_H
|
||
|
#define WORLD_H
|
||
|
|
||
|
#include "enemy.h"
|
||
|
#include "resourceholder.h"
|
||
|
#include "scenenode.h"
|
||
|
#include <queue>
|
||
|
#include <SFML/System.hpp>
|
||
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||
|
|
||
|
class World : private sf::NonCopyable
|
||
|
{
|
||
|
public:
|
||
|
explicit World(sf::RenderWindow& window);
|
||
|
|
||
|
void update(const sf::Time& dt);
|
||
|
void draw();
|
||
|
|
||
|
std::queue<Command>& getCommandQueue();
|
||
|
|
||
|
private:
|
||
|
bool loadTextures();
|
||
|
void buildScene();
|
||
|
|
||
|
enum Layer
|
||
|
{
|
||
|
Background,
|
||
|
Air,
|
||
|
LayerCount
|
||
|
};
|
||
|
|
||
|
std::queue<Command> queue_commands;
|
||
|
|
||
|
sf::RenderWindow& world_window;
|
||
|
sf::View world_view;
|
||
|
TextureHolder texture_holder;
|
||
|
SceneNodeSPtr scene_graph;
|
||
|
std::array<SceneNodeSPtr, LayerCount> arr_layers;
|
||
|
|
||
|
sf::FloatRect world_bounds;
|
||
|
sf::Vector2f world_spawn_pos;
|
||
|
float world_speed;
|
||
|
EnemySPtr player;
|
||
|
};
|
||
|
|
||
|
#endif // WORLD_H
|