Hello, i figured this should be pretty simple, but i can’t seem to get my head around it… I’m making a somewhat simple card-base game.
So, i have this class Gui() that draws a swing gui and also a method UpdateGui(Player p1, Player p2) inside the Gui class that updates the Gui depending on the players’ cards and board position.
There is a button “Draw” and “Discard” that, i hope, should be self-explanatory… The problem is that my Draw and Discard listeners are in the Gui class, although when they are clicked, they should call, say, p1.DrawCard() or p1.Discard(), but my Gui class has no access to the players’ methods.
So, i’m not sure where i messed up in my design, but how should i have done the thing so that the listeners are independent from the Gui? What the best way of doing something like this?