mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-07 20:07:46 -06:00
fix: add visibility check to rendering implementation
This commit is contained in:
@@ -48,7 +48,6 @@ pub fn input_system(bindings: Res<Bindings>, mut writer: EventWriter<GameEvent>,
|
|||||||
Event::KeyDown { keycode: Some(key), .. } => {
|
Event::KeyDown { keycode: Some(key), .. } => {
|
||||||
let command = bindings.key_bindings.get(&key).copied();
|
let command = bindings.key_bindings.get(&key).copied();
|
||||||
if let Some(command) = command {
|
if let Some(command) = command {
|
||||||
tracing::info!("triggering command: {:?}", command);
|
|
||||||
writer.write(GameEvent::Command(command));
|
writer.write(GameEvent::Command(command));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ pub fn render_system(
|
|||||||
|
|
||||||
// Render all entities to the backbuffer
|
// Render all entities to the backbuffer
|
||||||
for (_, renderable, position) in renderables.iter() {
|
for (_, renderable, position) in renderables.iter() {
|
||||||
|
if !renderable.visible {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let pos = position.get_pixel_pos(&map.graph);
|
let pos = position.get_pixel_pos(&map.graph);
|
||||||
match pos {
|
match pos {
|
||||||
Ok(pos) => {
|
Ok(pos) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user