-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add priority set / get and set_visible / is_visible to maps #563
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks for the PR. I've left a few comments mainly around the doc comments :)
I don't see any harm in these, so if you need them for your game I see no issue in adding them. Maybe in the next version I'll change show()
and hide()
to be set_visible(bool)
just for consistency
agb/src/display/tiled/map.rs
Outdated
fn show(&mut self); | ||
fn hide(&mut self); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this now asks if this should be set_visible()
but we can leave that for later :)
@@ -399,6 +399,23 @@ impl<'a> InfiniteScrolledMap<'a> { | |||
self.map.hide(); | |||
} | |||
|
|||
/// Checks whether the map is not marked as hidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you link to show
and hide
in the docs for this? Just so if someone searches visible
it'll take them to the methods which can change the state here :)
agb/src/display/tiled/map.rs
Outdated
// Gets the map priority | ||
#[must_use] | ||
pub fn priority(&self) -> Priority { | ||
self.priority | ||
} | ||
|
||
/// Sets the map priority | ||
pub fn set_priority(&mut self, priority: Priority) { | ||
self.priority = priority; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the doc comments for these (and the same for InfiniteScrolledMap) it should mention how the priority won't change until you call commit()
? But that priority()
will return the most recently set value?
Just because hide()
and show()
happen immediately :)
Also could you link between the priority()
and set_priority()
methods in the doc comments so you can go between them easily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's definitely worth mentioning!
I agree that |
7e21a26
to
2a7567c
Compare
2a7567c
to
da84131
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Just one comment which I'll do now before merging :)
@@ -85,12 +85,12 @@ pub fn show_title_screen(background: &mut RegularMap, vram: &mut VRamManager, sf | |||
background.set_scroll_pos((0i16, 0).into()); | |||
vram.set_background_palettes(backgrounds::PALETTES); | |||
|
|||
background.hide(); | |||
background.set_visible(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be set_visible(false)
Adds
.priority()
,.set_priority()
and.is_visible()
and replaceshow
andhide
with.set_visible()
inRegularMap
,AffineMap
andInfiniteScrolledMap
.