[gnome-2048/arnaudb/wip/gtk4: 17/36] Uncomment more stuff.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048/arnaudb/wip/gtk4: 17/36] Uncomment more stuff.
- Date: Tue, 14 Jul 2020 10:59:49 +0000 (UTC)
commit db2c18e8b049bfbc99fe678c5965a71f9f6bade1
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Tue Apr 28 09:02:04 2020 +0200
Uncomment more stuff.
src/game-window.vala | 13 +++++++++++++
src/game.vala | 8 ++++----
2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/game-window.vala b/src/game-window.vala
index 621fbe7..1f9261c 100644
--- a/src/game-window.vala
+++ b/src/game-window.vala
@@ -23,6 +23,19 @@ using Gtk;
private class Board : Widget
{
+ internal int width { internal get; private set; }
+ internal int height { internal get; private set; }
+
+ construct
+ {
+ size_allocate.connect (on_size_allocate);
+ }
+
+ private static inline void on_size_allocate (Widget widget, int _width, int _height, int _baseline)
+ {
+ ((Board) widget).width = _width;
+ ((Board) widget).height = _height;
+ }
}
[GtkTemplate (ui = "/org/gnome/TwentyFortyEight/ui/game-window.ui")]
diff --git a/src/game.vala b/src/game.vala
index 382e505..2f161d9 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -226,8 +226,8 @@ private class Game : Object
_foreground_cur = new TileView? [rows, cols];
_foreground_nxt = new TileView? [rows, cols];
-// float canvas_width = _view.width;
-// float canvas_height = _view.height;
+ float canvas_width = (float) _view.width;
+ float canvas_height = (float) _view.height;
canvas_width -= (cols + 1) * BLANK_COL_WIDTH;
canvas_height -= (rows + 1) * BLANK_ROW_HEIGHT;
@@ -260,8 +260,8 @@ private class Game : Object
{
uint8 rows = _grid.rows;
uint8 cols = _grid.cols;
-// float canvas_width = _view.width;
-// float canvas_height = _view.height;
+ float canvas_width = (float) _view.width;
+ float canvas_height = (float) _view.height;
canvas_width -= (cols + 1) * BLANK_COL_WIDTH;
canvas_height -= (rows + 1) * BLANK_ROW_HEIGHT;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]