Game Development Community

Adding a GUI crashes my game, why ?

by Patryk Chabior · in Torque Game Builder · 12/20/2007 (2:41 am) · 5 replies

I wonder if it's time for a windows reinstall or if it is just me doing something wrong somewhere, here's the thing:

If i load a game (that has a gui) into the torque editor the fishgame example or whatever else, build it and run it, it works perfectly fine. If i start a new project add some images to display and run it also works fine, but if i choose to add a gui nomatter how simple for example this onebutton thingie:

//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl() {
canSaveDynamicFields = "0";
isContainer = "1";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = "640 480";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";

new GuiButtonCtrl() {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiButtonProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "365 136";
Extent = "140 30";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
};
};
//--- OBJECT WRITE END ---

Well, then my "game" freezes, and i have to end task it. I just bought TGB yesterday before then i was playing around with the torque demo where i could create gui's without a prob, can the reason be to this weird crashing be: i recently installed ms visual studio 2005 on top of my ms visual studio 2008 because xna isn't supported by 2008, are there perhaps some "debugging" functions i should disable in visual studio wich might block TGB from executing it's tasks ?

Thanks in advance

#1
12/20/2007 (4:48 pm)
Did you exec(cute) the GUI script in, say, the main.cs?
#2
12/20/2007 (9:51 pm)
Sorry for the typos in my first post (been up 3 days in a row, or since i started learning torque lol), yes doublechecked just to make sure and it is beeing exec'd, and actualy if i remove that line or //-it then the game starts fine, btw i just did a spyware/adware check and i figured ou my directx had some nasty stuff, but now got rid of all that and still no gui for my game :(

Here's the console log:

Initializing chunk mappings...
Could not load this GL function: glGenTextures
Could not load this GL function: glBindTexture
Could not load this GL function: glTexImage2D
Could not load this GL function: glTexParameteri
Could not load this GL function: glTexParameteri
Could not load this GL function: glTexParameteri
Could not load this GL function: glTexParameteri
Could not load this GL function: glGenTextures
Could not load this GL function: glBindTexture
Could not load this GL function: glTexImage2D
Could not load this GL function: glTexParameteri
Could not load this GL function: glTexParameteri
Could not load this GL function: glTexParameteri
Could not load this GL function: glTexParameteri

and at the bottom of the log i find this:

game/gameScripts/game.cs (23): Unable to find object: 'sceneWindow2D' attempting to call function 'loadLevel'
DirectInput deactivated.
Activating DirectInput...
DirectInput deactivated.
Activating DirectInput...
DirectInput deactivated.
game/gameScripts/game.cs (32): Unable to find object: 'sceneWindow2D' attempting to call function 'endLevel'
Shutting down the OpenGL display device...
Making the GL rendering context not current...
Deleting the GL rendering context...
Releasing the device context...


So it seems to be a directx error, but that would be weird because i can run all kinds of games including torque and xna/vsc# based games... hmm any tip would be much appriciated, eventualy guess i'll reinstall windows.
#3
12/20/2007 (11:54 pm)
Solved, the problem was not my pc but my knownledge, after reading docs, and doing EXACTLY what the "Your_First_GUI_Tutorial" it works perfect... once again i learned that trying to cut corners while learning basics ain't a good idea ;)
#4
12/21/2007 (1:07 pm)
What were you doing wrong?
#5
12/23/2007 (12:06 am)
Thanks for asking, what i did wrong was to overwrite the "mainScreen.gui" file instead of making a new one, this made it impossible for game.cs to find sceneWindow2D since mainscreen.gui nolonger had anything with that name.