Add files via upload

This commit is contained in:
Onran
2024-02-23 11:45:55 +09:00
committed by GitHub
parent cfacf6f1eb
commit 549b392871
5 changed files with 31 additions and 70 deletions
+1 -2
View File
@@ -7,7 +7,6 @@ struct voxel;
class Content;
class WorldGenerator {
protected:
blockid_t const idStone;
blockid_t const idDirt;
blockid_t const idGrassBlock;
@@ -20,7 +19,7 @@ protected:
blockid_t const idBazalt;
public:
WorldGenerator(const Content* content);
virtual void generate(voxel* voxels, int x, int z, int seed);
void generate(voxel* voxels, int x, int z, int seed);
};
#endif /* VOXELS_WORLDGENERATOR_H_ */
+4
View File
@@ -318,6 +318,10 @@ const char* Window::getClipboardText() {
return glfwGetClipboardString(window);
}
void Window::setClipboardText(const char* text) {
glfwSetClipboardString(window, text);
}
bool Window::tryToMaximize(GLFWwindow* window, GLFWmonitor* monitor) {
glm::ivec4 windowFrame(0);
glm::ivec4 workArea(0);
+1
View File
@@ -55,6 +55,7 @@ public:
static void setBgColor(glm::vec4 color);
static double time();
static const char* getClipboardText();
static void setClipboardText(const char* text);
static DisplaySettings* getSettings();
static void setBlendMode(blendmode mode);
+1 -30
View File
@@ -6,7 +6,6 @@
#include "Level.h"
#include "../files/WorldFiles.h"
#include "../world/WorldTypes.h"
#include "../content/Content.h"
#include "../content/ContentLUT.h"
#include "../voxels/Chunk.h"
@@ -35,23 +34,6 @@ World::World(
wfile = new WorldFiles(directory, settings.debug);
}
World::World(
std::string name,
std::string type,
fs::path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content,
const std::vector<ContentPack> packs)
: name(name),
type(type),
seed(seed),
settings(settings),
content(content),
packs(packs) {
wfile = new WorldFiles(directory, settings.debug);
}
World::~World(){
delete wfile;
}
@@ -83,13 +65,12 @@ void World::write(Level* level) {
}
Level* World::create(std::string name,
std::string type,
fs::path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content,
const std::vector<ContentPack>& packs) {
auto world = new World(name, type, directory, seed, settings, content, packs);
auto world = new World(name, directory, seed, settings, content, packs);
auto level = new Level(world, content, settings);
auto inventory = level->player->getInventory();
inventory->setId(world->getNextInventoryId());
@@ -150,23 +131,14 @@ uint64_t World::getSeed() const {
return seed;
}
std::string World::getType() const {
return type;
}
const std::vector<ContentPack>& World::getPacks() const {
return packs;
}
void World::deserialize(dynamic::Map* root) {
name = root->getStr("name", name);
type = root->getStr("type", type);
seed = root->getInt("seed", seed);
if(type == "") {
type = WorldTypes::getDefaultWorldType();
}
auto verobj = root->map("version");
if (verobj) {
int major=0, minor=-1;
@@ -193,7 +165,6 @@ std::unique_ptr<dynamic::Map> World::serialize() const {
versionobj.put("minor", ENGINE_VERSION_MINOR);
root->put("name", name);
root->put("type", type);
root->put("seed", seed);
auto& timeobj = root->putMap("time");
-14
View File
@@ -28,7 +28,6 @@ public:
class World : public Serializable {
std::string name;
std::string type;
uint64_t seed;
EngineSettings& settings;
const Content* const content;
@@ -53,15 +52,6 @@ public:
EngineSettings& settings,
const Content* content,
std::vector<ContentPack> packs);
World(std::string name,
std::string type,
fs::path directory,
uint64_t seed,
EngineSettings& settings,
const Content* content,
std::vector<ContentPack> packs);
~World();
/**
@@ -87,7 +77,6 @@ public:
* Create new world
* @param name internal world name
* @param directory root world directory
* @param type of the world
* @param seed world generation seed
* @param settings current engine settings
* @param content current engine Content instance
@@ -96,7 +85,6 @@ public:
* @return Level instance containing World instance
*/
static Level* create(std::string name,
std::string type,
fs::path directory,
uint64_t seed,
EngineSettings& settings,
@@ -136,8 +124,6 @@ public:
/** Get world generation seed */
uint64_t getSeed() const;
/** Get world type */
std::string getType() const;
/**
* Get vector of all content-packs installed in world
*/