minor refactor
This commit is contained in:
parent
ded80e0d4b
commit
bfe2e2557b
@ -1,6 +1,4 @@
|
|||||||
#include "definitions.h"
|
#include "core_defs.h"
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
|
|
||||||
#include "items/ItemDef.h"
|
#include "items/ItemDef.h"
|
||||||
#include "content/Content.h"
|
#include "content/Content.h"
|
||||||
@ -9,11 +7,9 @@
|
|||||||
#include "window/input.h"
|
#include "window/input.h"
|
||||||
#include "voxels/Block.h"
|
#include "voxels/Block.h"
|
||||||
|
|
||||||
using glm::vec3;
|
|
||||||
|
|
||||||
// All in-game definitions (blocks, items, etc..)
|
// All in-game definitions (blocks, items, etc..)
|
||||||
void setup_definitions(ContentBuilder* builder) { // Strange function, need to REDO ?
|
void corecontent::setup(ContentBuilder* builder) {
|
||||||
Block* block = new Block("core:air", "air");
|
Block* block = builder->createBlock("core:air");
|
||||||
block->replaceable = true;
|
block->replaceable = true;
|
||||||
block->drawGroup = 1;
|
block->drawGroup = 1;
|
||||||
block->lightPassing = true;
|
block->lightPassing = true;
|
||||||
@ -22,13 +18,12 @@ void setup_definitions(ContentBuilder* builder) { // Strange function, need to R
|
|||||||
block->selectable = false;
|
block->selectable = false;
|
||||||
block->model = BlockModel::none;
|
block->model = BlockModel::none;
|
||||||
block->pickingItem = "core:empty";
|
block->pickingItem = "core:empty";
|
||||||
builder->add(block);
|
|
||||||
|
|
||||||
ItemDef* item = builder->createItem("core:empty");
|
ItemDef* item = builder->createItem("core:empty");
|
||||||
item->iconType = item_icon_type::none;
|
item->iconType = item_icon_type::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup_bindings() {
|
void corecontent::setup_bindings() {
|
||||||
Events::bind(BIND_MOVE_FORWARD, inputtype::keyboard, keycode::W);
|
Events::bind(BIND_MOVE_FORWARD, inputtype::keyboard, keycode::W);
|
||||||
Events::bind(BIND_MOVE_BACK, inputtype::keyboard, keycode::S);
|
Events::bind(BIND_MOVE_BACK, inputtype::keyboard, keycode::S);
|
||||||
Events::bind(BIND_MOVE_RIGHT, inputtype::keyboard, keycode::D);
|
Events::bind(BIND_MOVE_RIGHT, inputtype::keyboard, keycode::D);
|
||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
const std::string TEXTURE_NOTFOUND = "notfound";
|
const std::string TEXTURE_NOTFOUND = "notfound";
|
||||||
|
|
||||||
/* bindings used in engine code */
|
/* bindings used in engine code */
|
||||||
@ -24,4 +23,11 @@ const std::string BIND_PLAYER_BUILD = "player.build";
|
|||||||
const std::string BIND_PLAYER_PICK = "player.pick";
|
const std::string BIND_PLAYER_PICK = "player.pick";
|
||||||
const std::string BIND_HUD_INVENTORY = "hud.inventory";
|
const std::string BIND_HUD_INVENTORY = "hud.inventory";
|
||||||
|
|
||||||
|
class ContentBuilder;
|
||||||
|
|
||||||
|
namespace corecontent {
|
||||||
|
extern void setup_bindings();
|
||||||
|
extern void setup(ContentBuilder* builder);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // SRC_CORE_DEFS_H_
|
#endif // SRC_CORE_DEFS_H_
|
||||||
@ -1,13 +0,0 @@
|
|||||||
#ifndef DECLARATIONS_H
|
|
||||||
#define DECLARATIONS_H
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "core_defs.h"
|
|
||||||
|
|
||||||
class ContentBuilder;
|
|
||||||
|
|
||||||
extern void setup_bindings();
|
|
||||||
extern void setup_definitions(ContentBuilder* builder);
|
|
||||||
|
|
||||||
#endif // DECLARATIONS_H
|
|
||||||
|
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#include "frontend/locale/langs.h"
|
#include "frontend/locale/langs.h"
|
||||||
#include "logic/scripting/scripting.h"
|
#include "logic/scripting/scripting.h"
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "core_defs.h"
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ inline const std::string checkPacks(const std::unordered_set<std::string>& packs
|
|||||||
void Engine::loadContent() {
|
void Engine::loadContent() {
|
||||||
auto resdir = paths->getResources();
|
auto resdir = paths->getResources();
|
||||||
ContentBuilder contentBuilder;
|
ContentBuilder contentBuilder;
|
||||||
setup_definitions(&contentBuilder);
|
corecontent::setup(&contentBuilder);
|
||||||
paths->setContentPacks(&contentPacks);
|
paths->setContentPacks(&contentPacks);
|
||||||
|
|
||||||
std::vector<fs::path> resRoots;
|
std::vector<fs::path> resRoots;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "core_defs.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "util/platform.h"
|
#include "util/platform.h"
|
||||||
#include "coders/toml.h"
|
#include "coders/toml.h"
|
||||||
@ -38,7 +38,7 @@ int main(int argc, char** argv) {
|
|||||||
toml::Reader reader(wrapper.get(), settings_file.string(), text);
|
toml::Reader reader(wrapper.get(), settings_file.string(), text);
|
||||||
reader.read();
|
reader.read();
|
||||||
}
|
}
|
||||||
setup_bindings();
|
corecontent::setup_bindings();
|
||||||
Engine engine(settings, &paths);
|
Engine engine(settings, &paths);
|
||||||
if (fs::is_regular_file(controls_file)) {
|
if (fs::is_regular_file(controls_file)) {
|
||||||
std::cout << "-- loading controls" << std::endl;
|
std::cout << "-- loading controls" << std::endl;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user