diff --git a/README.md b/README.md index ace132d..7cdc968 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,6 @@ Supported operating system: _Notice_: If you're using WINE on Linux, make sure that osu! and this application run in the same `WINEPREFIX`. -## Todo -* Support other modes. -* Optimize further for consistency and speed. -* Allow even more customizations. - ## For developers This project uses [SFML](https://www.sfml-dev.org/index.php) and [JsonCpp](https://github.com/open-source-parsers/jsoncpp). JsonCpp libraries are directly included in the source using the provided `amalgamation.py` from the developers. @@ -42,3 +37,5 @@ make test ``` Alternatively, you can copy the newly-compiled `bin/bongocat.exe` into the base directory and execute it. + +If you have troubles compiling, it can be due to version mismatch between your compiler and SFML. See [#43](https://github.com/kuroni/bongocat-osu/issues/43) for more information. diff --git a/src/data.cpp b/src/data.cpp index d63f732..3fa42eb 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -25,6 +25,7 @@ void create_config() { }, "osu": { "mouse": true, + "toggleSmoke": false, "paw": [255, 255, 255], "pawEdge": [0, 0, 0], "key1": [90], diff --git a/src/osu.cpp b/src/osu.cpp index 84e56fe..dcaa81a 100644 --- a/src/osu.cpp +++ b/src/osu.cpp @@ -8,13 +8,16 @@ int horizontal, vertical; int paw_r, paw_g, paw_b; int paw_edge_r, paw_edge_g, paw_edge_b; double scale; -bool is_mouse, is_letterbox, is_left_handed; +bool is_mouse, is_letterbox, is_left_handed, is_enable_toggle_smoke; sf::Sprite bg, up, left, right, device, smoke, wave; int key_state = 0; bool left_key_state = false; bool right_key_state = false; bool wave_key_state = false; +bool previous_smoke_key_state = false; +bool current_smoke_key_state = false; +bool is_toggle_smoke = false; double timer_left_key = -1; double timer_right_key = -1; double timer_wave_key = -1; @@ -40,6 +43,7 @@ bool init() { Json::Value osu = data::cfg["osu"]; is_mouse = osu["mouse"].asBool(); + is_enable_toggle_smoke = osu["toggleSmoke"].asBool(); paw_r = osu["paw"][0].asInt(); paw_g = osu["paw"][1].asInt(); @@ -401,12 +405,32 @@ void draw() { window.draw(device); } - // drawing smoke + // draw smoke + bool is_smoke_key_pressed = false; + for (Json::Value &v : smoke_key_value) { if (GetKeyState(v.asInt()) & WM_KEYDOWN) { - window.draw(smoke); + is_smoke_key_pressed = true; break; } } + + if (is_enable_toggle_smoke) { + previous_smoke_key_state = current_smoke_key_state; + current_smoke_key_state = is_smoke_key_pressed; + + bool is_smoke_key_down = current_smoke_key_state && (current_smoke_key_state != previous_smoke_key_state); + + if (is_smoke_key_down) { + is_toggle_smoke = !is_toggle_smoke; + } + } + else { + is_toggle_smoke = is_smoke_key_pressed; + } + + if (is_toggle_smoke) { + window.draw(smoke); + } } }; // namespace osu