Added compiler settings to ModuleManager (include paths, C++11), added some test bgfx calls to the test module.
parent
523c9996a8
commit
d862f0b659
|
@ -71,6 +71,13 @@ SET ( protot_SRCS
|
|||
3rdparty/glfw/deps/glad.c
|
||||
)
|
||||
|
||||
SET (PROTOT_SOURCE_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
CONFIGURE_FILE (
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/protot_config.h.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/src/protot_config.h"
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE (protot src/main.cc ${protot_SRCS})
|
||||
|
||||
file(GLOB glcpp-library_sources
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "ModuleManager.h"
|
||||
|
||||
#include "protot_config.h"
|
||||
|
||||
// Runtime Compiled Cpp
|
||||
#include "RuntimeCompiledCpp/RuntimeObjectSystem/IObjectFactorySystem.h"
|
||||
#include "RuntimeCompiledCpp/RuntimeObjectSystem/ObjectInterface.h"
|
||||
#include "RuntimeCompiledCpp/RuntimeCompiler/AUArray.h"
|
||||
|
||||
#include "RuntimeCompiledCpp/RuntimeCompiler/BuildTool.h"
|
||||
#include "RuntimeCompiledCpp/RuntimeCompiler/ICompilerLogger.h"
|
||||
#include "RuntimeCompiledCpp/RuntimeCompiler/FileChangeNotifier.h"
|
||||
#include "RuntimeCompiledCpp/RuntimeObjectSystem/IObjectFactorySystem.h"
|
||||
|
@ -21,8 +21,8 @@
|
|||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -62,6 +62,15 @@ bool ModuleManager::init() {
|
|||
|
||||
mRuntimeObjectSystem->GetObjectFactorySystem()->AddListener(this);
|
||||
|
||||
// Setup of the compiler settings
|
||||
mRuntimeObjectSystem->SetAdditionalCompileOptions("--std=c++11");
|
||||
|
||||
// add include paths
|
||||
string protot_source_root_path = PROTOT_SOURCE_ROOT_PATH;
|
||||
mRuntimeObjectSystem->AddIncludeDir (
|
||||
string(protot_source_root_path + "/3rdparty/bgfx/include"
|
||||
).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -82,24 +91,17 @@ void ModuleManager::OnConstructorsAdded() {
|
|||
}
|
||||
}
|
||||
|
||||
void ModuleManager::update() {
|
||||
void ModuleManager::update(float dt) {
|
||||
if (mRuntimeObjectSystem->GetIsCompiledComplete()) {
|
||||
mRuntimeObjectSystem->LoadCompiledModule();
|
||||
}
|
||||
|
||||
if (!mRuntimeObjectSystem->GetIsCompiling()) {
|
||||
static int num_updates = 0;
|
||||
num_updates ++;
|
||||
std::cout << "Main loop. num_updates = " << num_updates << "\n";
|
||||
|
||||
const float delta_time = 1.0f;
|
||||
mRuntimeObjectSystem->GetFileChangeNotifier()->Update(delta_time);
|
||||
mRuntimeObjectSystem->GetFileChangeNotifier()->Update(dt);
|
||||
|
||||
for (unsigned int i = 0; i < mModules.size(); i++) {
|
||||
mModules[i]->Update(delta_time);
|
||||
mModules[i]->Update(dt);
|
||||
}
|
||||
|
||||
usleep(1000 * 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ struct ModuleManager : IObjectFactoryListener {
|
|||
virtual ~ModuleManager();
|
||||
|
||||
bool init();
|
||||
void update ();
|
||||
void update (float dt);
|
||||
|
||||
void OnConstructorsAdded();
|
||||
bool RegisterModule(const char* name);
|
||||
|
|
|
@ -4,13 +4,24 @@
|
|||
#include "rcpp/IUpdateable.h"
|
||||
#include "rcpp/InterfaceIds.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "Renderer.h"
|
||||
|
||||
class TestModule : public TInterface<IID_IUPDATEABLE,IUpdateable>
|
||||
{
|
||||
public:
|
||||
virtual void Update( float deltaTime )
|
||||
{
|
||||
std::cout << "TestModule: 1 Runtime Object 214 update called!\n";
|
||||
std::ostringstream s;
|
||||
s << "TestModule: 2 Runtime Object 2 " << deltaTime << " update called!";
|
||||
|
||||
bgfx::dbgTextPrintf(1, 20, 0x6f, s.str().c_str());
|
||||
|
||||
// wait a little so that we don't hog the CPU.
|
||||
usleep (1000 * 100);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ int main(void)
|
|||
renderer.resize(width, height);
|
||||
}
|
||||
|
||||
module_manager.update();
|
||||
module_manager.update((float)(frameTime / freq));
|
||||
|
||||
renderer.paintGLSimple();
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#cmakedefine PROTOT_SOURCE_ROOT_PATH "@PROTOT_SOURCE_ROOT_PATH@"
|
Loading…
Reference in New Issue