Demo source refactor (Can have multiple demo programs now)
This commit is contained in:
@@ -40,6 +40,9 @@ if(UNIX AND NOT APPLE)
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
# TODO: Publish release
|
||||
|
||||
CPMAddPackage(
|
||||
NAME Event
|
||||
URL https://git.redacted.cc/josh/Event/archive/Release-1.zip
|
||||
@@ -118,20 +121,6 @@ target_link_libraries(Re3D PUBLIC Event)
|
||||
#target_include_directories(Re3D PRIVATE ${JGL_SOURCE_DIR}/include)
|
||||
#target_link_libraries(Re3D PRIVATE JGL)
|
||||
|
||||
add_executable(Re3D_Demo "src/demo/main.cpp")
|
||||
#Link based on the relative path *so you can copy the game around*
|
||||
set_target_properties(Re3D_Demo PROPERTIES LINK_FLAGS "-Wl,-rpath,./lib")
|
||||
|
||||
|
||||
|
||||
# TODO: Link all applicable dependencies to Re3D directly
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(Re3D_Demo PUBLIC Re3D ReWindowLibrary ReHardwareID J3ML JGL soil uuid_v4 GL glad assimp archive ${PROJECT_BINARY_DIR}/lib/libGLU.so)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(Re3D_Demo PUBLIC Re3D ReWindowLibrary ReHardwareID J3ML soil uuid_v4 GL GLU glad assimp archive)
|
||||
endif()
|
||||
|
||||
include(src/demo/RuntimeTest/CMakeLists.txt)
|
||||
|
||||
|
||||
|
@@ -73,8 +73,8 @@ public:
|
||||
void renderLoop();
|
||||
|
||||
Engine() {
|
||||
window = new(ReWindow::RWindow);
|
||||
world = new(World);
|
||||
//window = new(ReWindow::RWindow);
|
||||
//world = new(World);
|
||||
error = {ENGINE_ERROR_CODE::NO_ERROR, false};
|
||||
}
|
||||
};
|
||||
|
14
src/demo/RuntimeTest/CMakeLists.txt
Normal file
14
src/demo/RuntimeTest/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
add_executable(Re3D-RuntimeTest "src/demo/RuntimeTest/main.cpp")
|
||||
#Link based on the relative path *so you can copy the game around*
|
||||
set_target_properties(Re3D-RuntimeTest PROPERTIES LINK_FLAGS "-Wl,-rpath,./lib")
|
||||
|
||||
|
||||
|
||||
# TODO: Link all applicable dependencies to Re3D directly
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(Re3D-RuntimeTest PUBLIC Re3D ReWindowLibrary ReHardwareID J3ML JGL soil uuid_v4 GL glad assimp archive ${PROJECT_BINARY_DIR}/lib/libGLU.so)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(Re3D-RuntimeTest PUBLIC Re3D ReWindowLibrary ReHardwareID J3ML soil uuid_v4 GL GLU glad assimp archive)
|
||||
endif()
|
24
src/demo/RuntimeTest/main.cpp
Normal file
24
src/demo/RuntimeTest/main.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <thread>
|
||||
#include "engine/engine.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// TODO: Eliminate the global engine ptr...
|
||||
//Engine* engine = new Engine();
|
||||
engine->window = new ReWindow::RWindow("Re3D Test Application", 1000, 700);
|
||||
engine->window->setRenderer(RenderingAPI::OPENGL);
|
||||
//engine->window->setResizable(true);
|
||||
engine->world = new World();
|
||||
engine->init();
|
||||
engine->renderLoop();
|
||||
}
|
||||
|
||||
|
||||
#ifdef WINDOWS_SMH
|
||||
extern "C" {
|
||||
int wmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
return main(0, nullptr);
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -1,80 +0,0 @@
|
||||
#include <thread>
|
||||
#include "engine/engine.h"
|
||||
|
||||
|
||||
class App
|
||||
{
|
||||
public:
|
||||
int status;
|
||||
|
||||
App()
|
||||
{
|
||||
|
||||
}
|
||||
virtual void Init()
|
||||
{
|
||||
|
||||
}
|
||||
virtual void Run()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
class GameApp : public App
|
||||
{
|
||||
public:
|
||||
//Engine* engine;
|
||||
GameApp() : App()
|
||||
{
|
||||
//auto* window = new RWindow();
|
||||
//window->init(RenderingAPI::OPENGL, "Re: 3D", 1152, 864, false);
|
||||
//engine = new Engine();
|
||||
//engine->AttachWindow();
|
||||
}
|
||||
};
|
||||
|
||||
class glDemoGameApp : public GameApp
|
||||
{
|
||||
public:
|
||||
Engine* engine;
|
||||
glDemoGameApp() : GameApp()
|
||||
{
|
||||
engine = new Engine();
|
||||
engine->window = new ReWindow::RWindow("Re3D Test Application", 1000, 700);
|
||||
engine->window->setRenderer(RenderingAPI::OPENGL);
|
||||
//engine->window->setResizable(true);
|
||||
engine->world = new World();
|
||||
|
||||
}
|
||||
|
||||
void Init() override
|
||||
{
|
||||
engine->init();
|
||||
}
|
||||
|
||||
void Run() override
|
||||
{
|
||||
engine->renderLoop();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
auto* app = new glDemoGameApp();
|
||||
app->Init();
|
||||
app->Run();
|
||||
int appstatus = app->status;
|
||||
delete app;
|
||||
return appstatus;
|
||||
}
|
||||
|
||||
|
||||
#ifdef WINDOWS_SMH
|
||||
extern "C" {
|
||||
int wmain(int argc, wchar_t* argv[])
|
||||
{
|
||||
return main(0, nullptr);
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -66,8 +66,7 @@ void Engine::initGL()
|
||||
|
||||
void Engine::init()
|
||||
{
|
||||
|
||||
engine->window->setRenderer(RenderingAPI::OPENGL);
|
||||
//engine->window->setRenderer(RenderingAPI::OPENGL);
|
||||
engine->window->Open();
|
||||
engine->window->setResizable(true);
|
||||
engine->initGL();
|
||||
|
Reference in New Issue
Block a user