PDA

View Full Version : Vis plugin randomize visualization


MoJo2600
12th November 2006, 10:57
Hello,

again another question. And again a n00b question :)

I wrote a plugin with 4 different render functions. I want to change the render function every 30sec automatically to another one (random).

Now I build a configuration dialog with a checkbox to enable random mode. Everything is working fine. But I just don't know how to let the plugin change the render function after a defined period of time.

My Idea is to measure the time passed in every render function . But how to switch the render functions... There must be a easy way, or?

Can anybody help me?

Regards,

MoJo

Tardymo
12th November 2006, 11:46
I have no experience with VIS plugins, but can't there be a parent function which instead of rendering by itself, invokes other functions which do the rendering?

DrO
12th November 2006, 12:13
aye, just have one main render function defined in the vis structures and then based on your timer/settings/etc you switch the sub render function used so something like (psuedo code time) ...

HandlerFunction(params_passed_in){
switch(renderer_to_use){
case 0: renderer0(params_passed_in) break;
case 1: renderer1(params_passed_in) break;
...
default: rendererfallback(params_passed_in) break;
}
}-daz

MoJo2600
12th November 2006, 17:01
ah, that looks nice... I'll try that.