size state changes
This commit is contained in:
parent
0e5b0c4566
commit
68f5306283
|
@ -20,8 +20,6 @@ struct Image {
|
|||
|
||||
struct State {
|
||||
game: Game,
|
||||
width: usize,
|
||||
height: usize,
|
||||
player_position: (u8, u8),
|
||||
player_avatar: Image,
|
||||
palette: [[u8; 4]; 4],
|
||||
|
@ -47,13 +45,13 @@ impl State {
|
|||
screen[
|
||||
(
|
||||
// player vertical offset (number of lines above)
|
||||
(player_y as usize * 8 * (8 * self.width as usize))
|
||||
(player_y as usize * 8 * (8 * self.game.config.width as usize))
|
||||
+
|
||||
// player horizontal offset; number of pixels to the left
|
||||
(player_x as usize * 8)
|
||||
+
|
||||
// tile vertical offset; number of lines within tile
|
||||
(tile_y as usize * (8 * self.width as usize))
|
||||
(tile_y as usize * (8 * self.game.config.width as usize))
|
||||
+
|
||||
(tile_x as usize) // tile horizontal offset
|
||||
)
|
||||
|
@ -78,8 +76,6 @@ fn main() -> Result<(), Error> {
|
|||
|
||||
let mut state = State {
|
||||
game,
|
||||
width: 16,
|
||||
height: 9,
|
||||
player_position: (8, 4),
|
||||
player_avatar: Image { pixels: [
|
||||
0,0,0,2,2,0,0,0,
|
||||
|
@ -292,12 +288,12 @@ fn create_window(
|
|||
LogicalSize::new(width * scale, height * scale);
|
||||
|
||||
let center = LogicalPosition::new(
|
||||
(monitor_width - width * scale) / 2.0,
|
||||
(monitor_width - width * scale) / 2.0,
|
||||
(monitor_height - height * scale) / 2.0,
|
||||
);
|
||||
|
||||
window.set_inner_size(default_size);
|
||||
window.set_min_inner_size(Some(min_size));
|
||||
// window.set_min_inner_size(Some(min_size));
|
||||
window.set_outer_position(center);
|
||||
window.set_visible(true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue