inputtype::button renamed to inputtype::mouse
This commit is contained in:
@@ -179,7 +179,7 @@ void InputBindBox::drawBackground(Batch2D* batch, Assets* assets) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InputBindBox::clicked(GUI*, int button) {
|
void InputBindBox::clicked(GUI*, int button) {
|
||||||
binding.type = inputtype::button;
|
binding.type = inputtype::mouse;
|
||||||
binding.code = button;
|
binding.code = button;
|
||||||
defocus();
|
defocus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ std::string write_controls() {
|
|||||||
json::JObject* jentry = new json::JObject();
|
json::JObject* jentry = new json::JObject();
|
||||||
switch (binding.type) {
|
switch (binding.type) {
|
||||||
case inputtype::keyboard: jentry->put("type", "keyboard"); break;
|
case inputtype::keyboard: jentry->put("type", "keyboard"); break;
|
||||||
case inputtype::button: jentry->put("type", "button"); break;
|
case inputtype::mouse: jentry->put("type", "mouse"); break;
|
||||||
default: throw std::runtime_error("unsupported control type");
|
default: throw std::runtime_error("unsupported control type");
|
||||||
}
|
}
|
||||||
jentry->put("code", binding.code);
|
jentry->put("code", binding.code);
|
||||||
@@ -72,8 +72,8 @@ void load_controls(std::string filename, std::string source) {
|
|||||||
|
|
||||||
if (typestr == "keyboard") {
|
if (typestr == "keyboard") {
|
||||||
type = inputtype::keyboard;
|
type = inputtype::keyboard;
|
||||||
} else if (typestr == "button") {
|
} else if (typestr == "mouse") {
|
||||||
type = inputtype::button;
|
type = inputtype::mouse;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "unknown input type '" << typestr << "'" << std::endl;
|
std::cerr << "unknown input type '" << typestr << "'" << std::endl;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void Events::pullEvents(){
|
|||||||
bool newstate = false;
|
bool newstate = false;
|
||||||
switch (binding.type) {
|
switch (binding.type) {
|
||||||
case inputtype::keyboard: newstate = pressed(binding.code); break;
|
case inputtype::keyboard: newstate = pressed(binding.code); break;
|
||||||
case inputtype::button: newstate = clicked(binding.code); break;
|
case inputtype::mouse: newstate = clicked(binding.code); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newstate) {
|
if (newstate) {
|
||||||
|
|||||||
+2
-2
@@ -80,7 +80,7 @@ namespace mousecode {
|
|||||||
|
|
||||||
enum class inputtype {
|
enum class inputtype {
|
||||||
keyboard,
|
keyboard,
|
||||||
button,
|
mouse,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Binding {
|
struct Binding {
|
||||||
@@ -100,7 +100,7 @@ struct Binding {
|
|||||||
const char* text() const {
|
const char* text() const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case inputtype::keyboard: return keycode::name(code);
|
case inputtype::keyboard: return keycode::name(code);
|
||||||
case inputtype::button: return mousecode::name(code);
|
case inputtype::mouse: return mousecode::name(code);
|
||||||
}
|
}
|
||||||
return "<unknown input type>";
|
return "<unknown input type>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user