Add Editor instance.

linux_template
sigonasr2 2 years ago
parent 725853c0b2
commit b0d0f1e564
  1. 11
      Faceball2030/Editor.cpp
  2. 6
      Faceball2030/Editor.h
  3. 6
      Faceball2030/main.cpp
  4. 4
      Faceball2030/main.h

@ -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 });
}

@ -5,7 +5,7 @@ using namespace olc;
class Editor { class Editor {
std::string filename; std::string filename;
vi2d MAP_SIZE; vi2d MAP_SIZE;
void Update(float fElapsedTime) { public:
Editor() {}
} void Update(float fElapsedTime);
}; };

@ -6,6 +6,7 @@
using namespace olc; using namespace olc;
FaceBall* game;
vec3d vec3d
FaceBall::Matrix_MultiplyVector(mat4x4& m, vec3d& i) FaceBall::Matrix_MultiplyVector(mat4x4& m, vec3d& i)
@ -705,9 +706,12 @@ bool FaceBall::OnUserUpdate(float fElapsedTime)
RenderWorld(); RenderWorld();
}break; }break;
case EDITOR: { case EDITOR: {
editor.Update(fElapsedTime);
}break; }break;
} }
if (GetKey(olc::F5).bPressed) {
mode = (GAMEMODE)!(mode&1);
}
return true; return true;
} }

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "pixelGameEngine.h" #include "pixelGameEngine.h"
#include "Editor.h"
using namespace olc; using namespace olc;
const float PI = 3.14159f; const float PI = 3.14159f;
@ -143,7 +144,7 @@ class FaceBall : public PixelGameEngine
std::vector<std::vector<MapSquare>>map; std::vector<std::vector<MapSquare>>map;
std::vector<Object>objects; std::vector<Object>objects;
GAMEMODE mode=GAMEMODE::GAME; GAMEMODE mode=GAMEMODE::GAME;
Editor editor;
mat4x4 matProj; mat4x4 matProj;
@ -182,4 +183,3 @@ class FaceBall : public PixelGameEngine
bool OnUserCreate() override; bool OnUserCreate() override;
bool OnUserUpdate(float fElapsedTime) override; bool OnUserUpdate(float fElapsedTime) override;
}; };
FaceBall* game;
Loading…
Cancel
Save