OpenMiner/include/world/World.hpp

60 lines
1.2 KiB
C++
Raw Normal View History

2014-12-18 07:02:48 +01:00
/*
* =====================================================================================
*
* Filename: World.hpp
*
2018-06-05 01:24:54 +02:00
* Description:
2014-12-18 07:02:48 +01:00
*
* Created: 16/12/2014 15:28:02
*
* Author: Quentin Bazin, <quent42340@gmail.com>
2014-12-18 07:02:48 +01:00
*
* =====================================================================================
*/
#ifndef WORLD_HPP_
#define WORLD_HPP_
#include <memory>
#include "Chunk.hpp"
#include "IDrawable.hpp"
#include "TerrainGenerator.hpp"
2014-12-18 07:02:48 +01:00
class Camera;
class World : public IDrawable {
2014-12-18 07:02:48 +01:00
public:
World();
2018-06-05 01:24:54 +02:00
2018-06-28 09:58:37 +02:00
void update(Player &player);
Chunk *getChunk(int cx, int cy, int cz) const;
2018-06-05 01:24:54 +02:00
u16 getBlock(int x, int y, int z) const;
void setBlock(int x, int y, int z, u16 id);
u16 getData(int x, int y, int z) const;
void setData(int x, int y, int z, u16 id);
BlockData *getBlockData(int x, int y, int z);
2014-12-23 16:15:44 +01:00
// Render distance in chunks
static u16 renderDistance;
static bool isReloadRequested;
2018-06-05 01:24:54 +02:00
2014-12-18 07:02:48 +01:00
private:
void draw(RenderTarget &target, RenderStates states) const override;
const s32 m_width = 32;
const s32 m_height = 4;
const s32 m_depth = 32;
2018-06-05 01:24:54 +02:00
Texture &m_texture;
2018-06-05 01:24:54 +02:00
2014-12-18 07:02:48 +01:00
std::vector<std::unique_ptr<Chunk>> m_chunks;
TerrainGenerator m_terrainGenerator;
2014-12-18 07:02:48 +01:00
};
#endif // WORLD_HPP_