mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 00:01:34 +11:00
use clamp
This commit is contained in:
parent
0d609f6d4a
commit
559b53456f
|
@ -390,8 +390,7 @@ impl CursorState {
|
|||
let mut new_x = current_x.saturating_add_signed(lr as isize).max(1);
|
||||
let new_y = current_y
|
||||
.saturating_add_signed(ud as isize)
|
||||
.max(1)
|
||||
.min(PLAY_AREA_HEIGHT - 2);
|
||||
.clamp(1, PLAY_AREA_HEIGHT - 2);
|
||||
|
||||
if new_x == PLAY_AREA_WIDTH - 1 {
|
||||
new_x = new_x.min(PLAY_AREA_WIDTH - 2);
|
||||
|
|
Loading…
Reference in a new issue