Skip to content

Commit 2c2d2d4

Browse files
committed
Add UI element to represent the touch-region to swap screen sizes
In resized ScreenMode
1 parent a631546 commit 2c2d2d4

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/core/graphics/gpu_renderer.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::core::graphics::gl_glyph::GlGlyph;
2+
use crate::core::graphics::gl_rectangle:: GlRectangle;
23
use crate::core::graphics::gpu::{PowCnt1, DISPLAY_HEIGHT, DISPLAY_WIDTH};
34
use crate::core::graphics::gpu_2d::registers_2d::Gpu2DRegisters;
45
use crate::core::graphics::gpu_2d::renderer_2d::Gpu2DRenderer;
@@ -7,7 +8,7 @@ use crate::core::graphics::gpu_3d::registers_3d::Gpu3DRegisters;
78
use crate::core::graphics::gpu_3d::renderer_3d::Gpu3DRenderer;
89
use crate::core::graphics::gpu_mem_buf::GpuMemBuf;
910
use crate::core::memory::mem::Memory;
10-
use crate::presenter::{Presenter, PresenterScreen, PRESENTER_SCREEN_HEIGHT, PRESENTER_SCREEN_WIDTH, PRESENTER_SUB_REGULAR, PRESENTER_SUB_RESIZED, PRESENTER_SUB_RESIZED_INV, PRESENTER_SUB_ROTATED};
11+
use crate::presenter::{Presenter, PresenterScreen, PRESENTER_SCREEN_HEIGHT, PRESENTER_SCREEN_WIDTH, PRESENTER_SUB_REGULAR, PRESENTER_SUB_RESIZED, PRESENTER_SUB_RESIZED_INV, PRESENTER_SUB_ROTATED, SWAP_ZONE_WIDTH, SWAP_ZONE_HEIGHT};
1112
use crate::settings::{ScreenMode, Settings};
1213
use gl::types::GLuint;
1314
use std::intrinsics::unlikely;
@@ -41,6 +42,7 @@ pub struct GpuRenderer {
4142

4243
common: GpuRendererCommon,
4344
gl_glyph: GlGlyph,
45+
gl_rectangle: GlRectangle,
4446

4547
rendering: Mutex<bool>,
4648
rendering_condvar: Condvar,
@@ -66,6 +68,7 @@ impl GpuRenderer {
6668

6769
common: GpuRendererCommon::new(),
6870
gl_glyph: GlGlyph::new(),
71+
gl_rectangle: GlRectangle::new(),
6972

7073
rendering: Mutex::new(false),
7174
rendering_condvar: Condvar::new(),
@@ -232,6 +235,15 @@ impl GpuRenderer {
232235

233236
let arm7_emu: &str = settings.arm7_hle().into();
234237
self.gl_glyph.draw(format!("{}ms {arm7_emu}\n{per}% ({fps}fps)\n{info_text}", self.average_render_time));
238+
239+
// Draw a UI element to represent the touch-region to swap screen sizes in resized screen mode
240+
if settings.screenmode() == ScreenMode::Resized
241+
{
242+
let swap_zone_x = (PRESENTER_SCREEN_WIDTH - SWAP_ZONE_WIDTH - 4) as f32;
243+
let swap_zone_y = 5 as f32;
244+
self.gl_rectangle.draw_filled_stroke(swap_zone_x, swap_zone_y, (SWAP_ZONE_WIDTH) as f32, SWAP_ZONE_HEIGHT as f32,
245+
(0.31, 0.31, 0.31, 1.0), (0.66, 0.66, 0.66, 1.0), 1.0);
246+
}
235247

236248
#[cfg(feature = "profiling")]
237249
gl::ReadPixels(

0 commit comments

Comments
 (0)