diff --git a/scripts/build.bat b/scripts/build.bat index 3af6864..3ffbd45 100644 --- a/scripts/build.bat +++ b/scripts/build.bat @@ -28,6 +28,13 @@ If "%~2" == "rd" set "DEBINFO=1" IF defined RELEASE ( cmake --build build/ --target ALL_BUILD --config Release +SET BUILD_ERRORLEVEL=!ERRORLEVEL! +IF NOT "!BUILD_ERRORLEVEL!"=="0" ( + echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL% + EXIT /B !BUILD_ERRORLEVEL! +) + + xcopy /y test_data\engine_state.json build\Release\ xcopy /y src\renderer\shaders\* build\Release\* @@ -35,23 +42,31 @@ xcopy /y src\renderer\shaders\* build\Release\* ) ELSE IF defined DEBINFO ( cmake --build build/ --target ALL_BUILD --config RelWithDebInfo +SET BUILD_ERRORLEVEL=!ERRORLEVEL! +IF NOT "!BUILD_ERRORLEVEL!"=="0" ( + echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL% + EXIT /B !BUILD_ERRORLEVEL! +) + + xcopy /y test_data\engine_state.json build\RelWithDebInfo\ xcopy /y src\renderer\shaders\* build\RelWithDebInfo\* ) ELSE ( cmake --build build/ --target ALL_BUILD --config Debug -xcopy /y test_data\engine_state.json build\Debug\ -xcopy /y src\renderer\shaders\* build\Debug\* - -) - SET BUILD_ERRORLEVEL=!ERRORLEVEL! IF NOT "!BUILD_ERRORLEVEL!"=="0" ( echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL% EXIT /B !BUILD_ERRORLEVEL! ) + +xcopy /y test_data\engine_state.json build\Debug\ +xcopy /y src\renderer\shaders\* build\Debug\* + +) + echo %ESC%[92mBUILD SUCCEEDED!%ESC%[0m IF defined DELGUI ( diff --git a/src/run_modes/editor/contents/tile_set.cpp b/src/run_modes/editor/contents/tile_set.cpp index f56204b..9338cfe 100644 --- a/src/run_modes/editor/contents/tile_set.cpp +++ b/src/run_modes/editor/contents/tile_set.cpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace lunarium { namespace editor { @@ -174,6 +175,12 @@ namespace lunarium { namespace editor void TileSet::DrawProperties() { - + int size[2] = { mTileSize.Width, mTileSize.Height }; + ImGui::Text("Tile Size: "); + ImGui::SameLine(); + if (ImGui::DragInt2("##Tile Size", size)) + { + SetTileSize({size[0], size[1]}); + } } }} \ No newline at end of file diff --git a/src/run_modes/editor/contents/world.h b/src/run_modes/editor/contents/world.h index 483db88..3ece45a 100644 --- a/src/run_modes/editor/contents/world.h +++ b/src/run_modes/editor/contents/world.h @@ -33,6 +33,7 @@ namespace lunarium { namespace editor [[nodiscard]] virtual OpRes Deserialize(nlohmann::ordered_json& node); [[nodiscord]] virtual bool IsValidNode(nlohmann::ordered_json& node); [[nodiscard]] virtual nlohmann::ordered_json AsJSON(); + void DrawProperties(); lunarium::World* GetWorld(); diff --git a/src/run_modes/editor/editor.cpp b/src/run_modes/editor/editor.cpp index 653b58e..dafbaae 100644 --- a/src/run_modes/editor/editor.cpp +++ b/src/run_modes/editor/editor.cpp @@ -467,5 +467,10 @@ namespace editor // TODO: Unload current world, Load new world ((WorldTree*)mPanelManager.GetPanel(mPanels.WorldTree))->SetWorld(pWorld); } + + void Editor::OnAssetSelected(EditorAsset* pAsset) + { + ((PropertiesView*)mPanelManager.GetPanel(mPanels.PropertiesView))->SetSelection(pAsset); + } } } \ No newline at end of file diff --git a/src/run_modes/editor/editor.h b/src/run_modes/editor/editor.h index eb21ce5..13b75c1 100644 --- a/src/run_modes/editor/editor.h +++ b/src/run_modes/editor/editor.h @@ -34,7 +34,7 @@ namespace lunarium { namespace editor TT_MAP_EDITOR, }; - + class EditorAsset; class MapEditor; class Editor : public iRunMode { @@ -51,13 +51,14 @@ namespace lunarium { namespace editor bool IsToolOpen(ToolType type) const; - void ChangeWorld(lunarium::World* pWorld); std::filesystem::path GetAssetBrowserLocation(); Project* GetProject(); // Panel events void OnEntitySelect(lunarium::Entity* pEnt); + void ChangeWorld(lunarium::World* pWorld); + void OnAssetSelected(EditorAsset* pAsset); private: Editor(const Editor&) = delete; diff --git a/src/run_modes/editor/panels/asset_browser.cpp b/src/run_modes/editor/panels/asset_browser.cpp index e470071..7ec07a5 100644 --- a/src/run_modes/editor/panels/asset_browser.cpp +++ b/src/run_modes/editor/panels/asset_browser.cpp @@ -145,7 +145,7 @@ namespace editor float left = xPos; - ImGui::BeginChild("ToolBar", ImVec2(0, ImGui::GetFrameHeightWithSpacing() * 1.5f)); + ImGui::BeginChild("ToolBar", ImVec2(0, ImGui::GetFrameHeightWithSpacing() * 1.5f), false, ImGuiWindowFlags_NoScrollbar); ImGui::PushFont(GUI::GetInstance().GetFont(GuiFont::FONT_ROBO_SMALL)); ImGui::TextUnformatted(mpEditor->GetProject()->MakeRelativeToAssets(mSelectedDir, true).string().c_str()); ImGui::PopFont(); @@ -208,6 +208,7 @@ namespace editor { // TODO: Show properties if this is new selection (meaning wasn't selected last frame) // Logger::Info(Editor::LogCat, "Asset selected. Properties shold show in the PropertiesView Panel"); + mpEditor->OnAssetSelected((*iter)); } if (ImGui::BeginDragDropSource()) {