GuiRadarCtrl TGEA
by Chris Byars · 04/02/2006 (10:28 am) · 11 comments
Download Code File
After painstaking and mind-numbing efforts, I was able to convert the GuiRadarCtrl resource from oh so long ago by Matt Webster to be fully functional in the Torque Game Engine Advanced, tested in versions MS3-1.03.
Put both of these files in engine/gui/game/, add them to your project, and compile it. Follow the same instructions as the old GuiRadarCtrl resource.
Note: The images default to:
fps/client/ui/radar_base
fps/client/ui/radarDot
fps/client/ui/radarUp
fps/client/ui/radarDown
If you want to change the filepaths, simply edit the GuiRadarCtrl.cpp file where they are hardcoded.
Enjoy.
After painstaking and mind-numbing efforts, I was able to convert the GuiRadarCtrl resource from oh so long ago by Matt Webster to be fully functional in the Torque Game Engine Advanced, tested in versions MS3-1.03.
Put both of these files in engine/gui/game/, add them to your project, and compile it. Follow the same instructions as the old GuiRadarCtrl resource.
Note: The images default to:
fps/client/ui/radar_base
fps/client/ui/radarDot
fps/client/ui/radarUp
fps/client/ui/radarDown
If you want to change the filepaths, simply edit the GuiRadarCtrl.cpp file where they are hardcoded.
Enjoy.
#2
(I did change the getServerConnection to getConnectionToServer, so it compiles, however TSE crashes once you double click to load TSE.exe.)
04/18/2006 (7:25 pm)
For some reason this doesn't work with MS3+, any idea why?(I did change the getServerConnection to getConnectionToServer, so it compiles, however TSE crashes once you double click to load TSE.exe.)
#3
If you figure out a fix, please let me know.
04/20/2006 (6:16 am)
Hey C2. I'm having the same problem with my radar as of MS3. If I don't include it in the project then everythign works fine, but I get errors when I launch my game and load the GUI. If I include it in my project and change the getServerConnection to getConnectionToServer then it compiles fine but crashes immediately on loading.If you figure out a fix, please let me know.
#4
If you had been, you would have seen the following error message:
"Attempting to get invalid GFX device."
being called from engine\gfx\gfxdecice.cpp
the error message is called on line 29 of that file.
With a little debugging I found that the error is called from guiRadarCtrl.cpp line 32... I had the path to the image wrong, which doesnt seem to be the issue.
The problem is that this line in gfxDecive:
AssertFatal( smActiveDeviceIndex > -1 && smGFXDevice[smActiveDeviceIndex] != NULL, "Attempting to get invalid GFX device." );
fails because smActiveDeviceIndex is -1.
I dont know much of anything about the TSE gfx layer.... but hopefully this info will help someone else solve the issue.
04/21/2006 (10:32 am)
You guys arent running debug releases, are you?If you had been, you would have seen the following error message:
"Attempting to get invalid GFX device."
being called from engine\gfx\gfxdecice.cpp
the error message is called on line 29 of that file.
With a little debugging I found that the error is called from guiRadarCtrl.cpp line 32... I had the path to the image wrong, which doesnt seem to be the issue.
The problem is that this line in gfxDecive:
AssertFatal( smActiveDeviceIndex > -1 && smGFXDevice[smActiveDeviceIndex] != NULL, "Attempting to get invalid GFX device." );
fails because smActiveDeviceIndex is -1.
I dont know much of anything about the TSE gfx layer.... but hopefully this info will help someone else solve the issue.
#5
When the radar is not in, the constructor gets called:
GFXDevice::GFXDevice()
then
GFXDevice *GFXDevice::get()
is called which is good.
Get gets called before the constructor when the radar is in, because the radar constructor calls it when it allocates textures. That is bad. Youre getting a device that doesnt exist, causing an error.
So either the radar constructor is being called earlier then its suppsoed to (I cant figure out where its called from) or it shouldnt be allocating textures in the constructor.
04/21/2006 (10:55 am)
I ran it with the radar in and without.When the radar is not in, the constructor gets called:
GFXDevice::GFXDevice()
then
GFXDevice *GFXDevice::get()
is called which is good.
Get gets called before the constructor when the radar is in, because the radar constructor calls it when it allocates textures. That is bad. Youre getting a device that doesnt exist, causing an error.
So either the radar constructor is being called earlier then its suppsoed to (I cant figure out where its called from) or it shouldnt be allocating textures in the constructor.
#6
but I dont have a way to test it.
At least it doesnt crash or anything.
Add this to the public section of guiRadarCtrl.h
add this to the cpp
Comment out these 4 lines in the constructor:
Now it should load the textures after the gfx device is created, which solves the problems.
Make sure you got your directory right ;)
04/21/2006 (12:04 pm)
Ok. here's what I did. It looks like it's working.but I dont have a way to test it.
At least it doesnt crash or anything.
Add this to the public section of guiRadarCtrl.h
Quote:
bool onAdd();
add this to the cpp
Quote:
bool GuiRadarCtrl::onAdd()
{
if (!Parent::onAdd())
return false;
mTextureObject = GFXTexHandle("fps/client/ui/radar_base", &GFXDefaultGUIProfile);
mRadarDot = GFXTexHandle("fps/client/ui/radarDot", &GFXDefaultGUIProfile);
mRadarUp = GFXTexHandle("fps/client/ui/radarUp", &GFXDefaultGUIProfile);
mRadarDown = GFXTexHandle("fps/client/ui/radarDown", &GFXDefaultGUIProfile);
return true;
}
Comment out these 4 lines in the constructor:
Quote:
mTextureObject = GFXTexHandle("fps/client/ui/radar_base", &GFXDefaultGUIProfile);
mRadarDot = GFXTexHandle("fps/client/ui/radarDot", &GFXDefaultGUIProfile);
mRadarUp = GFXTexHandle("fps/client/ui/radarUp", &GFXDefaultGUIProfile);
mRadarDown = GFXTexHandle("fps/client/ui/radarDown", &GFXDefaultGUIProfile);
Now it should load the textures after the gfx device is created, which solves the problems.
Make sure you got your directory right ;)
#7
Enjoy
-Chris Labombard
EDIT: Anyone want to get the guiCompassCtrl working ?
EDIT2: Nevermind, I got the base iamge to rotate with the player instead. Now, the radar_base acts as the compass.
04/21/2006 (12:48 pm)
I tested this in multiplayer. My changes above work perfectly. Enjoy
-Chris Labombard
EDIT: Anyone want to get the guiCompassCtrl working ?
EDIT2: Nevermind, I got the base iamge to rotate with the player instead. Now, the radar_base acts as the compass.
#8
11/11/2006 (12:03 am)
Do you know if this resource will work with TGE 1.5?
#9
11/14/2006 (1:33 pm)
This one won't; it's changed to work with TSE's rendering code. The radar for TGE should still work, just need to change a few include lines of code, I think.
#10
-Andy
01/20/2007 (5:53 pm)
Just curious. Was anyone able to get the Compass to work for TSE? I see that a few people did, but there was no resource provided.-Andy
#11
can you post your code for the radar_base acts as the compass?
thx :)
06/02/2007 (6:19 am)
Hi brainiac, can you post your code for the radar_base acts as the compass?
thx :)

Torque Owner Thomas \"Man of Ice\" Lund
Do something along the lines of:
Cant remember if that was part of the original ressource or a modification I did to it later