Initial Android pause menu support

This commit is contained in:
dawnDus 2022-02-11 22:28:30 -05:00
parent b457f5dd6f
commit c4f1c60e35
No known key found for this signature in database
GPG Key ID: 972AABDE81848F21
4 changed files with 7 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 B

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -143,7 +143,7 @@ impl GameEntity<(&Player, &mut Inventory)> for HUD {
let wtype = self.weapon_types[a];
if wtype != 0 {
rect = Rect::new_size(pos_x + weapon_offset - 4, 16 - 4, 24, 24);
rect = Rect::new_size(pos_x + weapon_offset - 4, 16 + (4 * state.scale as isize), 24, 24);
if state.touch_controls.consume_click_in(rect) {
state.sound_manager.play_sfx(4);

View File

@ -124,6 +124,8 @@ impl TouchControls {
&Rect::new_size(0, 3 * 32, 32, 32),
);
batch.add_rect_tinted(4.0, 4.0, color, &Rect::new_size(32, 3 * 32, 32, 32));
batch.draw(ctx)?;
}

View File

@ -216,6 +216,10 @@ impl PlayerController for TouchPlayerController {
))
.is_some(),
);
self.state.set_pause(
self.state.pause() || state.touch_controls.point_in(Rect::new_size(0, 0, 20, 20)).is_some(),
);
}
}