debug collider rendering
This commit is contained in:
parent
c988944e3d
commit
db28c7403b
@ -74,7 +74,7 @@ use std::{cell::RefCell, sync::mpsc::TryRecvError};
|
||||
|
||||
use discord_sdk::activity::ActivityBuilder;
|
||||
use raylib::prelude::*;
|
||||
use tracing::{error, info};
|
||||
use tracing::{error, info, warn};
|
||||
use utilities::discord::DiscordConfig;
|
||||
|
||||
use crate::{
|
||||
@ -224,6 +224,7 @@ pub async fn game_begin(game_config: &mut GameConfig) -> Result<(), Box<dyn std:
|
||||
.is_key_pressed(KeyboardKey::KEY_F3)
|
||||
{
|
||||
game_config.debug_view = !game_config.debug_view;
|
||||
warn!("Debug view set: {}", game_config.debug_view);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,20 @@ impl WorldSpaceRender for InGameScreen {
|
||||
// self.world_background.render(raylib, Vector2::new(0.0, -1080.0), &self.camera);
|
||||
|
||||
// Render the platform layer
|
||||
raylib.draw_texture_v(&cur_level.platform_tex, Vector2::new(WORLD_LEVEL_X_OFFSET, -cur_level.platform_tex.height as f32), Color::WHITE);
|
||||
raylib.draw_texture_v(
|
||||
&cur_level.platform_tex,
|
||||
Vector2::new(WORLD_LEVEL_X_OFFSET, -cur_level.platform_tex.height as f32),
|
||||
Color::WHITE,
|
||||
);
|
||||
|
||||
if config.debug_view {
|
||||
for collider in &cur_level.colliders {
|
||||
let mut translated_collider = collider.clone();
|
||||
translated_collider.y += -cur_level.platform_tex.height as f32;
|
||||
translated_collider.x += WORLD_LEVEL_X_OFFSET;
|
||||
raylib.draw_rectangle_lines_ex(translated_collider, 5, Color::RED);
|
||||
}
|
||||
}
|
||||
|
||||
// Render the floor as a line
|
||||
let screen_world_zero = raylib.get_screen_to_world2D(Vector2::zero(), self.camera);
|
||||
@ -40,7 +53,6 @@ impl WorldSpaceRender for InGameScreen {
|
||||
config.colors.white,
|
||||
);
|
||||
|
||||
|
||||
// Render the player
|
||||
render_character_in_camera_space(raylib, &self.player, &config);
|
||||
}
|
||||
|
Reference in New Issue
Block a user