format
This commit is contained in:
parent
324d16cfc2
commit
0b2a3991ed
6 changed files with 29 additions and 29 deletions
|
@ -39,7 +39,6 @@ async fn main() {
|
||||||
// set_window_min_size(640, 480);
|
// set_window_min_size(640, 480);
|
||||||
set_mouse_cursor(miniquad::CursorIcon::Crosshair);
|
set_mouse_cursor(miniquad::CursorIcon::Crosshair);
|
||||||
|
|
||||||
|
|
||||||
let mut game = Game::new().await;
|
let mut game = Game::new().await;
|
||||||
game.run().await
|
game.run().await
|
||||||
}
|
}
|
||||||
|
@ -223,7 +222,13 @@ impl Game {
|
||||||
.get(self.selected_level.0)
|
.get(self.selected_level.0)
|
||||||
.and_then(|c| c.levels.get(self.selected_level.1))
|
.and_then(|c| c.levels.get(self.selected_level.1))
|
||||||
{
|
{
|
||||||
draw_text(level.name(), level_list_width + 10., 10., 40., colors::SKYBLUE);
|
draw_text(
|
||||||
|
level.name(),
|
||||||
|
level_list_width + 10.,
|
||||||
|
10.,
|
||||||
|
40.,
|
||||||
|
colors::SKYBLUE,
|
||||||
|
);
|
||||||
draw_text(level.id(), level_list_width + 10., 50., 10., colors::GRAY);
|
draw_text(level.id(), level_list_width + 10., 50., 10., colors::GRAY);
|
||||||
|
|
||||||
let mut y = 70.;
|
let mut y = 70.;
|
||||||
|
|
|
@ -285,13 +285,7 @@ impl Grid {
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw(
|
pub fn draw(&self, textures: &Textures, offset: Vec2, scale: f32, power_directions: bool) {
|
||||||
&self,
|
|
||||||
textures: &Textures,
|
|
||||||
offset: Vec2,
|
|
||||||
scale: f32,
|
|
||||||
power_directions: bool,
|
|
||||||
) {
|
|
||||||
let tile_size = (TILE_TEXTURE_SIZE * scale) as i32;
|
let tile_size = (TILE_TEXTURE_SIZE * scale) as i32;
|
||||||
|
|
||||||
let start_x = (-offset.x as i32) / tile_size - 1;
|
let start_x = (-offset.x as i32) / tile_size - 1;
|
||||||
|
@ -321,7 +315,13 @@ impl Grid {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
draw_rectangle(px, py, tile_size as _, tile_size as _, Color::from_rgba(0, 0, 0, 80));
|
draw_rectangle(
|
||||||
|
px,
|
||||||
|
py,
|
||||||
|
tile_size as _,
|
||||||
|
tile_size as _,
|
||||||
|
Color::from_rgba(0, 0, 0, 80),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,7 @@ pub fn userdata_dir() -> PathBuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_rectangle_rec(bounds: Rect, color: Color) {
|
pub fn draw_rectangle_rec(bounds: Rect, color: Color) {
|
||||||
draw_rectangle(
|
draw_rectangle(bounds.x, bounds.y, bounds.w, bounds.h, color);
|
||||||
bounds.x,
|
|
||||||
bounds.y,
|
|
||||||
bounds.w,
|
|
||||||
bounds.h,color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_scaled_texture_c(texture: &Texture2D, x: f32, y: f32, scale: f32, color: Color) {
|
pub fn draw_scaled_texture_c(texture: &Texture2D, x: f32, y: f32, scale: f32, color: Color) {
|
||||||
|
@ -47,7 +43,6 @@ pub fn draw_scaled_texture_c(texture: &Texture2D, x: f32, y: f32, scale: f32, co
|
||||||
draw_texture_ex(texture, x, y, color, params);
|
draw_texture_ex(texture, x, y, color, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn draw_scaled_texture(texture: &Texture2D, x: f32, y: f32, scale: f32) {
|
pub fn draw_scaled_texture(texture: &Texture2D, x: f32, y: f32, scale: f32) {
|
||||||
let params = DrawTextureParams {
|
let params = DrawTextureParams {
|
||||||
dest_size: Some(Vec2::new(texture.width() * scale, texture.height() * scale)),
|
dest_size: Some(Vec2::new(texture.width() * scale, texture.height() * scale)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue