Flipped y axis of texture coord when drawing images

added run mode system
beginning of Tester Run Mode class
Gui_Panel_Refactor
Joeyrp 4 years ago
parent e0adc0dc28
commit ffecb901d6

@ -19,7 +19,9 @@ set(LUNARIUM_SRC
"src/core/core.cpp" "src/core/core.cpp"
"src/core/state.cpp" "src/core/state.cpp"
"src/core/version.cpp" "src/core/version.cpp"
"src/core/iRunMode.cpp"
"src/window/window.cpp" "src/window/window.cpp"
"src/tester/tester.cpp"
"src/utils/types.cpp" "src/utils/types.cpp"
"src/utils/logger.cpp" "src/utils/logger.cpp"
"src/utils/highResTimer.cpp" "src/utils/highResTimer.cpp"
@ -28,6 +30,8 @@ set(LUNARIUM_SRC
"src/utils/args.cpp" "src/utils/args.cpp"
"src/utils/binaryFileBuffer.cpp" "src/utils/binaryFileBuffer.cpp"
"src/utils/frameCounter.cpp" "src/utils/frameCounter.cpp"
"src/utils/stb/stb_image.cpp"
"src/utils/stb/stb_image_write.cpp"
"src/graphics/opengl/glGraphics.cpp" "src/graphics/opengl/glGraphics.cpp"
"src/graphics/opengl/glText.cpp" "src/graphics/opengl/glText.cpp"
"src/graphics/opengl/glShader.cpp" "src/graphics/opengl/glShader.cpp"

@ -4,6 +4,8 @@ Build System:
Core: Core:
☐ Add log settings to the state file ☐ Add log settings to the state file
✔ Add run modes (Editor, Game, Test) to state file @done (9/15/2021, 7:27:03 PM)
✔ Add run mode interface class @done (9/15/2021, 8:22:35 PM)
Graphics: Graphics:
✔ Decide on a font/text rendering system @done (9/7/2021, 1:39:53 PM) ✔ Decide on a font/text rendering system @done (9/7/2021, 1:39:53 PM)
@ -11,7 +13,7 @@ Core:
✔ Add a new class for font loading/management and text rendering @done (9/7/2021, 3:57:08 PM) ✔ Add a new class for font loading/management and text rendering @done (9/7/2021, 3:57:08 PM)
✔ Make the text renderer smarter about breaking up words on multiple lines @low @done (9/8/2021, 2:23:03 PM) ✔ Make the text renderer smarter about breaking up words on multiple lines @low @done (9/8/2021, 2:23:03 PM)
✔ Implement the Image creation methods @done (9/9/2021, 2:50:20 PM) ✔ Implement the Image creation methods @done (9/9/2021, 2:50:20 PM)
☐ Implement Render to Texture ✔ Implement Render to Texture @done (9/15/2021, 7:00:33 PM)
GUI: GUI:
@ -36,6 +38,7 @@ Core:
☐ Provide Methods that give access to the C++ code ☐ Provide Methods that give access to the C++ code
Game: Game:
☐ Implement Run Mode interface class
☐ Load game project data ☐ Load game project data
☐ Manage list of scenes ☐ Manage list of scenes
☐ Manage global scripts ☐ Manage global scripts
@ -65,6 +68,7 @@ Game:
Editor: Editor:
☐ Implement Run Mode interface class
☐ Reference raw asset files in a "content" folder ☐ Reference raw asset files in a "content" folder
@ -73,4 +77,12 @@ Asset Pipeline:
Tester: Tester:
- A special class that is used to unit-test features of the engine - A special class that is used to unit-test features of the engine
☐ Implement Run Mode interface class
☐ Needs a timer to keep track of how long a test has run
☐ Main Tick method should use the timer to determine when to switch to the next test
☐ Add function for testing render to Texture
☐ Add function for testing input
☐ Add function for testing text rendering
☐ Add function for testing shape drawing
☐ Add function for testing image drawing

@ -9,8 +9,12 @@
#include "core.h" #include "core.h"
#include "version.h" #include "version.h"
// Run modes
#include <tester/tester.h>
// Sub Systems // Sub Systems
#include <window/window.h> #include <window/window.h>
#include <graphics/image.h>
#include <graphics/opengl/glGraphics.h> #include <graphics/opengl/glGraphics.h>
#include <graphics/gui/gui.h> #include <graphics/gui/gui.h>
#include <graphics/gui/logGui.h> #include <graphics/gui/logGui.h>
@ -20,7 +24,7 @@ namespace lunarium
Core* Core::mpInstance = nullptr; Core* Core::mpInstance = nullptr;
Core::Core() Core::Core()
: mbIsInit(false), mpArgs(nullptr), mpWindow(nullptr), mpGraphics(nullptr), mpInput(nullptr), : mbIsInit(false), mpArgs(nullptr), mpWindow(nullptr), mpGraphics(nullptr), mpInput(nullptr),
mGUI(GUI::GetInstance()) mGUI(GUI::GetInstance()), mbMidRender(false), mbMidTextureRender(false), mpRunMode(nullptr)
{ {
} }
@ -35,6 +39,9 @@ namespace lunarium
return *mpInstance; return *mpInstance;
} }
////////////////////////////////////////////////////////////
// SHUTDOWN
////////////////////////////////////////////////////////////
void Core::Shutdown() void Core::Shutdown()
{ {
if (!mpInstance) if (!mpInstance)
@ -42,6 +49,7 @@ namespace lunarium
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Lunarium is shutting down!"); Logger::Log(LogCategory::CORE, LogLevel::INFO, "Lunarium is shutting down!");
// Shutdown subsystems // Shutdown subsystems
LogGui::FreeInstance(); LogGui::FreeInstance();
GUI::GetInstance().Shutdown(); GUI::GetInstance().Shutdown();
@ -62,12 +70,19 @@ namespace lunarium
delete mpInstance->mpArgs; delete mpInstance->mpArgs;
mpInstance->mpArgs = nullptr; mpInstance->mpArgs = nullptr;
mpInstance->mpRunMode->Shutdown();
delete mpInstance->mpRunMode;
mpInstance->mpRunMode = nullptr;
mpInstance->mbIsInit = false; mpInstance->mbIsInit = false;
delete mpInstance; delete mpInstance;
mpInstance = nullptr; mpInstance = nullptr;
} }
////////////////////////////////////////////////////////////
// INITIALIZATION
////////////////////////////////////////////////////////////
void Core::Initialize(int argc, char** argv) void Core::Initialize(int argc, char** argv)
{ {
// Setup the log system // Setup the log system
@ -107,6 +122,23 @@ namespace lunarium
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Loaded state file: lunarium_state.xml"); Logger::Log(LogCategory::CORE, LogLevel::INFO, "Loaded state file: lunarium_state.xml");
} }
// RUN MODE
const char* types[] = { "game", "editor", "test"};
Logger::Log(LogCategory::CORE, LogLevel::INFO, "Running in mode: %s", types[mState.Mode]);
if (RunMode::MODE_TEST == mState.Mode)
{
mpRunMode = new Tester;
}
// Initialize the Run Mode
result = mpRunMode->Initialize();
if (Failed(result))
{
Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR,
"Could not initialize the Run Mode: %s", result.Description);
return;
}
// Parse command line args -- None right now // Parse command line args -- None right now
std::vector<Args::SwitchDesc> sd; std::vector<Args::SwitchDesc> sd;
mpArgs = new Args(argc, argv, '-', sd); mpArgs = new Args(argc, argv, '-', sd);
@ -180,9 +212,11 @@ namespace lunarium
return mState; return mState;
} }
////////////////////////////////////////////////////////////
// GAME LOOP
////////////////////////////////////////////////////////////
void Core::RunGameLoop() void Core::RunGameLoop()
{ {
//glfwSetInputMode(mpWindow->GetWindow(), GLFW_STICKY_KEYS, GLFW_TRUE);
mFrameCounter.Reset(); mFrameCounter.Reset();
// TODO: Init frame counter // TODO: Init frame counter
@ -211,42 +245,57 @@ namespace lunarium
LogGui::GetInstance().SetShow(!LogGui::GetInstance().IsShown()); LogGui::GetInstance().SetShow(!LogGui::GetInstance().IsShown());
} }
// DEBUG: Graphics testing
static int width = 500;
if (mpInput->IsKeyDown(KeyCode::LEFT))
{
width -= 10;
}
if (mpInput->IsKeyDown(KeyCode::RIGHT)) // TODO: Send input events
{
width += 10;
}
// Update game state
mpGraphics->BeginDraw(RenderTarget::RT_IMAGE); // Update game state
mpRunMode->OnTick(mFrameCounter.GetFrameData().LastFrameTime);
// DEBUG: Graphics tests
mpGraphics->DrawFilledEllipse(glm::vec2(600, 300), glm::vec2(100, 150), Color(1.0f, 0.0f, 1.0f, 1.0f), 100);
mpGraphics->DrawString("This is a test of the text renderer!", Rectangle(100, 200, width, 300),
Color(0.0f, 1.0f, 1.0f, 1.0f), 0.5f, mpGraphics->DefaultFont());
Image* pImage = mpGraphics->EndDraw();
// Render // Render
if (mbMidTextureRender)
{
Logger::Log(LogCategory::CORE, LogLevel::WARNING, "Render to texture was not ended!");
EndRenderToTexture();
}
mGUI.NewFrame(); mGUI.NewFrame();
mpGraphics->BeginDraw(); mpGraphics->BeginDraw();
mbMidRender = true;
// DEBUG: Render test ImGUI window // DEBUG: Render test ImGUI window
// mGUI.ShowDemoWindow(); // mGUI.ShowDemoWindow();
LogGui::GetInstance().Show(); LogGui::GetInstance().Show();
mpGraphics->DrawImage(*pImage, glm::vec2(0.0f, 0.0f), Color(1.0f, 1.0f, 1.0f, 1.0f)); mpRunMode->OnRender();
mGUI.EndFrame(); mGUI.EndFrame();
mpGraphics->EndDraw(); mpGraphics->EndDraw();
mbMidRender = false;
}
}
OpRes Core::BeginRenderToTexture()
{
if (mbMidRender)
{
return OpRes::Fail("Can not switch render targets in the middle of rendering");
}
mbMidTextureRender = true;
mpGraphics->BeginDraw(RenderTarget::RT_IMAGE);
return OpRes::OK();
}
// delete pImage; Image* Core::EndRenderToTexture()
{
if (!mbMidTextureRender)
{
return nullptr;
} }
mbMidTextureRender = false;
return mpGraphics->EndDraw();
} }
} }

@ -10,6 +10,7 @@
#define CORE_H_ #define CORE_H_
#include "state.h" #include "state.h"
#include "iRunMode.h"
#include <input/inputManager.h> #include <input/inputManager.h>
#include <utils/logger.h> #include <utils/logger.h>
#include <utils/args.h> #include <utils/args.h>
@ -17,6 +18,9 @@
namespace lunarium namespace lunarium
{ {
class Image;
class Tester;
class GUI; class GUI;
class IGraphics; class IGraphics;
class Window; class Window;
@ -36,12 +40,18 @@ namespace lunarium
void RunGameLoop(); void RunGameLoop();
OpRes BeginRenderToTexture();
Image* EndRenderToTexture();
private: // DATA private: // DATA
static Core* mpInstance; static Core* mpInstance;
bool mbIsInit; bool mbIsInit;
State mState; State mState;
Args* mpArgs; Args* mpArgs;
FrameCounter mFrameCounter; FrameCounter mFrameCounter;
iRunMode* mpRunMode;
bool mbMidRender;
bool mbMidTextureRender;
// Log Files // Log Files
std::ofstream mMasterLogFile; std::ofstream mMasterLogFile;
@ -61,6 +71,9 @@ namespace lunarium
Core(); Core();
Core(const Core&) = delete; Core(const Core&) = delete;
Core& operator=(const Core&) = delete; Core& operator=(const Core&) = delete;
private: // RUN MODES
Tester* mpTester;
}; };
} }

@ -0,0 +1,23 @@
/******************************************************************************
* File - iRunMode.cpp
* Author - Joey Pollack
* Date - 2021/09/15 (y/m/d)
* Mod Date - 2021/09/15 (y/m/d)
* Description - The interface that run mode classes must implement
******************************************************************************/
#include "iRunMode.h"
namespace lunarium
{
// Default implementation of optional events
void iRunMode::OnKeyPress(InputManager::KeyPress kp)
{
// Do nothing
}
void iRunMode::OnKeyRelease(Keyboard::Key key)
{
// Do nothing
}
}

@ -0,0 +1,32 @@
/******************************************************************************
* File - iRunMode.h
* Author - Joey Pollack
* Date - 2021/09/15 (y/m/d)
* Mod Date - 2021/09/15 (y/m/d)
* Description - The interface that run mode classes must implement
******************************************************************************/
#ifndef RUN_MODE_H_
#define RUN_MODE_H_
#include <utils/opRes.h>
#include <input/inputManager.h>
#include <input/keyboard.h>
namespace lunarium
{
class iRunMode
{
public:
virtual OpRes Initialize() = 0;
virtual void Shutdown() = 0;
virtual void OnTick(double delta) = 0;
virtual void OnRender() = 0;
public: // Optional Events
virtual void OnKeyPress(InputManager::KeyPress kp);
virtual void OnKeyRelease(Keyboard::Key k);
};
}
#endif // RUN_MODE_H_

@ -8,6 +8,7 @@
#include "state.h" #include "state.h"
#include <utils/helpers.h> #include <utils/helpers.h>
#include <utils/logger.h>
#include <pugixml.hpp> #include <pugixml.hpp>
namespace lunarium namespace lunarium
@ -26,6 +27,7 @@ namespace lunarium
s.Display.WindowStartPosition.X = 0; s.Display.WindowStartPosition.X = 0;
s.Display.WindowStartPosition.Y = 0; s.Display.WindowStartPosition.Y = 0;
s.Interface.MainFont = ""; s.Interface.MainFont = "";
s.Mode = RunMode::MODE_TEST;
return s; return s;
} }
@ -46,6 +48,7 @@ namespace lunarium
s.Display.WindowStartPosition.X = 100; s.Display.WindowStartPosition.X = 100;
s.Display.WindowStartPosition.Y = 100; s.Display.WindowStartPosition.Y = 100;
s.Interface.MainFont = ""; s.Interface.MainFont = "";
s.Mode = RunMode::MODE_TEST;
return s; return s;
} }
@ -73,6 +76,26 @@ namespace lunarium
state.DataDirectory = "data/"; state.DataDirectory = "data/";
} }
std::string mode = String::StringToLower(root.child("Mode").attribute("Type").as_string());
if ("test" == mode)
{
state.Mode = RunMode::MODE_TEST;
}
else if ("editor" == mode)
{
state.Mode = RunMode::MODE_EDITOR;
}
else if ("game" == mode)
{
state.Mode = RunMode::MODE_GAME;
}
else
{
Logger::Log(LogCategory::CORE, LogLevel::WARNING,
"Can not find Run Mode in state file: %s, defaulting to MODE_TEST", filename);
state.Mode = RunMode::MODE_TEST;
}
pugi::xml_node display = root.child("Display"); pugi::xml_node display = root.child("Display");
if (pugi::node_null == display.type()) if (pugi::node_null == display.type())
{ {
@ -138,6 +161,9 @@ namespace lunarium
doc.child("State").append_child("DataDirectory"); doc.child("State").append_child("DataDirectory");
doc.child("State").child("DataDirectory").text().set(DataDirectory.c_str()); doc.child("State").child("DataDirectory").text().set(DataDirectory.c_str());
const char* types[] = { "game", "editor", "test"};
doc.child("State").append_child("Mode").append_attribute("Type").set_value(types[Mode]);
// Display // Display
pugi::xml_node display = doc.child("State").append_child("Display"); pugi::xml_node display = doc.child("State").append_child("Display");
display.append_attribute("IsFullScreen").set_value(Display.IsFullScreen); display.append_attribute("IsFullScreen").set_value(Display.IsFullScreen);

@ -14,6 +14,13 @@
namespace lunarium namespace lunarium
{ {
enum RunMode
{
MODE_GAME,
MODE_EDITOR,
MODE_TEST
};
enum Renderer enum Renderer
{ {
OPENGL, OPENGL,
@ -55,6 +62,8 @@ namespace lunarium
std::string MainFont; std::string MainFont;
} Interface; } Interface;
RunMode Mode;
// METHODS // METHODS
static State CreateEmpty(); static State CreateEmpty();
static State CreateDefault(); static State CreateDefault();

@ -17,7 +17,7 @@ namespace lunarium
friend class OglGraphics; friend class OglGraphics;
friend class glText; friend class glText;
private: private:
const char* DefaultShapeVertex = "#version 330 core\n\ const char* DefaultShapeVertex = "#version 450 core\n\
layout(location = 0) in vec4 vertex;\ layout(location = 0) in vec4 vertex;\
\ \
uniform mat4 model;\ uniform mat4 model;\
@ -28,7 +28,7 @@ namespace lunarium
gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\ gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\
}"; }";
const char* DefaultShapeFragment = "#version 330 core\n\ const char* DefaultShapeFragment = "#version 450 core\n\
in vec2 TexCoords;\ in vec2 TexCoords;\
out vec4 color;\ out vec4 color;\
\ \
@ -39,7 +39,7 @@ namespace lunarium
color = shapeColor;\ color = shapeColor;\
}"; }";
const char* DefaultSpriteVertex = "#version 330 core\n\ const char* DefaultSpriteVertex = "#version 450 core\n\
layout(location = 0) in vec4 vertex;\ layout(location = 0) in vec4 vertex;\
\ \
out vec2 TexCoords;\ out vec2 TexCoords;\
@ -54,7 +54,7 @@ namespace lunarium
gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0);\ gl_Position = projection * model * vec4(vertex.xy, 0.0, 1.0);\
}"; }";
const char* DefaultSpriteFragment = "#version 330 core\n\ const char* DefaultSpriteFragment = "#version 450 core\n\
in vec2 TexCoords;\ in vec2 TexCoords;\
out vec4 color;\ out vec4 color;\
\ \

@ -15,6 +15,8 @@
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
#include <utils/stb/stb_image.h>
namespace lunarium namespace lunarium
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -109,6 +111,7 @@ namespace lunarium
glViewport(0, 0, mFBWidth, mFBHeight); glViewport(0, 0, mFBWidth, mFBHeight);
mProjection = glm::ortho(0.0f, (GLfloat)mFBWidth, (GLfloat)mFBHeight, 0.0f, -1.0f, 1.0f); mProjection = glm::ortho(0.0f, (GLfloat)mFBWidth, (GLfloat)mFBHeight, 0.0f, -1.0f, 1.0f);
// mProjection = glm::ortho(0.0f, (GLfloat)mFBWidth, 0.0f, (GLfloat)mFBHeight, -1.0f, 1.0f);
Logger::Log(LogCategory::GRAPHICS, LogLevel::INFO_VERBOSE, Logger::Log(LogCategory::GRAPHICS, LogLevel::INFO_VERBOSE,
"glViewport set to %d, %d", mFBWidth, mFBHeight); "glViewport set to %d, %d", mFBWidth, mFBHeight);
@ -138,19 +141,21 @@ namespace lunarium
// Buffer width and height (in pixels) is the same as the screen size // Buffer width and height (in pixels) is the same as the screen size
// Need to multiply these by the number bytes per pixel // Need to multiply these by the number bytes per pixel
int bufferSize = mFBWidth * mFBHeight * 4; // NOTE: Assuming 4 channels for now //int bufferSize = mFBWidth * mFBHeight * 4; // NOTE: Assuming 4 channels for now
unsigned char* buffer = new unsigned char[bufferSize]; //unsigned char* buffer = new unsigned char[bufferSize];
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, (void*)buffer); //glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, (void*)buffer);
//FlipImageVertically(buffer, mFBWidth, mFBHeight, 1);
//glSetTexImage()
mpFBTexture->FreeRawData(); mpFBTexture->FreeRawData();
mpFBTexture->mWidth = mFBWidth; mpFBTexture->mWidth = mFBWidth;
mpFBTexture->mHeight = mFBHeight; mpFBTexture->mHeight = mFBHeight;
mpFBTexture->mRawData = buffer;
mpFBTexture->mRawDataSize = bufferSize;
mpFBTexture->mFormat = ImageFormat::RGBA; mpFBTexture->mFormat = ImageFormat::RGBA;
// return a copy of the image // return a copy of the image
return new Image(*mpFBTexture); return mpFBTexture;
} }
else else
{ {
@ -161,6 +166,7 @@ namespace lunarium
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// USER METHODS // USER METHODS
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -329,9 +335,10 @@ namespace lunarium
float yScale = source.Height / image.GetHeight(); float yScale = source.Height / image.GetHeight();
float yOffset = source.Top / image.GetHeight(); float yOffset = source.Top / image.GetHeight();
Logger::Log(LogCategory::GRAPHICS, LogLevel::INFO_VERBOSE, "uvManip Values: %f, %f, %f, %f", xScale, xOffset, yScale, yOffset); // Logger::Log(LogCategory::GRAPHICS, LogLevel::INFO_VERBOSE, "uvManip Values: %f, %f, %f, %f", xScale, xOffset, yScale, yOffset);
mImageShader.SetUniformf("uvManip", { xScale, xOffset, yScale, yOffset }); // * -1.0f on yScale will flip the image vertically
mImageShader.SetUniformf("uvManip", { xScale, xOffset, yScale /** -1.0f*/, yOffset});
mImageShader.SetUniformMatrix("model", 1, glm::value_ptr(trans)); mImageShader.SetUniformMatrix("model", 1, glm::value_ptr(trans));
mImageShader.SetUniformMatrix("projection", 1, glm::value_ptr(mProjection)); mImageShader.SetUniformMatrix("projection", 1, glm::value_ptr(mProjection));
mImageShader.SetUniformf("spriteColor", { color.Red, color.Green, color.Blue, color.Alpha }); mImageShader.SetUniformf("spriteColor", { color.Red, color.Green, color.Blue, color.Alpha });
@ -440,15 +447,26 @@ namespace lunarium
GLuint VBO; GLuint VBO;
GLfloat vertices[] = { GLfloat vertices[] = {
// Pos // Tex // Pos // Tex
0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f,
1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f,
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
1.0f, 0.0f, 1.0f, 0.0f 1.0f, 0.0f, 1.0f, 1.0f
}; };
// GLfloat vertices[] = {
// // Pos // Tex
// 0.0f, 1.0f, 0.0f, 1.0f,
// 1.0f, 0.0f, 1.0f, 0.0f,
// 0.0f, 0.0f, 0.0f, 0.0f,
// 0.0f, 1.0f, 0.0f, 1.0f,
// 1.0f, 1.0f, 1.0f, 1.0f,
// 1.0f, 0.0f, 1.0f, 0.0f
// };
glGenVertexArrays(1, &mImageVAO); glGenVertexArrays(1, &mImageVAO);
glGenBuffers(1, &VBO); glGenBuffers(1, &VBO);

@ -0,0 +1,56 @@
/******************************************************************************
* File - tester.cpp
* Author - Joey Pollack
* Date - 2021/09/15 (y/m/d)
* Mod Date - 2021/09/15 (y/m/d)
* Description - Run a series of tests to verify engine functionality
******************************************************************************/
#include "tester.h"
namespace lunarium
{
Tester::Tester()
{
}
OpRes Tester::Initialize()
{
return OpRes::Fail("Tester::Initialize not implemented");
}
void Tester::Shutdown()
{
}
void Tester::OnTick(double delta)
{
}
void Tester::OnRender()
{
}
}
// DEBUG: Graphics testing
// static int width = 500;
// if (mpInput->IsKeyDown(KeyCode::LEFT))
// {
// width -= 10;
// }
// if (mpInput->IsKeyDown(KeyCode::RIGHT))
// {
// width += 10;
// }
// mpGraphics->DrawFilledEllipse(glm::vec2(600, 300), glm::vec2(100, 150), Color(1.0f, 0.0f, 1.0f, 1.0f), 100);
// mpGraphics->DrawString("This is a test of the text renderer!", Rectangle(100, 200, width, 300),
// Color(0.0f, 1.0f, 1.0f, 1.0f), 0.5f, mpGraphics->DefaultFont());
// mpGraphics->DrawImage(*pImage, glm::vec2(0.0f, 0.0f), Color(1.0f, 1.0f, 1.0f, 1.0f));

@ -0,0 +1,36 @@
/******************************************************************************
* File - tester.h
* Author - Joey Pollack
* Date - 2021/09/15 (y/m/d)
* Mod Date - 2021/09/15 (y/m/d)
* Description - Run a series of tests to verify engine functionality
******************************************************************************/
#ifndef TESTER_H_
#define TESTER_H_
#include <core/iRunMode.h>
namespace lunarium
{
class Tester : public iRunMode
{
public:
Tester();
OpRes Initialize();
void Shutdown();
void OnTick(double delta);
void OnRender();
private:
Tester(const Tester&) = delete;
const Tester& operator=(const Tester&) = delete;
private: // Data
private: // Test methods
};
}
#endif // TESTER_H_

@ -0,0 +1,2 @@
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

File diff suppressed because it is too large Load Diff

@ -0,0 +1,2 @@
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "std_image_write.h"

File diff suppressed because it is too large Load Diff

@ -1,8 +1,9 @@
<State> <State>
<DataDirectory>data/</DataDirectory> <DataDirectory>data/</DataDirectory>
<Mode Type="test" />
<Display RenderFramework="opengl" IsFullScreen="false" VSyncEnabled="true"> <Display RenderFramework="opengl" IsFullScreen="false" VSyncEnabled="true">
<FullScreenResolution Width="1920" Height="1080" /> <FullScreenResolution Width="1920" Height="1080" />
<WindowedSize Width="800" Height="600" /> <WindowedSize Width="1280" Height="720" />
<WindowStartPosition X="100" Y="100" /> <WindowStartPosition X="100" Y="100" />
</Display> </Display>
<Interface MainFont="" /> <Interface MainFont="" />

Loading…
Cancel
Save