FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

[Request] Option to Add an Update function that gets Called Before Render

4 posters

Go down

[Request] Option to Add an Update function that gets Called Before Render Empty [Request] Option to Add an Update function that gets Called Before Render

Post  uprise78 Tue May 12, 2009 10:14 am

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

Back to top Go down

[Request] Option to Add an Update function that gets Called Before Render Empty Re: [Request] Option to Add an Update function that gets Called Before Render

Post  Francescu Tue May 12, 2009 10:57 am

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

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

[Request] Option to Add an Update function that gets Called Before Render Empty Re: [Request] Option to Add an Update function that gets Called Before Render

Post  uprise78 Tue May 12, 2009 12:43 pm

What I mean is something similar to the _SIO2windowrender. A new function pointer on the _SIO2window object that you can set just like _SIO2windowrender.

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

Back to top Go down

[Request] Option to Add an Update function that gets Called Before Render Empty Re: [Request] Option to Add an Update function that gets Called Before Render

Post  oioioi Tue May 12, 2009 12:54 pm

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.

oioioi

Posts : 136
Join date : 2008-12-02
Location : Norway

Back to top Go down

[Request] Option to Add an Update function that gets Called Before Render Empty Re: [Request] Option to Add an Update function that gets Called Before Render

Post  uprise78 Tue May 12, 2009 1:11 pm

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

Back to top Go down

[Request] Option to Add an Update function that gets Called Before Render Empty Re: [Request] Option to Add an Update function that gets Called Before Render

Post  sio2interactive Tue May 12, 2009 4:11 pm

SIO2 is not a static library... all the callbacks for rendering & events are in sio2_window.cc / .h
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

[Request] Option to Add an Update function that gets Called Before Render Empty Re: [Request] Option to Add an Update function that gets Called Before Render

Post  uprise78 Tue May 12, 2009 5:29 pm

Perfecto. I shall add it for my project. Thanks SIO2.

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

[Request] Option to Add an Update function that gets Called Before Render Empty Re: [Request] Option to Add an Update function that gets Called Before Render

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum