Waiting for user input so game logic can continue

Hi all,

I am creating a little battleship game, where at the beginning the player should enter the coordinates of his ships via a display running with LVGL. I am using Arduino as IDE

As each player has lets say 2 ships. So I though I run a for loop to get all the coordinates of the ships. In the loop I am waiting for the user input from the display:


for (int j = 0; j < NUM_SHIPS; ++j) {
Ship& ship = players[1].ships[j]

        while  (startPointX && startPointY == Null){

       // wait for user input
       ship.startX = startPointX
       ship.startY = startPointY


In the event of the text area I am filling the startPointX & startPointY.

But in this way the display does not react, as it is not running in the usual loop() with the lv_task_handler() function.

How can I best wait for a user input in such a case, so that the game logic can continue?

This is how I did it:

while  (startPointX != Null && startPointY != Null){

 ship.startX = startPointX
       ship.startY = startPointY

I have a game simulation program written in two parts; I wrote the actual functionality first, and then the GUI to display sign language alphabet it all. I figured … When my Text Box says "Press 1 to Continue or 2 to exit the game " I then want to wait for the user input to handle it correctly. I can 't use the … As far as I can tell, the Main Loop is still not going to block waiting* for an event. So my node(s) will not get any CPU, but the main loop will …