diff --git a/hecl/CMakeLists.txt b/hecl/CMakeLists.txt index fe5dfd0fe..ef0f91039 100644 --- a/hecl/CMakeLists.txt +++ b/hecl/CMakeLists.txt @@ -27,3 +27,6 @@ add_subdirectory(lib) add_subdirectory(blender) add_subdirectory(driver) install(DIRECTORY include/HECL DESTINATION include/HECL) + +# Runtime test +add_subdirectory(test) diff --git a/hecl/extern/libBoo b/hecl/extern/libBoo index 4ee3e0f7a..c9fd0fdbb 160000 --- a/hecl/extern/libBoo +++ b/hecl/extern/libBoo @@ -1 +1 @@ -Subproject commit 4ee3e0f7aa8a150bcc7f287983fae1c8ca63fc66 +Subproject commit c9fd0fdbb57e8c5e0d23041b789aa43dff30520a diff --git a/hecl/test/CMakeLists.txt b/hecl/test/CMakeLists.txt new file mode 100644 index 000000000..f643233f1 --- /dev/null +++ b/hecl/test/CMakeLists.txt @@ -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}) diff --git a/hecl/test/main.cpp b/hecl/test/main.cpp new file mode 100644 index 000000000..07540f58b --- /dev/null +++ b/hecl/test/main.cpp @@ -0,0 +1,83 @@ +#include +#include + +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