latch input
This commit is contained in:
parent
43e366bcd5
commit
bcc5930f65
@ -9,7 +9,7 @@ pub struct Button {
|
|||||||
impl Button {
|
impl Button {
|
||||||
pub fn begin_frame(&mut self, is_down_now: bool) {
|
pub fn begin_frame(&mut self, is_down_now: bool) {
|
||||||
let was_down = self.down;
|
let was_down = self.down;
|
||||||
self.down = is_down_now;
|
self.down = is_down_now.clone();
|
||||||
|
|
||||||
self.pressed = !was_down && self.down;
|
self.pressed = !was_down && self.down;
|
||||||
self.released = was_down && !self.down;
|
self.released = was_down && !self.down;
|
||||||
|
|||||||
@ -12,7 +12,7 @@ impl Touch {
|
|||||||
/// Flags transitórias devem durar apenas 1 frame.
|
/// Flags transitórias devem durar apenas 1 frame.
|
||||||
pub fn begin_frame(&mut self, signals: &InputSignals) {
|
pub fn begin_frame(&mut self, signals: &InputSignals) {
|
||||||
self.f.begin_frame(signals.f_signal);
|
self.f.begin_frame(signals.f_signal);
|
||||||
self.x = signals.x_pos;
|
self.x = signals.x_pos.clone();
|
||||||
self.y = signals.y_pos;
|
self.y = signals.y_pos.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user