elseif Y < YGen and Y > (YGen - YDepth) then
self:setData(X, Y, Z, "dirt");
elseif Y < YGen then
- self:setData(X, Y, Z, "stone");
+ --self:setData(X, Y, Z, "stone");
+ self:setData(X, Y, Z, "grass");
end
--print(X..","..Y..","..Z);
end
// Update 20 times a second
if (elapsed > 50) {
elapsed = 0;
+
+ systems.update<WorldSystem>(dt);
// All entities with an idle function should be run here
entities.each<Scripted>([](entityx::Entity, Scripted &f){
--- /dev/null
+/*
+ * Copyright (C) 2019 Belle-Isle, Andrew <drumsetmonkey@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef EVENTS_WORLD_HPP_
+#define EVENTS_WORLD_HPP_
+
+#include "world.hpp"
+
+struct WorldChangeEvent
+{
+ World* newWorld;
+
+ WorldChangeEvent(World* w) :
+ newWorld(w) {}
+};
+
+struct WorldMeshUpdateEvent
+{
+ GLuint worldVBO;
+
+ WorldMeshUpdateEvent(GLuint v) :
+ worldVBO(v) {}
+};
+
+#endif//EVENTS_WORLD_HPP
);
glm::mat4 model = glm::mat4(1.0f);
- model = glm::scale(model, glm::vec3(8.0f));
+ model = glm::scale(model, glm::vec3(20.0f, 20.0f, 1.0f));
glUseProgram(s);
//glClearColor(0.6, 0.8, 1.0, 0.0);
- camPos = glm::vec3(0.0f, 0.0f, 0.5f);
+ camPos = glm::vec3(0.0f, 0.0f, 5.0f);
glGenBuffers(1, &world_vbo);
return 0;
*/
#include "world.hpp"
+#include "events/world.hpp"
/*****************
* WORLD CLASS *
[[maybe_unused]]entityx::EventManager& events,
[[maybe_unused]]entityx::TimeDelta dt)
{
-
+ if (currentWorld == nullptr) {
+ currentWorld = &(worlds.front());
+ events.emit<WorldChangeEvent>(currentWorld);
+ std::cout << "Emitted" << std::endl;
+ }
}