Drawing a Box
This commit is contained in:
parent
1cd46b32d1
commit
166e83ad06
3
game/dist/project-constants.json
vendored
3
game/dist/project-constants.json
vendored
@ -5,6 +5,7 @@
|
|||||||
720
|
720
|
||||||
],
|
],
|
||||||
"target_fps": 60,
|
"target_fps": 60,
|
||||||
|
"tile_size": 128,
|
||||||
"discord": {
|
"discord": {
|
||||||
"app_id": 954413081918857276,
|
"app_id": 954413081918857276,
|
||||||
"artwork": {
|
"artwork": {
|
||||||
@ -16,4 +17,4 @@
|
|||||||
"details.main_menu": "In the main menu"
|
"details.main_menu": "In the main menu"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ use nalgebra as na;
|
|||||||
pub struct Player {
|
pub struct Player {
|
||||||
pub position: na::Vector2<f32>,
|
pub position: na::Vector2<f32>,
|
||||||
pub velocity: na::Vector2<f32>,
|
pub velocity: na::Vector2<f32>,
|
||||||
|
pub size: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Player {
|
impl Player {
|
||||||
@ -14,7 +15,8 @@ impl Player {
|
|||||||
Self {
|
Self {
|
||||||
position,
|
position,
|
||||||
velocity: na::Vector2::zeros(),
|
velocity: na::Vector2::zeros(),
|
||||||
|
size: 1.0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,4 +42,7 @@ pub struct ProjectConstants {
|
|||||||
|
|
||||||
/// The target framerate of the game
|
/// The target framerate of the game
|
||||||
pub target_fps: u32,
|
pub target_fps: u32,
|
||||||
|
|
||||||
|
/// The size of the game tiles
|
||||||
|
pub tile_size: u8,
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,17 @@ impl PlayableScene {
|
|||||||
// Clear the screen
|
// Clear the screen
|
||||||
draw.clear_background(Color::WHITE);
|
draw.clear_background(Color::WHITE);
|
||||||
|
|
||||||
|
draw.draw_rectangle_lines(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
(constants.tile_size as f32 * self.player.size) as i32,
|
||||||
|
(constants.tile_size as f32 * self.player.size) as i32,
|
||||||
|
Color::GREEN
|
||||||
|
);
|
||||||
|
|
||||||
// TODO: Render stuff
|
// TODO: Render stuff
|
||||||
// self.player. <whatever>
|
// self.player. <whatever>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user