diff --git a/Faceball2030/Editor.cpp b/Faceball2030/Editor.cpp index e69de29..3850a7e 100644 --- a/Faceball2030/Editor.cpp +++ b/Faceball2030/Editor.cpp @@ -0,0 +1,11 @@ + +#include "pixelGameEngine.h" +#include "main.h" +#include "Editor.h" +using namespace olc; + +extern FaceBall* game; + +void Editor::Update(float fElapsedTime){ + game->DrawStringDecal({ 0,0 }, "HEllo World!", WHITE, { 4,4 }); +} \ No newline at end of file diff --git a/Faceball2030/Editor.h b/Faceball2030/Editor.h index fdb07d5..63c3bcf 100644 --- a/Faceball2030/Editor.h +++ b/Faceball2030/Editor.h @@ -5,7 +5,7 @@ using namespace olc; class Editor { std::string filename; vi2d MAP_SIZE; - void Update(float fElapsedTime) { - - } + public: + Editor() {} + void Update(float fElapsedTime); }; \ No newline at end of file diff --git a/Faceball2030/main.cpp b/Faceball2030/main.cpp index 48cefa8..2d4c6f3 100644 --- a/Faceball2030/main.cpp +++ b/Faceball2030/main.cpp @@ -6,6 +6,7 @@ using namespace olc; +FaceBall* game; vec3d FaceBall::Matrix_MultiplyVector(mat4x4& m, vec3d& i) @@ -697,16 +698,19 @@ bool FaceBall::OnUserCreate() bool FaceBall::OnUserUpdate(float fElapsedTime) { switch (mode) { - case GAME: { - for (Object& o : objects) { - o.rot += PI / 8 * fElapsedTime; - } - HandleKeys(fElapsedTime); - RenderWorld(); - }break; - case EDITOR: { - - }break; + case GAME: { + for (Object& o : objects) { + o.rot += PI / 8 * fElapsedTime; + } + HandleKeys(fElapsedTime); + RenderWorld(); + }break; + case EDITOR: { + editor.Update(fElapsedTime); + }break; + } + if (GetKey(olc::F5).bPressed) { + mode = (GAMEMODE)!(mode&1); } return true; } diff --git a/Faceball2030/main.h b/Faceball2030/main.h index 06c9810..50e9090 100644 --- a/Faceball2030/main.h +++ b/Faceball2030/main.h @@ -1,5 +1,6 @@ #pragma once #include "pixelGameEngine.h" +#include "Editor.h" using namespace olc; const float PI = 3.14159f; @@ -143,7 +144,7 @@ class FaceBall : public PixelGameEngine std::vector>map; std::vectorobjects; GAMEMODE mode=GAMEMODE::GAME; - + Editor editor; mat4x4 matProj; @@ -181,5 +182,4 @@ class FaceBall : public PixelGameEngine void AddWall(Direction dir, vi2d gridSquare); bool OnUserCreate() override; bool OnUserUpdate(float fElapsedTime) override; -}; -FaceBall* game; \ No newline at end of file +}; \ No newline at end of file