Initial commit.
This commit is contained in:
commit
d99b70eaa1
33 changed files with 2291 additions and 0 deletions
52
src/main.cpp
Normal file
52
src/main.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <Events.h>
|
||||
#include <Engine.h>
|
||||
#include <World.h>
|
||||
#include <Server.h>
|
||||
|
||||
int main() {
|
||||
// printf("About to call glfwInit...\n");
|
||||
// fflush(stdout);
|
||||
// if (!glfwInit()) {
|
||||
// fprintf(stderr, "glfwInit failed\n");
|
||||
// return -1;
|
||||
// }
|
||||
// printf("glfwInit succeeded!\n");
|
||||
//
|
||||
// std::cout << "Starting..." << std::endl;
|
||||
|
||||
// glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
// auto window = glfwCreateWindow(1200, 800, "Test", nullptr, nullptr);
|
||||
//
|
||||
// std::cout << "GLFW window created" << std::endl;
|
||||
|
||||
Artifact::Engine engine;
|
||||
|
||||
Artifact::Server server(&engine);
|
||||
engine.server = &server;
|
||||
|
||||
engine.listen<Artifact::Events::Initialized>([](const Artifact::Events::Initialized &ev) {
|
||||
std::cout << "Initialization complete..." << std::endl;
|
||||
});
|
||||
|
||||
engine.listen<Artifact::Events::DrawUI>([&engine](Artifact::Events::DrawUI ev) {
|
||||
if(nk_begin(ev.ctx, "Test", nk_rect(0, 0, 100, 100), NK_WINDOW_MOVABLE|NK_WINDOW_SCALABLE|NK_WINDOW_TITLE|NK_WINDOW_BORDER)) {
|
||||
nk_layout_row_dynamic(ev.ctx, 50, 2);
|
||||
nk_label(ev.ctx, "Test", NK_TEXT_ALIGN_CENTERED);
|
||||
if(nk_button_label(ev.ctx, "Test")) {
|
||||
engine.server->sendMessage(Artifact::Events::Initialized{});
|
||||
}
|
||||
}
|
||||
nk_end(ev.ctx);
|
||||
});
|
||||
|
||||
Artifact::World::NodeDef def_Stone;
|
||||
def_Stone.texture = "test.png";
|
||||
engine.world->nodeRegistry.registerNode("test", def_Stone);
|
||||
|
||||
|
||||
engine.run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue