Feature Request for CLASS App
Monkey Forums/Monkey Programming/Feature Request for CLASS App
| ||
i can use only one Class that exdends the App :-( Class MyApp Extends App i need this Class MyApp Extends App Class MessageBox Extends App Class GUI Extends App so this classes get there own OnUpdate/OnRender loops. its more handier. if a class is created with new they will direct show on screen and begins to work without calling a update/render from other method. |
| ||
I understand what you want to do but actually it might be a bit hard to achieve because your app class is some kind of a Singleton and therfor only available once. What you should look for is some kind of a state machine. |
| ||
i don't like the uneven path :) therefore i request for some changes. maybe with a new monkey class like this: App --SubApp --SubApp --SubApp |
| ||
I don't see how this could work. You can only have one main (UI) thread. Sure deriving would be possible but not instantiation. |
| ||
No, just no. What you want is threading. Sadly Monkey doesn't really have this. At least not yet. And as far as the UI is concerned, if each of these sub apps had their own OnRender sequence, exactly which one would go first? Obviously this cannot work in logical sequence. I noticed your code is for a sort-of GUI you're building. I'll tell you from experience having made now 5 different GUI systems in Monkey, that you definitely don't need what you're asking for. |
| ||
no, i don't want multi threading, i want only a Class that have OnRender + OnUpdate "Loop" called from App itself. its definitely useful. example what i mean: Class App field List:List<LoopApp> method AddLoopApp(LoopApp:LoopApp) List.AddLast(LoopApp) end method OnUpdate() for local LoopApp=eachin List LoopApp.OnUpdate() class SomeThing extends LoopApp '< i can use extends more then once method OnUpdate() '... end method OnRender() '... end ---------- elsewhere Method Do() Self.SomeThing = new SomeThing '<- and BING it appears from self on screen because it have a OnRender Method end |
| ||
have OnRender + OnUpdate "Loop" called from App itself. Seems you want something like AS3 Display List: http://www.adobe.com/devnet/flash/quickstart/display_list_programming_as3.htmlTry Flixel for Monkey: https://github.com/devolonter/flixel-monkey/blob/master/flxgroup.monkey#L110 or Diddy's screen system: https://code.google.com/p/diddy/source/browse/src/diddy/framework.monkey#752 |
| ||
@programmer thanks @all just now, i finished something that works best for me (i believe) :-) 'MR 09.08.2013 Global LoopList:List<AppLoop>=New List<AppLoop> Class AppLoop Method Register() LoopList.AddLast(Self) End Method UnRegister() LoopList.RemoveFirst(Self) End Method OnRender:Int() Self.OnRender() End Method OnUpdate:Int() Self.OnUpdate() End End 'Example for own classes: 'Class MessageBox extends AppLoop 'Methods OnUpdate:Int() & OnRender:Int() 'Local M:MessageBox = New MessageBox 'M.Register() 'M.UnRegister() 'Example for insert in App : ' Method OnUpdate:Int() ' For Local L:AppLoop = Eachin LoopList.Backwards() ' L.OnUpdate() ' Next ' Return 1 ' End ' Method OnRender:Int() ' For Local L:AppLoop = Eachin LoopList ' L.OnRender() ' Next ' Return 1 ' End |
| ||
From what I hear you are looking for simple a component/screen system. Here is one I built. You can have any kind of hierarcy of classes. If you remove one component all sub-components are also removed since they update in hierarical order. I assume that the one you showde above works perfectly fine. However I wanted to share mine in case if would help or provide inspiration. gameclock.monkey component.monkey To use this you inherit from Component instead of App and you can have any number or OnUpdate/OnRender. Feel free to use however you want. |
| ||
@Tibit, ok, thanks :) |
| ||
Unless you're doing something rather elaborate, it may be just as easy to explicitly make recursive calls in OnUpdate and OnRender to all children of a given window. |