Browse Source

Minor fixes + clippy

pull/4/head
Ian Chamberlain 2 years ago
parent
commit
f8e8542f92
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 10
      citro3d/examples/triangle.rs

10
citro3d/examples/triangle.rs

@ -1,7 +1,7 @@
use citro3d::render::{ClearFlags, Target}; use citro3d::render::{ClearFlags, Target};
use citro3d::{include_aligned_bytes, shader}; use citro3d::{include_aligned_bytes, shader};
use citro3d_sys::C3D_Mtx; use citro3d_sys::C3D_Mtx;
use ctru::gfx::{Gfx, Screen}; use ctru::gfx::{Gfx, RawFrameBuffer, Screen};
use ctru::services::apt::Apt; use ctru::services::apt::Apt;
use ctru::services::hid::{Hid, KeyPad}; use ctru::services::hid::{Hid, KeyPad};
use ctru::services::soc::Soc; use ctru::services::soc::Soc;
@ -59,8 +59,7 @@ fn main() {
let apt = Apt::init().expect("Couldn't obtain APT controller"); let apt = Apt::init().expect("Couldn't obtain APT controller");
let mut top_screen = gfx.top_screen.borrow_mut(); let mut top_screen = gfx.top_screen.borrow_mut();
let frame_buffer = top_screen.get_raw_framebuffer(); let RawFrameBuffer { width, height, .. } = top_screen.get_raw_framebuffer();
let (width, height) = (frame_buffer.width, frame_buffer.height);
let mut instance = citro3d::Instance::new().expect("failed to initialize Citro3D"); let mut instance = citro3d::Instance::new().expect("failed to initialize Citro3D");
@ -68,8 +67,7 @@ fn main() {
.expect("failed to create render target"); .expect("failed to create render target");
let mut bottom_screen = gfx.bottom_screen.borrow_mut(); let mut bottom_screen = gfx.bottom_screen.borrow_mut();
let frame_buffer = bottom_screen.get_raw_framebuffer(); let RawFrameBuffer { width, height, .. } = bottom_screen.get_raw_framebuffer();
let (width, height) = (frame_buffer.width, frame_buffer.height);
let mut bottom_target = citro3d::render::Target::new(width, height, bottom_screen, None) let mut bottom_target = citro3d::render::Target::new(width, height, bottom_screen, None)
.expect("failed to create bottom screen render target"); .expect("failed to create bottom screen render target");
@ -144,7 +142,7 @@ fn scene_init(program: &mut shader::Program) -> (i8, C3D_Mtx, *mut libc::c_void)
// Create the vertex buffer object // Create the vertex buffer object
let vbo_data: *mut Vertex = citro3d_sys::linearAlloc( let vbo_data: *mut Vertex = citro3d_sys::linearAlloc(
std::mem::size_of_val(&VERTICES) std::mem::size_of_val(VERTICES)
.try_into() .try_into()
.expect("size fits in u32"), .expect("size fits in u32"),
) )

Loading…
Cancel
Save