mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-12 18:11:34 +11:00
Add correct lifetimes to windows
This commit is contained in:
parent
0eec7e366c
commit
9757f7ed54
|
@ -88,7 +88,7 @@ impl ObjectDistribution {
|
||||||
pub struct WindowDist;
|
pub struct WindowDist;
|
||||||
|
|
||||||
impl WindowDist {
|
impl WindowDist {
|
||||||
pub fn get(&mut self) -> Windows {
|
pub fn get(&mut self) -> Windows<'_> {
|
||||||
Windows::new()
|
Windows::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
//! The window feature of the GBA.
|
//! The window feature of the GBA.
|
||||||
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
use crate::{fixnum::Rect, memory_mapped::MemoryMapped};
|
use crate::{fixnum::Rect, memory_mapped::MemoryMapped};
|
||||||
|
|
||||||
use super::{tiled::BackgroundID, DISPLAY_CONTROL, HEIGHT, WIDTH};
|
use super::{tiled::BackgroundID, DISPLAY_CONTROL, HEIGHT, WIDTH};
|
||||||
|
@ -7,10 +9,11 @@ use super::{tiled::BackgroundID, DISPLAY_CONTROL, HEIGHT, WIDTH};
|
||||||
/// The windows feature of the Game Boy Advance can selectively display
|
/// The windows feature of the Game Boy Advance can selectively display
|
||||||
/// backgrounds or objects on the screen and can selectively enable and disable
|
/// backgrounds or objects on the screen and can selectively enable and disable
|
||||||
/// effects. This gives out references and holds changes before they can be committed.
|
/// effects. This gives out references and holds changes before they can be committed.
|
||||||
pub struct Windows {
|
pub struct Windows<'a> {
|
||||||
wins: [MovableWindow; 2],
|
wins: [MovableWindow; 2],
|
||||||
out: Window,
|
out: Window,
|
||||||
obj: Window,
|
obj: Window,
|
||||||
|
phantom: PhantomData<&'a ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const REG_HORIZONTAL_BASE: *mut u16 = 0x0400_0040 as *mut _;
|
const REG_HORIZONTAL_BASE: *mut u16 = 0x0400_0040 as *mut _;
|
||||||
|
@ -26,12 +29,13 @@ pub enum WinIn {
|
||||||
Win1,
|
Win1,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Windows {
|
impl<'a> Windows<'a> {
|
||||||
pub(crate) fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
let s = Self {
|
let s = Self {
|
||||||
wins: [MovableWindow::new(), MovableWindow::new()],
|
wins: [MovableWindow::new(), MovableWindow::new()],
|
||||||
out: Window::new(),
|
out: Window::new(),
|
||||||
obj: Window::new(),
|
obj: Window::new(),
|
||||||
|
phantom: PhantomData,
|
||||||
};
|
};
|
||||||
s.commit();
|
s.commit();
|
||||||
s
|
s
|
||||||
|
|
Loading…
Reference in a new issue