It looks like you're new here. If you want to get involved, click one of these buttons!
Rotation = @Display.ScreenWidth / 2
Can something like this be done in the ini files? And is there I can get the size of a image or a object like this..Rotation = @Display.ScreenWidth / 2
Alpha = @AsteroidGraphic.Width
Comments
This has been asked a few times already but it's unfortunately not really easy to implement. That comes from the way inheritance is internally stored/referenced with the config cache.
When a value is inherited, we'll ask the parent directly and we'll use its own cache (to prevent as many string parsing/interpretation as possible).
If an expression is referencing a parent, the cache can't be handled by the parent (or any ancestor of the hierarchy) and knowing if something changed somewhere along the hierarchy isn't exactly easy to propagate as the hierarchy itself is a soft one (holes are permitted or even parent-less leaves).
I'll think about it some more to see if I can find a reasonable solution.
As for querying the size of an object/graphic directly from the config, this isn't something that can be automated while providing a consistent behavior from the user point of view.
However you can either pre-process the config or modify it at runtime at will.
In the case of Rotation, in your Init function you can have something like:
In that particular case (ie. related to screen) you could even have that code when handling the event orxDISPLAY_EVENT_SET_VIDEO_MODE, this way if the screen get resized, your value will always be up-to-date.
As for the last one with no operator, simply call a orxConfig_SetFloat("Alpha", MyGraphicSize.fX); after retrieving the value from the orxGRAPHIC module.
All this feels more like you'd need a full fledged scripting system more than simply a config one.
I know that some users rolled their own LUA bindings, for example, and only develop using LUA.
That being said, having maths arithmetic expressions could be very useful.
I still find tricks in how to use it to make my life better every once in a while.
As for a scripting module, someone started to work on one but it never got finished. Hopefully someone will have time to write one at some point but it's unlikely to be me, at least no in short/med term.
Or you may check Lua or Game Monkey or Squirrel scripting for yourself. Later two can be integrated easily with C++.
Hi jim,
I'm sure a lot of people (me included) would benefit from some Lua bindings!
Don't worry about making it a plugin as it's a bit more complex as the API has to be somewhat generic. A good Lua set of bindings is all we need. No pressure though!