Can't get Torque 2D to work / GuiControlProfile: unable to find specified profile (GuiDefaultProfile) and GuiDefaultProfile does not exist!
by Jeff Moretti · in Torque 2D Beginner · 04/06/2014 (9:24 am) · 0 replies
Hey guys,
Just figured this one out =) Here's the details in case yer getting this one as well.
1) Make sure you have your GuiDefaultProfile defined! Ie make sure you do this step!
First, let's create a GuiDefaultProfile.
In the scripts/gui/ folder, create a new file called guiprofiles.cs.
Type in the following text into guiprofiles.cs :
if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile);
This creates a basic, empty GuiDefaultProfile that will be used whenever we create new GuiControls.
2) NOTE - above it mentions to put the guiprofiles.cs file in scripts/gui folder. Keep note of this for next step!
3) Make sure to do this:
We need to make sure however that myModule loads the file guiprofiles.cs if we want to use GuiDefaultProfile in our program.
In /myModule/main.cs, add the following code in the MyModule::create function
// Load GUI profiles.
exec("./gui/guiProfiles.cs");
NOTE: HOWEVER! There is a little gotcha here. If you did in fact put the script into scripts/gui folder, then this should be named to exec("./scripts/gui/guiProfiles.cs"); . Unless, you put the guiprofiles.cs file /gui. If this is the case, then the above should work.
Hope this helps!
Jeff
[OLD ANSWER - SOMEWHAT INCORRECT]
For all the poor blokes out there who are getting this error message, I've been working away at this too. I don't know if I've solved it yet or not (don't have time to test it just yet), but I at least pinpointed the problem
The problem:
In the Torque 2D Wiki tutorial:
The last line we will look at loads all modules belonging to the group gameBase :
ModuleDatabase.loadGroup("gameBase");
ModuleDatabase.loadGroup allows us to load all modules belonging to the group gameBase.
ModuleDatabase.loadExplicit allows us to load one module specifically.
As we will only create and use one module besides AppCore, we will change this behavior to load a single module.
Change the line above to
ModuleDatabase.loadExplicit("MyModule");
Now, our Appcore module is configured to work with our project.
- If you do that part, and rename that line to ModuleDatabase.loadExplicit("MyModule");, then that causes the error
The solution:
Not entirely sure. Like I mentioned above, I haven't had time to test it. For now, maybe just leave the line as 'ModuleDatabase.loadGroup("gameBase");' and see if things work?? Its my best guess.
[END OLD ANSWER]
Cheers,
Jeff
Just figured this one out =) Here's the details in case yer getting this one as well.
1) Make sure you have your GuiDefaultProfile defined! Ie make sure you do this step!
First, let's create a GuiDefaultProfile.
In the scripts/gui/ folder, create a new file called guiprofiles.cs.
Type in the following text into guiprofiles.cs :
if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile);
This creates a basic, empty GuiDefaultProfile that will be used whenever we create new GuiControls.
2) NOTE - above it mentions to put the guiprofiles.cs file in scripts/gui folder. Keep note of this for next step!
3) Make sure to do this:
We need to make sure however that myModule loads the file guiprofiles.cs if we want to use GuiDefaultProfile in our program.
In /myModule/main.cs, add the following code in the MyModule::create function
// Load GUI profiles.
exec("./gui/guiProfiles.cs");
NOTE: HOWEVER! There is a little gotcha here. If you did in fact put the script into scripts/gui folder, then this should be named to exec("./scripts/gui/guiProfiles.cs"); . Unless, you put the guiprofiles.cs file /gui. If this is the case, then the above should work.
Hope this helps!
Jeff
[OLD ANSWER - SOMEWHAT INCORRECT]
For all the poor blokes out there who are getting this error message, I've been working away at this too. I don't know if I've solved it yet or not (don't have time to test it just yet), but I at least pinpointed the problem
The problem:
In the Torque 2D Wiki tutorial:
The last line we will look at loads all modules belonging to the group gameBase :
ModuleDatabase.loadGroup("gameBase");
ModuleDatabase.loadGroup allows us to load all modules belonging to the group gameBase.
ModuleDatabase.loadExplicit allows us to load one module specifically.
As we will only create and use one module besides AppCore, we will change this behavior to load a single module.
Change the line above to
ModuleDatabase.loadExplicit("MyModule");
Now, our Appcore module is configured to work with our project.
- If you do that part, and rename that line to ModuleDatabase.loadExplicit("MyModule");, then that causes the error
The solution:
Not entirely sure. Like I mentioned above, I haven't had time to test it. For now, maybe just leave the line as 'ModuleDatabase.loadGroup("gameBase");' and see if things work?? Its my best guess.
[END OLD ANSWER]
Cheers,
Jeff
About the author