Updated libBoo; added heclTest target

This commit is contained in:
Jack Andersen 2015-11-11 18:32:53 -10:00
parent 676a82a8dd
commit a9fe41d994
4 changed files with 91 additions and 1 deletions

View File

@ -27,3 +27,6 @@ add_subdirectory(lib)
add_subdirectory(blender) add_subdirectory(blender)
add_subdirectory(driver) add_subdirectory(driver)
install(DIRECTORY include/HECL DESTINATION include/HECL) install(DIRECTORY include/HECL DESTINATION include/HECL)
# Runtime test
add_subdirectory(test)

2
hecl/extern/libBoo vendored

@ -1 +1 @@
Subproject commit 4ee3e0f7aa8a150bcc7f287983fae1c8ca63fc66 Subproject commit c9fd0fdbb57e8c5e0d23041b789aa43dff30520a

4
hecl/test/CMakeLists.txt Normal file
View File

@ -0,0 +1,4 @@
add_executable(heclTest WIN32 main.cpp)
target_link_libraries(heclTest
HECLDatabase HECLBackend HECLFrontend HECLBlender HECLCommon AthenaCore
LogVisor Boo ${BOO_SYS_LIBS})

83
hecl/test/main.cpp Normal file
View File

@ -0,0 +1,83 @@
#include <boo/boo.hpp>
#include <LogVisor/LogVisor.hpp>
struct HECLWindowCallback : boo::IWindowCallback
{
bool m_sizeDirty = false;
boo::SWindowRect m_latestSize;
void resized(const boo::SWindowRect& rect)
{
m_sizeDirty = true;
m_latestSize = rect;
}
};
struct HECLApplicationCallback : boo::IApplicationCallback
{
HECLWindowCallback m_windowCb;
boo::IWindow* m_mainWindow = nullptr;
bool m_running = true;
int appMain(boo::IApplication* app)
{
m_mainWindow = app->newWindow(_S("HECL Test"));
m_mainWindow->setCallback(&m_windowCb);
boo::IGraphicsCommandQueue* gfxQ = m_mainWindow->getCommandQueue();
boo::IGraphicsDataFactory* gfxF = m_mainWindow->getLoadContextDataFactory();
boo::SWindowRect mainWindowRect = m_mainWindow->getWindowFrame();
boo::ITextureR* renderTex = gfxF->newRenderTexture(mainWindowRect.size[0], mainWindowRect.size[1], 1);
gfxF->commit();
while (m_running)
{
m_mainWindow->waitForRetrace();
if (m_windowCb.m_sizeDirty)
{
gfxQ->resizeRenderTexture(renderTex,
m_windowCb.m_latestSize.size[0],
m_windowCb.m_latestSize.size[1]);
m_windowCb.m_sizeDirty = false;
}
gfxQ->setRenderTarget(renderTex);
gfxQ->clearTarget();
gfxQ->resolveDisplay(renderTex);
gfxQ->execute();
}
return 0;
}
void appQuitting(boo::IApplication* app)
{
m_running = false;
}
};
#if _WIN32
int wmain(int argc, const boo::SystemChar** argv)
#else
int main(int argc, const boo::SystemChar** argv)
#endif
{
LogVisor::RegisterConsoleLogger();
HECLApplicationCallback appCb;
int ret = boo::ApplicationRun(boo::IApplication::PLAT_AUTO,
appCb, _S("hecl"), _S("HECL"), argc, argv);
printf("IM DYING!!\n");
return ret;
}
#if _WIN32
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
{
int argc = 0;
const boo::SystemChar** argv = (const wchar_t**)(CommandLineToArgvW(lpCmdLine, &argc));
static boo::SystemChar selfPath[1024];
GetModuleFileNameW(nullptr, selfPath, 1024);
static const boo::SystemChar* booArgv[32] = {};
booArgv[0] = selfPath;
for (int i=0 ; i<argc ; ++i)
booArgv[i+1] = argv[i];
LogVisor::CreateWin32Console();
return wmain(argc+1, booArgv);
}
#endif