After not a such long study of the engine I was quite favorably impressed by it.
Although there has been some disappointment. Unfortunately, it is lacking possibility to create objects not from the ini files, but in the code. It is not possible to draw triangles. The majority of third-party GUI libraries and PARTITSLES require such a possibility. This also prevents you from creating such objects as DistortionMesh
Comments
Rendering some 3d feature is not as hard as what you said. you are able to draw whatever you want include the triangles, or other gui rendering in the eventHandler of orxRENDER_EVENT_VIEWPORT_START.
if it is 3d, depth buffer is needed, depth is needed to set in the .ini config.
If you need, I could send you my work related to this feature. Any details are shown in it.
[email protected]
If you want to implement a 3D distorsion mesh, you can simply render your viewport to a texture and reuse that texture with your 3D mesh.
Finally you can also create objects programmatically and completely bypass the config system. That will require a lot more code and is less handy. If you want to do so, have a look at the code of orxObject_CreateFromConfig(). It only calls other public functions to create and setup and object. You can do the same in your code.
I watched a function orxObject_CreateFromConfig () and it has created the following code unfortunately it did not work. maybe you give me for my mistake.
but the next version was operational but that option was not very happy because it is not easy.
As for the code, it looks ok (beside lacking an orxFRAME which is the "coordinate" structure)
However it's 5:40 AM right now so I'll give it another look tomorrow after getting some sleep!
EDIT: What is the main reason why you don't want to use the config system, btw? I mean, not in code as shown above, but by writing an actual .ini config file?
ini:
xml:
Those are two animations of the same object. It looks obvious that ini format is more heavy. Moreover, XML format is created in the animation editor and it's unnacessary to create it manually unlike in ini format.
Also one often has to use third-party libraries, and often they use xml files. It is not reasonable to write a converter of their format into yours (this situation reminds me of XNA with its Content Processor). It's easier to write a parser for the engine
You chose the perfect example as animations are the most annoying piece of config to write. I still hope a community-driven editor will be created at some point (Eyecreate and Laschweinski both started to make efforts in that direction). But that doesn't solve our issue for now.
However there's something you can do to make your life better: use the config module to create the data at runtime (or to preprocess them offline and save them in a config file).
After a discussion I had with Laschweinski a couple of weeks ago, I wanted to write a small tip-tutorial on the wiki but didn't have the occasion yet. Here's the basic idea.
Instead of writing the full-fledged config info, consider something like this:
There you have all the informations you need!
Now, at init, you can preprocess all your animation found in the AnimationList of the section Main.
Your code will then:
- loop through the list of animation and gets the string value
- push it as a config section
- create the associated texture (orxTexture_CreateFromFile(orxConfig_GetString("FrameTexture"), ...), don't worry, no duplicate will be hold in memory)
- gets its size
- store DefaultKeyDuration from FrameDuration with orxConfig_SetFloat() (yeah, it could have been done directly manually but I like having the same prefix for all the values I write as a human )
- gets the frame counter (counter = frameTextureGrid.x * frameTextureGrid.y) and add as many keys with a name base on the anim (such as RotatePizzaSign_Frame##)
- for all the frames above, we push its section, sets its texture, pivot, size and corner coordinate based on its index and the texture grid + corner (pos starts at frameTextureCorner, for i = 0 to frameTextureGrid.y, y += frameSize.y and for j = 0 to frameTextureGrid.x, x += frameSize.x), pops from its section
- pops from the anim section
You can of course create a base texture section and set the frames to inherit from it for the texture name, pivot and size as you'd do it if you had to write manually the config file. The code for the logic above shouldn't take long to write and should only be pretty small in the end.
There you go, you have all the information you need to be able to create your animation/object from config now. You can either do that when loading your game, shouldn't be long to process as everything happens in memory, or you can choose to preprocess offline and save the config data to a file with orxConfig_Save() and use that file normally in your game.
Also you can use XML as input and do the same piece of code, of course. I'm just using .ini as the input data here as it's what orx supports natively (and I don't care much for XML myself). You can expand this example with new information as you see fit, of course, such as using Reverse to set a Flip property or anything else you'd like.
Hope this helps.
the attachment is the code. I believe it is simple to combine with your code, no other dependency is called in it.
the modification I do in .ini is as follows:
[NormalTanksGraphSet]
Row = 2
Column = 5
Size = (26,32,0)
CornerBegin = (0,0,0)
Texture = BattleMapRes/normalTanks.png
PrefixName = NormalTanksGraph
Pivot = center
;Flip = y
Here the origin graph's size is (26*5, 32*2)
another orx based app I made is an tmx, it parse a tmx map to a config node stored in memory, which the dependend lib I use is tinyxml. it may be useful for you.
Comparing with xml, I feel .ini format is somewhat more explicit for me. https://forum.orx-project.org/uploads/legacy/fbfiles/files/GraphSetLoader.zip
There are some bugs please forgive me, https://forum.orx-project.org/uploads/legacy/fbfiles/files/doublexParser.zip