Computer Science Canada

GUI.CreateButtonFull text on button disappears.

Author:  Kyle Biro [ Sun Nov 24, 2013 8:19 am ]
Post subject:  GUI.CreateButtonFull text on button disappears.

What is the problem you are having?
When I run my game, the first thing that shows up is one button that says "Start Game [S]" and it doesn't actually show up in the button unless I alt+tab out of the game and go back into the game.


Describe what you have tried to solve this problem
GUI.Refresh, but nothing changed


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
This is the code that handles with the menu (the button that shows up at the start).

Turing:


proc menu
    var startGameButton : int
    startGameButton := GUI.CreateButtonFull (maxx div 2 - 100, maxy div 2, 200, "START GAME  [S]",
        GUI.Quit, 50, 's', true)

    loop
        exit when GUI.ProcessEvent
    end loop

    cls
end menu



Please specify what version of Turing you are using
Turing 4.1

Author:  Dreadnought [ Sun Nov 24, 2013 2:46 pm ]
Post subject:  Re: GUI.CreateButtonFull text on button disappears.

Seems to work fine for me...

Are you using "offscreenonly" by any chance?

Author:  Kyle Biro [ Sun Nov 24, 2013 8:26 pm ]
Post subject:  RE:GUI.CreateButtonFull text on button disappears.

Ah, yes, I do have an "offscreenonly" in a different file. Is that what causes the problem?

Author:  Dreadnought [ Sun Nov 24, 2013 9:38 pm ]
Post subject:  Re: GUI.CreateButtonFull text on button disappears.

Well if your in "offscreenonly" mode, the window won't get updated until you call View.Update (however, alt-tabbing will force an update I think).

Author:  Tony [ Sun Nov 24, 2013 9:41 pm ]
Post subject:  RE:GUI.CreateButtonFull text on button disappears.

code:

loop
        exit when GUI.ProcessEvent
    end loop

your main loop processes button clicks, but doesn't actually draw anything to the screen, which is typically accomplished with View.Update for the offscreenonly mode (which buffers graphics until the frame is ready).

Author:  Kyle Biro [ Mon Nov 25, 2013 5:43 am ]
Post subject:  RE:GUI.CreateButtonFull text on button disappears.

Does it matter where the View.Update goes in the code? I put it just above the loop and it seems to work fine.

Nevertheless, thank you everybody.


: