Skip to content

Commit

Permalink
pressed_by_file getter
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex committed Nov 15, 2024
1 parent f394cdf commit c486f22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion neothesia-core/src/render/keyboard/key_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use wgpu_jumpstart::Color;
pub struct KeyState {
is_sharp: bool,

pub pressed_by_file: Option<Color>,
pressed_by_file: Option<Color>,
pressed_by_user: bool,
}

Expand All @@ -23,6 +23,10 @@ impl KeyState {
}
}

pub fn pressed_by_file(&self) -> Option<&Color> {
self.pressed_by_file.as_ref()
}

pub fn set_pressed_by_user(&mut self, is: bool) {
self.pressed_by_user = is;
}
Expand Down
2 changes: 1 addition & 1 deletion neothesia/src/scene/playing_scene/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl PlayingScene {
let glow_h = 150.0 + glow_state.time.sin() * 10.0;

let y = self.keyboard.pos().y;
if let Some(color) = &key_states[key.id()].pressed_by_file {
if let Some(color) = key_states[key.id()].pressed_by_file() {
glow_state.time += 0.1;
let mut color = color.into_linear_rgba();
let v = 0.2 * glow_state.time.cos().abs();
Expand Down

0 comments on commit c486f22

Please sign in to comment.