C++ export with custom properties
Posted: Wed Mar 13, 2013 4:27 pm
Dear developer,
I have been working with R.U.B.E. for the past few days and I found myself to be in a complicated situation.
My problem arises when I export my work into Source Code (C++). First of all, it seems important to especify that exporting in a Json file is not an option for me because the files take too long to upload - specially for scenes over 500 kb. Taking that into account, I am forced to export using the Source Code alternative.
The Problem.
When I export in Source Code, the names of each body in the scenes are not included. As a consequence, I cannot identify the different types of bodies that I may have in my game. For example: I export into Source Code a scene containing a circle. In the scene that circle was called "body1" as default. I changed the name to "wheel1", yet this name (Wheel) does not appear in the Source Code.
Having the problem been stated, I was wondering if there was any kind of solution that may help me to solve this particular problem - remember that exporting the scenes in a Json file is not an option.
Approach towards a solution.
By no means I intend to interfere with the development of your software. That being said, I was thinking about a possible - yet quick and feasible - solution. My idea is to add a property to the body's property structure in order to set the name (which I set while using R.U.B.E) of said body. This property could use exclusively [b2BodyDef.userData]. An example of this property would be:
Thanks for your time. I am looking forward to your reply. I hope there is some sort of solution for my problem, since R.U.B.E. is fantastic and I intend to keep using it.
Greetings!
Nicolás
Boxitsoft - Developer
I have been working with R.U.B.E. for the past few days and I found myself to be in a complicated situation.
My problem arises when I export my work into Source Code (C++). First of all, it seems important to especify that exporting in a Json file is not an option for me because the files take too long to upload - specially for scenes over 500 kb. Taking that into account, I am forced to export using the Source Code alternative.
The Problem.
When I export in Source Code, the names of each body in the scenes are not included. As a consequence, I cannot identify the different types of bodies that I may have in my game. For example: I export into Source Code a scene containing a circle. In the scene that circle was called "body1" as default. I changed the name to "wheel1", yet this name (Wheel) does not appear in the Source Code.
Having the problem been stated, I was wondering if there was any kind of solution that may help me to solve this particular problem - remember that exporting the scenes in a Json file is not an option.
Approach towards a solution.
By no means I intend to interfere with the development of your software. That being said, I was thinking about a possible - yet quick and feasible - solution. My idea is to add a property to the body's property structure in order to set the name (which I set while using R.U.B.E) of said body. This property could use exclusively [b2BodyDef.userData]. An example of this property would be:
Code: Select all
b2BodyDef bd;
[set of default body properties]
bd.userData = string("name"); // "name" being, for instance "Wheel" (see example above)
Greetings!
Nicolás
Boxitsoft - Developer