"Rek" wrote:
"dev42" wrote:
Would it be OK to make allObjsToDrawStackList a global?
It might be OK, but probably wouldn't be best. It seems like that variable should be confined to some sort of render manager object. Making it a global will just limit you in the future. For example, what if you wanted to support two render systems and swap them out with each other dynamically? Just a thought.
That, dear sir, sounds exquisite, but I wouldn't have the foggiest on how to go about doing such a thing. That said, I've really tried to be too generic with my first app to make future app development "easier". Unfotunately, I've overly complicated areas of this app for that purpose. I'm suspecting this should have been postponed to a later date. :roll: But, if you care to elaborate, I'm sure there are quite a few of us interested in this.
😉 _____________
"Rek" wrote:
"dev42" wrote:
or better to pass it into *all* offspring obj methods?
... I'm going to assume you meant that in order to have children add themselves to the stack, they must have direct write-access to the stack variable. ... I would suggest adding a method to the parent which does that (something like "addDrawable"). Then each child need only call 'parent.addDrawable(m)'. If you have multiple levels in the hierarchy, you may want to have each component provide an "addDrawable" function that just calls its parent's "addDrawable". That way, all leaf components can pass their drawables up to the root of the hierarchy without ever having direct access to the stack.
Yes, that's what I meant. The kicker is still needing to have access to the parent. Every now and then I lose understanding about what "m" stands for.
😉 But it isn't the "parent" it is the current node. So, for example... if the app is inside some arbitrary object's .processEvent() function, I can access all of that obj's attributes / methods, but not the parent, unless I create that link/attribute, correct?
Also, would you just pass the obj's drawable, or the whole object?
_____________
"Rek" wrote:
"dev42" wrote:
and what about the parent object... like appending a sub-menu to the parent menu?
Not sure what you're asking here.
[spoiler=My current mental image of my setup:3il6rxe8]
+- main menu -------+-sub-menu---- ...
| +-sub-menu---- ...
| +- ...
|
+- game canvas/action stuff ---+-obj01-- ...
| +-obj02-- ...
| +- ...
|
+- textBox/feedback ----+-textBox01-- ...
+-textBox02-- ...
[/spoiler:3il6rxe8]
I'm sure this is all moot, I'd just have an addMenu(), addGameObj() & addTextBox() ... but here we go. In this context, there are 2 types of objects: Those that are already hard coded onto the stack/list and those that will be put there dynamically. In the later case, specifically in relation to sub-menu's, I foresee it as adding it not to the root, but to the
parent or parent's parent, but there might be cases where adding to the root is better. It probably is something that is relatively simple and I'm just missing it, like: addMenuToParent() or addMenuToRoot() or something like having the entire menu plotted out and just turn the different sub-menu's visibility / focus flag on/off.