How to handle on every ENTER_FRAME model or view updates in Robotlegs so that it was not expansive?
Say I have a ball that bounces from the walls - something similar to the Arkanoid game. In this case you should listen to ENTER_FRAME event and change the coordinate of the ball depending on velocity, previous coordinate, whether if it bounced from the wall, etc. All this is being done in model. Should I dispatch an event on every ENTER_FRAME which contains new coordinates of the ball calculated in the model to the view so that the view is updated?
In general, if on every ENTER_FRAME I have to update model via view or vice versa, should dispatch and event, create a command which will inject a model and change the model's data on every ENTER_FRAME? Isn't it very expansive and slow? Is there a better approach here?
P.S. Please consider that I might use for example Box2D in my model to calculate ball coordinates.
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Ondina D.F. on Jan 08, 2014 @ 09:58 AM
Hello!
I recommend checking out these frameworks:
Ember2 - Tom Davies:
http://www.tomseysdavies.com/2011/12/04/ember-2/
https://github.com/tdavies/Ember2
https://github.com/tdavies/Ember2-demos
xEmber - Alec McEachran:
https://github.com/alecmce/xember
Ash - Richard Lord:
http://www.richardlord.net/blog/introducing-ash
https://github.com/richardlord/Ash
hth
Ondina
2 Posted by naghekyan on Jan 08, 2014 @ 12:19 PM
So pity that the license info is much longer than the "what is it about" info :( Though I have looked the demo code with Bunnies I could not understand the main idea behind the Ember and the approach in this problem. :( Maybe I will find time to investigate code thoroughly later.
Thanks for pointing out the direction!
Support Staff 3 Posted by Ondina D.F. on Jan 09, 2014 @ 10:16 AM
You're welcome!
Yes, I know, it's not easy to understand the concepts without documentation, and I can't help you either, sorry.
Support Staff 4 Posted by Shaun Smith on Jan 09, 2014 @ 02:02 PM
Hi. I tried out Ash a while ago. You can read about my experiences here: http://shaun.boyblack.co.za/blog/2012/08/04/games-and-entity-systems/
5 Posted by naghekyan on Jan 13, 2014 @ 02:55 PM
Thank you so much! This is a great article. I have learned a lot of very important and nice things from your article. Nice to have such people sharing knowledge.
Support Staff 6 Posted by Shaun Smith on Jan 13, 2014 @ 03:20 PM
It's a pleasure :) I'm going to close this discussion for now - feel free to open a new discussion for further questions.
Shaun Smith closed this discussion on Jan 13, 2014 @ 03:20 PM.