Add ren.showBrush to the LUA api to allow hiding the brush
This commit is contained in:
parent
b1506e15d4
commit
cc2022504a
@ -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);
|
||||
|
@ -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; }
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user