Skip to content

Commit

Permalink
Update template project and make a few methods optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
amzeratul committed May 29, 2021
1 parent 20d7753 commit 80616b0
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/engine/core/src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ void Game::onUncaughtException(const Exception& exception, TimeLine timeLine)

std::unique_ptr<ISceneEditor> Game::createSceneEditorInterface()
{
throw Exception("Method not implemented: Game::createSceneEditorInterface", HalleyExceptions::Core);
return {};
}

std::unique_ptr<IEditorCustomTools> Game::createEditorCustomToolsInterface()
{
throw Exception("Method not implemented: Game::createEditorCustomToolsInterface", HalleyExceptions::Core);
return {};
}

void Game::attachToEditorDebugConsole(UIDebugConsoleCommands& commands, Resources& gameResources, IProject& project)
Expand Down
36 changes: 17 additions & 19 deletions src/tools/editor/src/ui/project_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,24 @@ bool ProjectWindow::loadCustomUI()
}

auto customToolsInterface = game->createEditorCustomToolsInterface();
if (!customToolsInterface) {
return false;
}

try {
customTools = customToolsInterface->makeTools(IEditorCustomTools::MakeToolArgs(factory, resources, project.getGameResources(), api, project));
} catch (const std::exception& e) {
Logger::logException(e);
} catch (...) {
return false;
}
if (customToolsInterface) {
try {
customTools = customToolsInterface->makeTools(IEditorCustomTools::MakeToolArgs(factory, resources, project.getGameResources(), api, project));
} catch (const std::exception& e) {
Logger::logException(e);
} catch (...) {
return false;
}

if (!customTools.empty()) {
toolbar->getList()->add(std::make_shared<UIImage>(Sprite().setImage(resources, "ui/slant_capsule_short.png").setColour(factory.getColourScheme()->getColour("toolbarNormal"))), 0, Vector4f(0, 3, 0, 3));

for (auto& tool: customTools) {
const auto img = std::make_shared<UIImage>(tool.icon);
toolbar->getList()->addImage(tool.id, img, 1, {}, UISizerAlignFlags::Centre);
toolbar->getList()->getItem(tool.id)->setToolTip(tool.tooltip);
pagedPane->addPage()->add(tool.widget, 1, Vector4f(8, 8, 8, 8));
if (!customTools.empty()) {
toolbar->getList()->add(std::make_shared<UIImage>(Sprite().setImage(resources, "ui/slant_capsule_short.png").setColour(factory.getColourScheme()->getColour("toolbarNormal"))), 0, Vector4f(0, 3, 0, 3));

for (auto& tool: customTools) {
const auto img = std::make_shared<UIImage>(tool.icon);
toolbar->getList()->addImage(tool.id, img, 1, {}, UISizerAlignFlags::Centre);
toolbar->getList()->getItem(tool.id)->setToolTip(tool.tooltip);
pagedPane->addPage()->add(tool.widget, 1, Vector4f(8, 8, 8, 8));
}
}
}

Expand Down
16 changes: 0 additions & 16 deletions template/scripts/cmake_vs2017_64_with_tools.bat

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
cd ..
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" ^
cmake -G "Visual Studio 16 2019" ^
-A x64 ^
-DHALLEY_PATH=../halley ^
-DBUILD_HALLEY_TOOLS=0 ^
-DBUILD_HALLEY_TESTS=0 ^
-DCMAKE_INCLUDE_PATH="lib\include" ^
-DCMAKE_LIBRARY_PATH="lib\windows64" ^
-DBOOST_ROOT="lib\boost" ^
-DBoost_USE_STATIC_LIBS=1 ^
-DUSE_PCH=1 ^
..
pause
16 changes: 16 additions & 0 deletions template/scripts/cmake_vs2019_64_with_tools.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cd ..
mkdir build
cd build
cmake -G "Visual Studio 16 2019" ^
-A x64 ^
-DHALLEY_PATH=../halley ^
-DCMAKE_INCLUDE_PATH="%~dp0\..\halley_deps\include;lib\include;C:\dev\include;R:\dev\include" ^
-DCMAKE_LIBRARY_PATH="%~dp0\..\halley_deps\lib64;lib\windows64;C:\dev\lib64;R:\dev\lib64" ^
-DBOOST_LIBRARYDIR="%~dp0\..\halley_deps\Boost\lib;c:\Boost\lib" ^
-DBOOST_INCLUDEDIR="%~dp0\..\halley_deps\Boost\include\boost-1_72;c:\Boost\include\boost-1_72" ^
-DBoost_USE_STATIC_LIBS=1 ^
-DBUILD_HALLEY_TOOLS=1 ^
-DBUILD_HALLEY_TESTS=1 ^
-DBUILD_HALLEY_LAUNCHER=1 ^
..
pause

0 comments on commit 80616b0

Please sign in to comment.