diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index 92f986a0c..30bdc3d2c 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -1044,6 +1044,16 @@ bool GameController::GetHudEnable() return gameView->GetHudEnable(); } +void GameController::SetBrushEnable(bool brushState) +{ + gameView->SetBrushEnable(brushState); +} + +bool GameController::GetBrushEnable() +{ + return gameView->GetBrushEnable(); +} + void GameController::SetDebugHUD(bool hudState) { gameView->SetDebugHUD(hudState); diff --git a/src/gui/game/GameController.h b/src/gui/game/GameController.h index fece5979b..078650a04 100644 --- a/src/gui/game/GameController.h +++ b/src/gui/game/GameController.h @@ -104,6 +104,8 @@ public: void ShowGravityGrid(); void SetHudEnable(bool hudState); bool GetHudEnable(); + void SetBrushEnable(bool brushState); + bool GetBrushEnable(); void SetDebugHUD(bool hudState); bool GetDebugHUD(); void SetDebugFlags(unsigned int flags) { debugFlags = flags; } diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 458a460bf..86a682419 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -172,6 +172,7 @@ GameView::GameView(): ctrlBehaviour(false), altBehaviour(false), showHud(true), + showBrush(true), showDebug(false), delayedActiveMenu(-1), wallBrush(false), @@ -460,6 +461,16 @@ bool GameView::GetHudEnable() return showHud; } +void GameView::SetBrushEnable(bool brushState) +{ + showBrush = brushState; +} + +bool GameView::GetBrushEnable() +{ + return showBrush; +} + void GameView::SetDebugHUD(bool mode) { showDebug = mode; @@ -1940,7 +1951,7 @@ void GameView::OnDraw() ren->clearScreen(1.0f); ren->RenderBegin(); ren->SetSample(c->PointTranslate(currentMouse).X, c->PointTranslate(currentMouse).Y); - if (selectMode == SelectNone && (!zoomEnabled || zoomCursorFixed) && activeBrush && (isMouseDown || (currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES))) + if (showBrush && selectMode == SelectNone && (!zoomEnabled || zoomCursorFixed) && activeBrush && (isMouseDown || (currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES))) { ui::Point finalCurrentMouse = c->PointTranslate(currentMouse); ui::Point initialDrawPoint = drawPoint1; diff --git a/src/gui/game/GameView.h b/src/gui/game/GameView.h index 417996bd3..27c3c1e56 100644 --- a/src/gui/game/GameView.h +++ b/src/gui/game/GameView.h @@ -46,6 +46,7 @@ private: bool ctrlBehaviour; bool altBehaviour; bool showHud; + bool showBrush; bool showDebug; int delayedActiveMenu; bool wallBrush; @@ -142,6 +143,8 @@ public: void SetSample(SimulationSample sample); void SetHudEnable(bool hudState); bool GetHudEnable(); + void SetBrushEnable(bool hudState); + bool GetBrushEnable(); void SetDebugHUD(bool mode); bool GetDebugHUD(); bool GetPlacingSave(); diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index b8c39c67a..040ee6bc4 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -2177,6 +2177,7 @@ void LuaScriptInterface::initRendererAPI() {"decorations", renderer_decorations}, //renderer_debugHUD {"grid", renderer_grid}, {"debugHUD", renderer_debugHUD}, + {"showBrush", renderer_showBrush}, {"depth3d", renderer_depth3d}, {"zoomEnabled", renderer_zoomEnabled}, {"zoomWindow", renderer_zoomWindowInfo}, @@ -2362,6 +2363,19 @@ int LuaScriptInterface::renderer_debugHUD(lua_State * l) return 0; } +int LuaScriptInterface::renderer_showBrush(lua_State * l) +{ + int acount = lua_gettop(l); + if (acount == 0) + { + lua_pushnumber(l, luacon_controller->GetBrushEnable()); + return 1; + } + int brush = luaL_optint(l, 1, -1); + luacon_controller->SetBrushEnable(brush); + return 0; +} + int LuaScriptInterface::renderer_depth3d(lua_State * l) { return luaL_error(l, "This feature is no longer supported"); diff --git a/src/lua/LuaScriptInterface.h b/src/lua/LuaScriptInterface.h index caa30a8aa..b616b5d86 100644 --- a/src/lua/LuaScriptInterface.h +++ b/src/lua/LuaScriptInterface.h @@ -119,6 +119,7 @@ class LuaScriptInterface: public CommandInterface static int renderer_decorations(lua_State * l); static int renderer_grid(lua_State * l); static int renderer_debugHUD(lua_State * l); + static int renderer_showBrush(lua_State * l); static int renderer_depth3d(lua_State * l); static int renderer_zoomEnabled(lua_State *l); static int renderer_zoomWindowInfo(lua_State *l);