aboutsummaryrefslogtreecommitdiff
path: root/ctru-rs/src
diff options
context:
space:
mode:
authorFenrir <[email protected]>2018-02-06 23:45:48 -0700
committerFenrirWolf <[email protected]>2018-02-06 23:56:18 -0700
commit224ed678db9912cd55424706d0e39831e010f754 (patch)
tree5bcc079cfda28e7587efcd5d57ccd699baf713a3 /ctru-rs/src
parentUse bitflags 1.0 for button presses (diff)
downloadarchived-ctru-rs-224ed678db9912cd55424706d0e39831e010f754.tar.xz
archived-ctru-rs-224ed678db9912cd55424706d0e39831e010f754.zip
Add wait_for_vblank function
Also change gfx methods to take &self instead of unnecessarily taking &mut self
Diffstat (limited to 'ctru-rs/src')
-rw-r--r--ctru-rs/src/gfx.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/ctru-rs/src/gfx.rs b/ctru-rs/src/gfx.rs
index 68db678..4f55271 100644
--- a/ctru-rs/src/gfx.rs
+++ b/ctru-rs/src/gfx.rs
@@ -60,14 +60,13 @@ impl From<Side> for ::libctru::gfx3dSide_t {
}
impl Gfx {
- pub fn set_3d_enabled(&mut self, enabled: bool) {
+ pub fn set_3d_enabled(&self, enabled: bool) {
unsafe {
::libctru::gfxSet3D(enabled)
}
}
- pub fn get_framebuffer(&mut self, screen: Screen, side: Side) -> (&'static mut [u8], u16, u16) {
- use std::convert::Into;
+ pub fn get_framebuffer(&self, screen: Screen, side: Side) -> (&'static mut [u8], u16, u16) {
unsafe {
use std::slice::from_raw_parts_mut;
@@ -84,34 +83,38 @@ impl Gfx {
}
}
- pub fn flush_buffers(&mut self) {
+ pub fn flush_buffers(&self) {
unsafe { ::libctru::gfxFlushBuffers() };
}
- pub fn swap_buffers(&mut self) {
+ pub fn swap_buffers(&self) {
unsafe { ::libctru::gfxSwapBuffers() };
}
- pub fn swap_buffers_gpu(&mut self) {
+ pub fn swap_buffers_gpu(&self) {
unsafe { ::libctru::gfxSwapBuffersGpu() };
}
pub fn get_framebuffer_format(&self, screen: Screen) -> FramebufferFormat {
- use std::convert::Into;
unsafe { ::libctru::gfxGetScreenFormat(screen.into()).into() }
}
- pub fn set_framebuffer_format(&mut self, screen: Screen,
+ pub fn set_framebuffer_format(&self, screen: Screen,
fmt: FramebufferFormat) {
- use std::convert::Into;
unsafe { ::libctru::gfxSetScreenFormat(screen.into(), fmt.into()) }
}
- pub fn set_double_buffering(&mut self, screen: Screen, enabled: bool) {
+ pub fn set_double_buffering(&self, screen: Screen, enabled: bool) {
unsafe {
::libctru::gfxSetDoubleBuffering(screen.into(), enabled)
}
}
+
+ pub fn wait_for_vblank(&self) {
+ unsafe {
+ ::libctru::gspWaitForEvent(::libctru::GSPGPU_EVENT_VBlank0, true)
+ }
+ }
}
impl Default for Gfx {