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