mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2025-01-28 21:37:10 +00:00
Fix sound volume change and inventory overflow on Android (#207)
* Android changing volume fix. Added arrows to indicate volume buttons * Fix inventory overflowing on Android
This commit is contained in:
parent
51834be404
commit
f99b452073
|
@ -133,7 +133,11 @@ fn get_insets() -> GameResult<(f32, f32, f32, f32)> {
|
|||
vm_env.get_int_array_region(field, 0, &mut elements)?;
|
||||
|
||||
vm_env.delete_local_ref(JObject::from_raw(field));
|
||||
|
||||
|
||||
//Game always runs with horizontal orientation so top and bottom cutouts not needed and only wastes piece of the screen
|
||||
elements[1] = 0;
|
||||
elements[3] = 0;
|
||||
|
||||
Ok((elements[0] as f32, elements[1] as f32, elements[2] as f32, elements[3] as f32))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -594,6 +594,24 @@ impl<T: std::cmp::PartialEq + std::default::Default + Clone> Menu<T> {
|
|||
|
||||
graphics::draw_rect(ctx, bar_rect, Color::new(1.0, 1.0, 1.0, 1.0))?;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
state
|
||||
.font
|
||||
.builder()
|
||||
.x(self.x as f32 - 25.0)
|
||||
.y(y)
|
||||
.shadow(true)
|
||||
.draw("<", ctx, &state.constants, &mut state.texture_set)?;
|
||||
state
|
||||
.font
|
||||
.builder()
|
||||
.x((self.x + self.width as isize) as f32 + 15.0)
|
||||
.y(y)
|
||||
.shadow(true)
|
||||
.draw(">", ctx, &state.constants, &mut state.texture_set)?;
|
||||
}
|
||||
}
|
||||
MenuEntry::NewSave => {
|
||||
state.font.builder().position(self.x as f32 + 20.0, y).draw(
|
||||
|
@ -829,6 +847,7 @@ impl<T: std::cmp::PartialEq + std::default::Default + Clone> Menu<T> {
|
|||
|| state.touch_controls.consume_click_in(left_entry_bounds) =>
|
||||
{
|
||||
state.sound_manager.play_sfx(1);
|
||||
self.selected = idx.clone();
|
||||
return MenuSelectionResult::Left(self.selected.clone(), entry, -1);
|
||||
}
|
||||
MenuEntry::Options(_, _, _) | MenuEntry::OptionsBar(_, _)
|
||||
|
@ -836,6 +855,7 @@ impl<T: std::cmp::PartialEq + std::default::Default + Clone> Menu<T> {
|
|||
|| state.touch_controls.consume_click_in(right_entry_bounds) =>
|
||||
{
|
||||
state.sound_manager.play_sfx(1);
|
||||
self.selected = idx.clone();
|
||||
return MenuSelectionResult::Right(self.selected.clone(), entry, 1);
|
||||
}
|
||||
MenuEntry::DescriptiveOptions(_, _, _, _)
|
||||
|
|
Loading…
Reference in a new issue