I am building a two-player(CPU-User) Poker application with C++ and OpenGL. Currently the application just renders the graphics, keeps track of which button is pressed, value entered in textbox something like below.

    cards.draw();//draws cards based on the Mesh index, hard-coded atm

I have separately written the game logic which handles hand ranking, turn-by-turn play , settlement of the pot etc., but I am unsure as to how to combine this with the rendering logic.

The game logic should be on hold until the user clicks on a button or enters a value through the textbox. Every time there is change in cards distributed to the players, it should be updated on the rendering side. When there is animation going on the rendering side,the game logic should not proceed until the animation is over.

How should this communication happen between the rendering and handling of the game logic?

  • 2
    \$\begingroup\$ Wouldnt a statemachine help you? \$\endgroup\$
    – Zibelas
    Commented Aug 26, 2023 at 7:24
  • \$\begingroup\$ @Zibelas Thank you for your advice, worked out very well! \$\endgroup\$ Commented Sep 2, 2023 at 5:52
  • \$\begingroup\$ feel free to post part of your code as an answer to complete the queation \$\endgroup\$
    – Zibelas
    Commented Sep 2, 2023 at 6:02


You must log in to answer this question.

Browse other questions tagged .