replace raylibs grid rendering and decrease grid contrast
This commit is contained in:
parent
f2c7764143
commit
1061ae6ce0
2 changed files with 14 additions and 14 deletions
|
@ -444,23 +444,20 @@ impl Editor {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw(&mut self, d: &mut RaylibDrawHandle, textures: &Textures) {
|
pub fn draw(&mut self, d: &mut RaylibDrawHandle, textures: &Textures) {
|
||||||
d.clear_background(gray(48));
|
d.clear_background(BG_WORLD);
|
||||||
|
|
||||||
if self.draw_overlay && self.zoom >= 1. {
|
if self.draw_overlay && self.zoom >= 0.5 {
|
||||||
let tile_size = (TILE_TEXTURE_SIZE * self.zoom) as f32;
|
let tile_size = TILE_TEXTURE_SIZE * self.zoom;
|
||||||
let grid_spill_x = (self.view_offset.x).rem(tile_size) - tile_size;
|
let grid_spill_x = (self.view_offset.x).rem(tile_size) - tile_size;
|
||||||
let grid_spill_y = (self.view_offset.y).rem(tile_size) - tile_size;
|
let grid_spill_y = (self.view_offset.y).rem(tile_size) - tile_size;
|
||||||
d.gui_grid(
|
for y in 0..=(d.get_screen_height() / tile_size as i32) {
|
||||||
Rectangle::new(
|
let y = y * tile_size as i32 + grid_spill_y as i32;
|
||||||
grid_spill_x,
|
d.draw_line(0, y, d.get_screen_width(), y, FG_GRID);
|
||||||
grid_spill_y,
|
}
|
||||||
d.get_screen_width() as f32 * 2.,
|
for x in 0..=(d.get_screen_width() / tile_size as i32) {
|
||||||
d.get_screen_height() as f32 * 2.,
|
let x = x * tile_size as i32 + grid_spill_x as i32;
|
||||||
),
|
d.draw_line(x, 0, x, d.get_screen_height(), FG_GRID);
|
||||||
None,
|
}
|
||||||
tile_size,
|
|
||||||
1,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.draw_board(d, textures);
|
self.draw_board(d, textures);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
use raylib::prelude::*;
|
use raylib::prelude::*;
|
||||||
|
|
||||||
|
pub const BG_WORLD: Color = gray(48);
|
||||||
|
pub const FG_GRID: Color = gray(64);
|
||||||
|
|
||||||
pub const BG_DARK: Color = gray(32);
|
pub const BG_DARK: Color = gray(32);
|
||||||
pub const BG_MEDIUM: Color = gray(48);
|
pub const BG_MEDIUM: Color = gray(48);
|
||||||
pub const BG_LIGHT: Color = gray(64);
|
pub const BG_LIGHT: Color = gray(64);
|
||||||
|
|
Loading…
Reference in a new issue