I'm having a little trouble with the debugger. On the whole it works very well, better than many other languages I've seen. However I can't see the variables I create from TYPES. Am I doing something wrong?:
SETSCREEN 320,240,0
LIMITFPS 60
TYPE Fred
a$
ENDTYPE
GLOBAL per AS Fred
per.a$="Mr Bloggs"
WHILE TRUE
DEBUG per.a$
SHOWSCREEN
WEND
I put a breakpoint on the DEBUG statement (F9) and run. My debug panel has Variables, but nothing listed under Global and Locals. Why isn't per shown (was expecting a tree to expand showing a$ underneath. I've tried declaring per with LOCAL and GLOBAL but no luck. TYPE's are a really useful data structure that I imagine everyone would want to be able to view in the Debug variables panel.
Also the game window disappears when paused. It will pop up momentarily when SHOWSCREEN executes but disappears again. I'd like to be able to look at the output in this window. How do I do that?
Thanks.
EDIT: should add that I can see straight integer, string and arrays in the Variables Debug panel, just not TYPES.
Nopers. Type variables are not in, yet.
For debug output, use the DEBUG command, which prints to the console window of the IDE.
Do you think it might be something you can add in a future version? I hope it's not too hard to do as it's a bit cumbersome debuging TYPE structures with the DEBUG statement as I did in the example code above. I'd probably make a debug function to dump the contents but still a pain.
Also what about the Game Window disappearing? Is that normal behaviour that the game window is hidden when you are paused in the debugger? If so, could you add a button / key to temporarily show it? When I experient with graphics, I'd like to be able to see what is currently on the Game Window since the last SHOWSCREEN. Better still it would be useful for debugging to be able to press another button/key to see the backbuffer.
keywait?
Thanks Gernot - will that display the screen while waiting for a keypress when viewed through the debugger? That could be a suitable work around after the SHOWSCREEN in the debugger - I'll give it a try when I get home :)
It doesn't seem to work for me. Breakpoint on the Debug line, run, the line is shown in the editor and I press F10. SHOWSCREEN flashes the Game Window up but it gets hidden immediately. F10 on to the KEYWAIT and still there is no screen shown. I have to press a key and it comes back to the editor in debug mode. If I take the breakpoint out and run without debugging, then the window is shown and it waits but I'm not debugging then!
SETSCREEN 320,240,0
LIMITFPS 60
TYPE Fred
a$
ENDTYPE
GLOBAL per AS Fred
per.a$="Mr Bloggs"
WHILE TRUE
DEBUG per.a$
SHOWSCREEN
KEYWAIT
WEND
Can you add a method to get the window un-hidden while in the debugger so as you are pressing F10 you can take a look what's on the Front buffer and ideally what the state of the back buffer looks like (this would be a big help) - eg: a shortcut key and toolbar button/menu to temporarily show these buffers would be cool.
No, keywait without debugging. Just showscreen and insert a keywait with a condition (If KEY(xy) KEYWAIT) e.g. Then you have to press a key, when you hold the xy key down. (Must release it first, of course)
So the idea is you would run as normal (no breakpoints), detect your keypress to activate the keywait, take a look at the screen, then pause the debugger (if the keywait allows?) where the game window will disappear and take a look at variable states?
It's a work around of sorts, but not really as useful as it is needed to be.
Do you think it will be possible to improve this in future?
You're right. I'd better make the window go to the background of the IDE. It might be a bit complicated, since most OpenGL drivers do not update the area if you're not redrawing it.
Grab the rendering context as a screenshot bitmap as the debugger enters?
Gernot, did you ever come up with a solution for making the output window visible during debug mode? (ie. without having to put the keywait code in?) Where I've had issues in the past (with other languages) and you have a glitch that lasts for 1 /60th of a second, it would be almost impossible to catch with this method.
Cheers!