Add zoom level keybinds
This commit is contained in:
parent
7d86194cae
commit
d7ba113688
@ -1,8 +1,26 @@
|
|||||||
{
|
{
|
||||||
"opensb": {
|
"opensb": {
|
||||||
"name": "OpenStarbound",
|
"groups": {
|
||||||
"bannerName" : "Open^#ebd74a;Starbound",
|
"camera": { "name": "Camera" }
|
||||||
|
},
|
||||||
|
"name": "Open^#ebd74a;Starbound",
|
||||||
"binds": {
|
"binds": {
|
||||||
|
"zoomIn": {
|
||||||
|
"default": [{
|
||||||
|
"type": "key",
|
||||||
|
"value": "="
|
||||||
|
}],
|
||||||
|
"group" : "camera",
|
||||||
|
"name": "Zoom In"
|
||||||
|
},
|
||||||
|
"zoomOut": {
|
||||||
|
"default": [{
|
||||||
|
"type": "key",
|
||||||
|
"value": "-"
|
||||||
|
}],
|
||||||
|
"group" : "camera",
|
||||||
|
"name": "Zoom Out"
|
||||||
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"default": [{
|
"default": [{
|
||||||
"type": "key",
|
"type": "key",
|
||||||
|
@ -315,6 +315,18 @@ void ClientApplication::processInput(InputEvent const& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_input->handleInput(event, processed);
|
m_input->handleInput(event, processed);
|
||||||
|
WorldCamera& camera = m_worldPainter->camera();
|
||||||
|
|
||||||
|
auto config = m_root->configuration();
|
||||||
|
int zoomOffset = 0;
|
||||||
|
|
||||||
|
if (auto presses = m_input->bindDown("opensb", "zoomIn"))
|
||||||
|
zoomOffset += *presses;
|
||||||
|
if (auto presses = m_input->bindDown("opensb", "zoomOut"))
|
||||||
|
zoomOffset -= *presses;
|
||||||
|
|
||||||
|
if (zoomOffset != 0)
|
||||||
|
config->set("zoomLevel", max(1.0f, round(config->get("zoomLevel").toFloat() + zoomOffset)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientApplication::update() {
|
void ClientApplication::update() {
|
||||||
|
Loading…
Reference in New Issue
Block a user