added mouse1 as a bindable key/minor fixes

This commit is contained in:
LIghty 2018-03-25 12:32:53 +02:00
parent 3919e97aa2
commit 5daa0692ac

View File

@ -77,7 +77,15 @@ bool ItemVariable::ConsumesKey(ButtonCode_t key)
void ItemVariable::OnMousePress() void ItemVariable::OnMousePress()
{ {
if (catvar.type == CV_KEY) if (catvar.type == CV_KEY)
capturing = true; {
if (capturing)
{
catvar = ButtonCode_t::MOUSE_LEFT;
capturing = false;
}
else
capturing = true;
}
if (catvar.type == CV_SWITCH) if (catvar.type == CV_SWITCH)
catvar = !catvar; catvar = !catvar;
} }
@ -107,8 +115,6 @@ void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat)
switch (catvar.type) switch (catvar.type)
{ {
case CV_ENUM:
case CV_SWITCH:
case CV_STRING: case CV_STRING:
{ {
if (key == ButtonCode_t::KEY_BACKSPACE) if (key == ButtonCode_t::KEY_BACKSPACE)
@ -136,7 +142,6 @@ void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat)
} }
} }
break; break;
case CV_INT:
case CV_FLOAT: case CV_FLOAT:
{ {
if (catvar.restricted) if (catvar.restricted)
@ -144,6 +149,7 @@ void ItemVariable::OnKeyPress(ButtonCode_t key, bool repeat)
else else
change = 1.0f; change = 1.0f;
} }
break;
} }
if (change < 1.0f && catvar.type == CV_INT) if (change < 1.0f && catvar.type == CV_INT)