From 827fc7b9832c87b26de2213a30c34fc28c6a489d Mon Sep 17 00:00:00 2001
From: Tamara Schmitz <tamara.zoe.schmitz@posteo.de>
Date: Tue, 29 Aug 2023 01:07:57 +0200
Subject: [PATCH 1/2] update module and symbol names to match ctru-rs

---
 citro3d/src/render.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/citro3d/src/render.rs b/citro3d/src/render.rs
index 0a7a563..fc9b0eb 100644
--- a/citro3d/src/render.rs
+++ b/citro3d/src/render.rs
@@ -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> {
         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(

From daea4e42459ba77838184456913d4e77bc1984f9 Mon Sep 17 00:00:00 2001
From: Tamara Schmitz <tamara.zoe.schmitz@posteo.de>
Date: Tue, 29 Aug 2023 01:14:54 +0200
Subject: [PATCH 2/2] fix triangle example

---
 citro3d/examples/triangle.rs | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/citro3d/examples/triangle.rs b/citro3d/examples/triangle.rs
index 50831e0..3817b07 100644
--- a/citro3d/examples/triangle.rs
+++ b/citro3d/examples/triangle.rs
@@ -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] =
     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() {
     while apt.main_loop() {
         hid.scan_input();
 
-        if hid.keys_down().contains(KeyPad::KEY_START) {
+        if hid.keys_down().contains(KeyPad::START) {
             break;
         }