Browse Source

Merge pull request #23 from tamara-schmitz/fixcompileissue

pull/24/head
Ian Chamberlain 1 year ago committed by GitHub
parent
commit
0d02484f1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      citro3d/examples/triangle.rs
  2. 4
      citro3d/src/render.rs

22
citro3d/examples/triangle.rs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
use citro3d::render::{ClearFlags, Target};
use citro3d::{include_aligned_bytes, shader};
use citro3d_sys::C3D_Mtx;
use ctru::gfx::{Gfx, RawFrameBuffer, Screen};
use ctru::services::gfx::{Gfx, RawFrameBuffer, Screen};
use ctru::services::apt::Apt;
use ctru::services::hid::{Hid, KeyPad};
use ctru::services::soc::Soc;
@ -51,27 +51,25 @@ static SHADER_BYTES: &[u8] = @@ -51,27 +51,25 @@ static SHADER_BYTES: &[u8] =
include_aligned_bytes!(concat!(env!("OUT_DIR"), "/examples/assets/vshader.shbin"));
fn main() {
ctru::init();
let mut soc = Soc::init().expect("failed to get SOC");
let mut soc = Soc::new().expect("failed to get SOC");
drop(soc.redirect_to_3dslink(true, true));
let gfx = Gfx::init().expect("Couldn't obtain GFX controller");
let hid = Hid::init().expect("Couldn't obtain HID controller");
let apt = Apt::init().expect("Couldn't obtain APT controller");
let gfx = Gfx::new().expect("Couldn't obtain GFX controller");
let mut hid = Hid::new().expect("Couldn't obtain HID controller");
let apt = Apt::new().expect("Couldn't obtain APT controller");
let mut top_screen = gfx.top_screen.borrow_mut();
let RawFrameBuffer { width, height, .. } = top_screen.get_raw_framebuffer();
let RawFrameBuffer { width, height, .. } = top_screen.raw_framebuffer();
let mut instance = citro3d::Instance::new().expect("failed to initialize Citro3D");
let mut top_target = citro3d::render::Target::new(width, height, top_screen, None)
let mut top_target = citro3d::render::Target::new(width.try_into().unwrap(), height.try_into().unwrap(), top_screen, None)
.expect("failed to create render target");
let mut bottom_screen = gfx.bottom_screen.borrow_mut();
let RawFrameBuffer { width, height, .. } = bottom_screen.get_raw_framebuffer();
let RawFrameBuffer { width, height, .. } = bottom_screen.raw_framebuffer();
let mut bottom_target = citro3d::render::Target::new(width, height, bottom_screen, None)
let mut bottom_target = citro3d::render::Target::new(width.try_into().unwrap(), height.try_into().unwrap(), bottom_screen, None)
.expect("failed to create bottom screen render target");
let shader = shader::Library::from_bytes(SHADER_BYTES).unwrap();
@ -87,7 +85,7 @@ fn main() { @@ -87,7 +85,7 @@ fn main() {
while apt.main_loop() {
hid.scan_input();
if hid.keys_down().contains(KeyPad::KEY_START) {
if hid.keys_down().contains(KeyPad::START) {
break;
}

4
citro3d/src/render.rs

@ -6,7 +6,7 @@ use std::cell::RefMut; @@ -6,7 +6,7 @@ use std::cell::RefMut;
use citro3d_sys::{
C3D_RenderTarget, C3D_RenderTargetCreate, C3D_RenderTargetDelete, C3D_DEPTHTYPE,
};
use ctru::gfx::Screen;
use ctru::services::gfx::Screen;
use ctru::services::gspgpu::FramebufferFormat;
use ctru_sys::{GPU_COLORBUF, GPU_DEPTHBUF};
@ -44,7 +44,7 @@ impl<'screen> Target<'screen> { @@ -44,7 +44,7 @@ impl<'screen> Target<'screen> {
screen: RefMut<'screen, dyn Screen>,
depth_format: Option<DepthFormat>,
) -> Result<Self> {
let color_format: ColorFormat = screen.get_framebuffer_format().into();
let color_format: ColorFormat = screen.framebuffer_format().into();
let raw = unsafe {
C3D_RenderTargetCreate(

Loading…
Cancel
Save