[Request] Option to Add an Update function that gets Called Before Render
4 posters
[Request] Option to Add an Update function that gets Called Before Render
Basically, I like to separate my updates from my renders to keep the code clean and readable. It is pretty easy to just call an update method on the first line of the render function but it seems like it would be cleaner overall if the sio2 object allowed us to add a 'templateUpdate' method that could get called just before 'templateRender'. Any thoughts?
uprise78- Posts : 228
Join date : 2008-10-31
Re: [Request] Option to Add an Update function that gets Called Before Render
I'm not sure what you mean by updates? You can have multiple render functions for your multiple levels and I'm assuming this is what you mean by 'renders' - how would you bind a templateUpdate to a particular templateRender - function ptr?
Cheers
Cheers
Francescu- Posts : 136
Join date : 2009-03-18
Re: [Request] Option to Add an Update function that gets Called Before Render
What I mean is something similar to the _SIO2windowrender. A new function pointer on the _SIO2window object that you can set just like _SIO2windowrender.
Right before sio2->_SIO2window->_SIO2windowrender gets called sio2->_SIO2window->_SIO2windowupdater would be called. The point being to separate your game logic (accelerometer smoothing, updating transforms, etc) from the actual rendering code. IMHO this keeps the code much cleaner and easier to manage.
- Code:
sio2->_SIO2window->_SIO2windowupdater
sio2->_SIO2window->_SIO2windowrender
Right before sio2->_SIO2window->_SIO2windowrender gets called sio2->_SIO2window->_SIO2windowupdater would be called. The point being to separate your game logic (accelerometer smoothing, updating transforms, etc) from the actual rendering code. IMHO this keeps the code much cleaner and easier to manage.
uprise78- Posts : 228
Join date : 2008-10-31
Re: [Request] Option to Add an Update function that gets Called Before Render
You can make this your self in a few minutes...
I don't think this is something which is necessary to include in sio2 because you could, as you said, just call the update function on the first line of your render function, or make it your self if you really need it which is super easy.
I don't think this is something which is necessary to include in sio2 because you could, as you said, just call the update function on the first line of your render function, or make it your self if you really need it which is super easy.
oioioi- Posts : 136
Join date : 2008-12-02
Location : Norway
Re: [Request] Option to Add an Update function that gets Called Before Render
Back in the day when the sio2 file wasn't a static lib this would be easy...and it feels a bit ugly to stick an update function call on the top of my render call which then binds the render function to the update function. Obviously not a big deal in any way though. Either way works in the end.
uprise78- Posts : 228
Join date : 2008-10-31
Re: [Request] Option to Add an Update function that gets Called Before Render
SIO2 is not a static library... all the callbacks for rendering & events are in sio2_window.cc / .h
Re: [Request] Option to Add an Update function that gets Called Before Render
Perfecto. I shall add it for my project. Thanks SIO2.
uprise78- Posts : 228
Join date : 2008-10-31
Similar topics
» Request: function to fade between render callbacks
» Update from 1.3.3 to 1.3.5 bug
» REQUEST: Lua to Python
» Latest SVN Update
» Request: code comments
» Update from 1.3.3 to 1.3.5 bug
» REQUEST: Lua to Python
» Latest SVN Update
» Request: code comments
Permissions in this forum:
You cannot reply to topics in this forum