Browse Source

Merge branch 'master' of git.indy.io:indy/tetris

Inderjit Gill 1 year ago
parent
commit
42268beba1
3 changed files with 15 additions and 13 deletions
  1. 6
    4
      src/game.rs
  2. 5
    5
      src/lib.rs
  3. 4
    4
      web/js/index.js

+ 6
- 4
src/game.rs View File

@@ -259,17 +259,19 @@ impl Game {
259 259
         geometry.push(0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0);
260 260
         render_board(geometry, &self.board, &self.board_offset);
261 261
 
262
+        let x = 21;
263
+        let y = 16;
262 264
         if let Ok(c) = get_colour_from_hsl(0.0,
263 265
                                            self.colour_saturation,
264 266
                                            self.colour_lightness) {
265
-            render_score(geometry, self.score, Block2D { x: 19, y: 24 }, c);
266
-            render_level(geometry, self.level, Block2D { x: 19, y: 20 }, c);
267
-            render_lines(geometry, self.lines, Block2D { x: 19, y: 16 }, c);
267
+            render_score(geometry, self.score, Block2D { x, y: y + 8 }, c);
268
+            render_level(geometry, self.level, Block2D { x, y: y + 4 }, c);
269
+            render_lines(geometry, self.lines, Block2D { x, y }, c);
268 270
         }
269 271
         if let Some(shape) = self.shapes.get(&self.next_piece_shape) {
270 272
             render_next_shape(geometry,
271 273
                               &shape,
272
-                              Block2D { x: 19, y: 10 },
274
+                              Block2D { x, y: y - 6 },
273 275
                               self.next_piece_colour);
274 276
         }
275 277
     }

+ 5
- 5
src/lib.rs View File

@@ -83,17 +83,17 @@ impl Config {
83 83
     #[wasm_bindgen(constructor)]
84 84
     pub fn new() -> Config {
85 85
         Config {
86
-            canvas_width: 480,
87
-            canvas_height: 480,
88
-            block_size: 30,
86
+            canvas_width: 512,
87
+            canvas_height: 512,
88
+            block_size: 32,
89 89
             tileset_texture_width: 0,  // tileset texture width
90 90
             tileset_texture_height: 0, // tileset texture height
91 91
             sprite_width: 16,
92 92
             sprite_height: 16,
93 93
             colour_saturation: 99.0,
94 94
             colour_lightness: 50.0,
95
-            board_offset_x: 5,
96
-            board_offset_y: 5,
95
+            board_offset_x: 7,
96
+            board_offset_y: 6,
97 97
             default_cooldown: 100.0,
98 98
             board_width: 10,
99 99
             board_height: 20,

+ 4
- 4
web/js/index.js View File

@@ -57,10 +57,10 @@ window.reconfigure = reconfigure;
57 57
 window.config = gState.config;
58 58
 
59 59
 function main() {
60
-  gState.config.canvas_width = 480;
61
-  gState.config.canvas_height = 480;
62
-  gState.config.block_size = 30; // how many blocks fit along a dimension
63
-  // 480 / 30 = 16 (the size of each block in pixels)
60
+  gState.config.canvas_width = 512;
61
+  gState.config.canvas_height = 512;
62
+  gState.config.block_size = 32; // how many blocks fit along a dimension
63
+  // 512 / 32 = 16 (the size of each block in pixels)
64 64
 
65 65
   // the size of each sprite in the tileset (in pixels)
66 66
   gState.config.sprite_width = 16;

Loading…
Cancel
Save