Skip to content

Commit 54dc120

Browse files
committed
feat: Introduce graphical settings interface, KeyViewer panel, and custom color options, updating README accordingly.
1 parent ead0b9c commit 54dc120

4 files changed

Lines changed: 52 additions & 31 deletions

File tree

README.md

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ RainingKeys is a purely external overlay application that visualizes keyboard in
2121
- **External Overlay**: Runs as a transparent, always-on-top, click-through window over any game.
2222
- **Graphic Interface**: Live configuration window to adjust settings on the fly.
2323
- **Positioning**: Configurable X/Y overlay position.
24-
- **Fall Direction**: Supports both Down (Classic) and Up (Reverse) fall directions.
24+
- **Fall Direction**: Supports both Down (Classic) and Up (Reverse) fall directions (controlled by KeyViewer position).
2525
- **Accurate Timing**: Uses high-resolution monotonic clocks (`time.perf_counter`) for smooth, jitter-free falling animation.
2626
- **Lane System**: Configurable key-to-lane mapping (e.g., WASD, Space, Enter).
27+
- **KeyViewer Panel**: Visual keyboard representation that shows key presses and counts.
28+
- **KeyViewer Transparency**: Adjustable opacity for inactive keys.
29+
- **Custom Visuals**: Configurable colors (RGBA) and adjustable overlay speed.
2730
- **Long Press Support**: Visualizes held keys with variable-length bars.
2831
- **Performance Optimized**: Implements object pooling and efficient rendering logic to minimize CPU/GPU usage.
29-
- **Fade Out**: Distance-based fade-out for visual clarity.
30-
- **Input Latency Compensation**: Configurable offset to visually align inputs with audio latency.
3132

3233
## Tech Stack
3334

@@ -66,22 +67,22 @@ RainingKeysPython/
6667

6768
## Usage
6869

69-
1. Run the build script:
70+
1. Run the application:
7071
```bash
71-
python build.py
72+
python main.py
7273
```
73-
2. The script will generate:
74-
- Folder: `dist/RainingKeysPython/`
75-
- Zip: `RainingKeysPython.zip` (or `RainingKeysPython-debug.zip` if in debug mode)
76-
77-
### Debug vs Release Build
78-
You can toggle the console window visibility via `config.ini`:** window (controls settings).
79-
3. Use the Config window to move the overlay or change speed/direction live.
80-
4. **Configure Lanes**:
74+
2. The application launches two windows:
75+
- **Transparent Overlay**: The visualizer itself (click-through).
76+
- **Config Window**: The controls (Alt+Tab to find if hidden).
77+
3. **Configure Lanes**:
8178
- Click "Record Lane Keys" in the config window.
8279
- Press the keys you want to bind (e.g., `Z`, `X`, `.`, `/`).
83-
- Click "Stop Recording" to save. The overlay uses these keys immediately.
84-
5. **To Exit**: Close the Config window or press `Ctrl+C` in the terminal.
80+
- Click "Stop Recording" to save.
81+
4. **Customize**:
82+
- Adjust **Scroll Speed** and **Bar Color**.
83+
- Enable **KeyViewer** to see the static key panel.
84+
- Drag **Inactive Opacity** to change how faint unpressed keys look.
85+
- Change **KeyViewer Position** (Above/Below) to automatically flip the fall direction.
8586

8687
## Configuration
8788

@@ -93,20 +94,22 @@ You can edit this file manually or use the **GUI Settings Window**.
9394
| Section | Parameter | Description |
9495
| :--- | :--- | :--- |
9596
| `Visual` | `scroll_speed` | Falling speed in pixels per second. |
96-
| `Visual` | `fall_direction` | `down` or `up`. |
97+
| `Visual` | `bar_color` | RGBA color string (e.g., `0,255,255,200`). |
9798
| `Position` | `x` | Overlay X position (pixels). |
9899
| `Position` | `y` | Overlay Y position (pixels). |
99-
| `lanes` | `keys` | Comma-separated list of keys (e.g., `'z','x','.'`). |
100-
101-
*Note: Key mappings and colors are currently defined in `core/config.py`.*
100+
| `lanes` | `keys` | Comma-separated list of keys. |
101+
| `keyviewer` | `enabled` | Show/Hide KeyViewer panel. |
102+
| `keyviewer` | `panel_position` | `above` or `below`. Affects fall direction. |
103+
| `keyviewer` | `opacity` | Opacity of inactive keys (0.0 - 1.0). |
102104

103105
## Todo
104106

105-
- [x] Interactive Configuration UI (GUI for settings)
106-
- [x] Save/Load config from ini
107-
- [ ] Multi-monitor support
108-
- [ ] Custom color
109-
- [x] Custom key mapping
107+
- [x] Interactive Configuration UI
108+
- [x] Save/Load config
109+
- [x] Custom color selection
110+
- [x] Custom key mapping
111+
- [x] KeyViewer Panel & Key Counters
112+
- [ ] Multi-monitor support
110113

111114
## Disclaimer
112115

@@ -127,6 +130,8 @@ Any contributions you make are **greatly appreciated**.
127130
128131
This project is inspired by the **RainingKeys** mod for *A Dance of Fire and Ice*, originally created by **[paring-chan](https://github.com/paring-chan/RainingKeys)**.
129132
133+
Also credits to **[AdofaiTweaks](https://github.com/PizzaLovers007/AdofaiTweaks)** by **PizzaLovers007**.
134+
130135
## License
131136
132137
MIT License. See `LICENSE` for details.

core/gui.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ def init_ui(self):
135135
self.spin_kv_off_x.setValue(self.settings.kv_offset_x)
136136
self.spin_kv_off_x.valueChanged.connect(self.on_kv_changed)
137137
off_layout.addWidget(self.spin_kv_off_x)
138-
139138
off_layout.addWidget(QLabel("Y:"))
140139
self.spin_kv_off_y = QSpinBox()
141140
self.spin_kv_off_y.setRange(-1000, 1000)
@@ -144,6 +143,17 @@ def init_ui(self):
144143
off_layout.addWidget(self.spin_kv_off_y)
145144
kv_layout.addLayout(off_layout)
146145

146+
# Transparency Control
147+
trans_layout = QHBoxLayout()
148+
trans_layout.addWidget(QLabel("Inactive Opacity:"))
149+
self.spin_kv_opacity = QSpinBox()
150+
self.spin_kv_opacity.setRange(0, 100)
151+
self.spin_kv_opacity.setSuffix("%")
152+
self.spin_kv_opacity.setValue(int(self.settings.kv_opacity * 100))
153+
self.spin_kv_opacity.valueChanged.connect(self.on_kv_changed)
154+
trans_layout.addWidget(self.spin_kv_opacity)
155+
kv_layout.addLayout(trans_layout)
156+
147157
self.chk_kv_counts = QCheckBox("Show Key Counts")
148158
self.chk_kv_counts.setChecked(self.settings.kv_show_counts)
149159
self.chk_kv_counts.stateChanged.connect(self.on_kv_changed)
@@ -189,6 +199,7 @@ def on_kv_changed(self):
189199
self.settings.set('keyviewer', 'panel_offset_x', self.spin_kv_off_x.value())
190200
self.settings.set('keyviewer', 'panel_offset_y', self.spin_kv_off_y.value())
191201
self.settings.set('keyviewer', 'show_counts', self.chk_kv_counts.isChecked())
202+
self.settings.set('keyviewer', 'opacity', self.spin_kv_opacity.value() / 100.0)
192203
self.settings.save()
193204

194205
def toggle_recording(self):

core/overlay.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,11 @@ def draw_keyviewer(self, painter, geom):
371371
if bg_color.alpha() > 200:
372372
bg_color = bg_color.lighter(120)
373373
else:
374-
# Inactive: Scale alpha down (e.g. 20%)
374+
# Inactive: Scale alpha down based on settings
375375
current_alpha = bg_color.alpha()
376-
new_alpha = max(20, int(current_alpha * 0.2))
376+
# Opacity is 0.0 to 1.0. If opacity is 0.2, we want 20% of current alpha.
377+
opacity_factor = self.settings.kv_opacity
378+
new_alpha = int(current_alpha * opacity_factor)
377379
bg_color.setAlpha(new_alpha)
378380

379381
painter.setBrush(QBrush(bg_color))

core/settings_manager.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ def _load(self):
8484
self.config.set('keyviewer', 'height', '50')
8585
changed = True
8686

87+
if not self.config.has_option('keyviewer', 'opacity'):
88+
self.config.set('keyviewer', 'opacity', '0.2')
89+
changed = True
90+
8791
if changed:
8892
self.save()
8993

@@ -135,10 +139,6 @@ def save_lanes(self, key_list):
135139
def scroll_speed(self):
136140
return self.get('Visual', 'scroll_speed', Config.SCROLL_SPEED, int)
137141

138-
@property
139-
def scroll_speed(self):
140-
return self.get('Visual', 'scroll_speed', Config.SCROLL_SPEED, int)
141-
142142
# REMOVED: fall_direction property
143143

144144
@property
@@ -182,3 +182,6 @@ def kv_offset_y(self):
182182
@property
183183
def kv_show_counts(self):
184184
return self.config.getboolean('keyviewer', 'show_counts')
185+
@property
186+
def kv_opacity(self):
187+
return self.get('keyviewer', 'opacity', 0.2, float)

0 commit comments

Comments
 (0)