size state changes
This commit is contained in:
parent
0e5b0c4566
commit
68f5306283
|
@ -20,8 +20,6 @@ struct Image {
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
game: Game,
|
game: Game,
|
||||||
width: usize,
|
|
||||||
height: usize,
|
|
||||||
player_position: (u8, u8),
|
player_position: (u8, u8),
|
||||||
player_avatar: Image,
|
player_avatar: Image,
|
||||||
palette: [[u8; 4]; 4],
|
palette: [[u8; 4]; 4],
|
||||||
|
@ -47,13 +45,13 @@ impl State {
|
||||||
screen[
|
screen[
|
||||||
(
|
(
|
||||||
// player vertical offset (number of lines above)
|
// 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 horizontal offset; number of pixels to the left
|
||||||
(player_x as usize * 8)
|
(player_x as usize * 8)
|
||||||
+
|
+
|
||||||
// tile vertical offset; number of lines within tile
|
// 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
|
(tile_x as usize) // tile horizontal offset
|
||||||
)
|
)
|
||||||
|
@ -78,8 +76,6 @@ fn main() -> Result<(), Error> {
|
||||||
|
|
||||||
let mut state = State {
|
let mut state = State {
|
||||||
game,
|
game,
|
||||||
width: 16,
|
|
||||||
height: 9,
|
|
||||||
player_position: (8, 4),
|
player_position: (8, 4),
|
||||||
player_avatar: Image { pixels: [
|
player_avatar: Image { pixels: [
|
||||||
0,0,0,2,2,0,0,0,
|
0,0,0,2,2,0,0,0,
|
||||||
|
@ -297,7 +293,7 @@ fn create_window(
|
||||||
);
|
);
|
||||||
|
|
||||||
window.set_inner_size(default_size);
|
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_outer_position(center);
|
||||||
window.set_visible(true);
|
window.set_visible(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue