Closed jonathanabennett closed 1 year ago
Simply using (gtk:application-get-window-by-id gtk:*application* 1)
should work. Alternatively, you can use (mapcar (alexandria:rcurry #'gobj:pointer-object 'gtk:window) (glib:glist-list (gtk:application-windows gtk:*application*)))
to retrieve all windows and then filter them.
What's the best way to get the current root window? Should I be storing it in a global variable or is there already a global variable that has it?
In the game I am building, there are different phases of play, each phase of play needs to modify the contents of the window. I'm just now getting to the point where I need to find the best way to manage the transitions between phases and I'm running into a conceptual problem figuring out the best way to handle passing the window around to change it.
So for example, I have created a
*game*
global variable which has a CLOS class containing all the relevant global variables for the game's state (current turn, current phase, list of units, initiative order, etc). Then I write aadvance-phase
function that calls(incf (game/current-phase *game*))
which dispatches to a set of functions that I have written to build the display for each screen, likedraw-initiative-phase
,draw-deployment-phase
. Each of those functions creates agtk:container
such as(let ((layout (gtk:make-grid))) ...)
ormake-box
. How do I then get that container passed to my main window?