bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Move player info drawing code into draw_player_info()


From: Nikolas Nyby
Subject: [PATCH] Move player info drawing code into draw_player_info()
Date: Sun, 12 May 2024 23:58:07 -0400

These changes further organize this UI code to be a bit more
modular. Ultimately I want to be able to render the board in the
Board Appearance menu without displaying the game info underneath
it, as the board currently is overlapping with this info in this
view.
---
 gtkboard.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/gtkboard.c b/gtkboard.c
index 48cecf36..45652691 100644
--- a/gtkboard.c
+++ b/gtkboard.c
@@ -3635,19 +3635,11 @@ chequer_key_new(int iPlayer, Board * board)
 }
 
 static void
-draw_game_info(Board *board, BoardData *bd)
+draw_player_info(Board *board, BoardData *bd,
+                 GtkWidget *pw,
+                 GtkWidget *pwFrame,
+                 GtkWidget *pwvbox)
 {
-    GtkWidget *pw;
-    GtkWidget *pwFrame;
-    GtkWidget *pwvbox;
-    
-#if GTK_CHECK_VERSION(3,0,0)
-    bd->table = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
-#else
-    bd->table = gtk_hbox_new(FALSE, 0);
-#endif
-    gtk_box_pack_end(GTK_BOX(board), bd->table, FALSE, TRUE, 0);
-
     /* 
      * player 0 
      */
@@ -3826,7 +3818,23 @@ draw_game_info(Board *board, BoardData *bd)
     /* pip count */
 
     gtk_box_pack_start(GTK_BOX(pw), bd->pipcount1 = gtk_label_new(NULL), 
FALSE, FALSE, 8);
+}
+
+static void
+draw_game_info(Board *board, BoardData *bd)
+{
+    GtkWidget *pw;
+    GtkWidget *pwFrame;
+    GtkWidget *pwvbox;
+
+#if GTK_CHECK_VERSION(3,0,0)
+    bd->table = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+#else
+    bd->table = gtk_hbox_new(FALSE, 0);
+#endif
+    gtk_box_pack_end(GTK_BOX(board), bd->table, FALSE, TRUE, 0);
 
+    draw_player_info(board, bd, pw, pwFrame, pwvbox);
 
     /* 
      * move string, match length, crawford flag, dice
-- 
2.45.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]