Add Editor instance.

linux_template
sigonasr2 2 years ago
parent 725853c0b2
commit b0d0f1e564
  1. 11
      Faceball2030/Editor.cpp
  2. 6
      Faceball2030/Editor.h
  3. 24
      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 {
std::string filename;
vi2d MAP_SIZE;
void Update(float fElapsedTime) {
}
public:
Editor() {}
void Update(float fElapsedTime);
};

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

@ -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<std::vector<MapSquare>>map;
std::vector<Object>objects;
GAMEMODE mode=GAMEMODE::GAME;
Editor editor;
mat4x4 matProj;
@ -182,4 +183,3 @@ class FaceBall : public PixelGameEngine
bool OnUserCreate() override;
bool OnUserUpdate(float fElapsedTime) override;
};
FaceBall* game;
Loading…
Cancel
Save