void TimeManager::SetMaximumRefreshRate (int hz) { if (hz == 0) hz = 1; max_fps = hz; current_timeout = FPS_TO_DELAY (hz); source->SetTimerFrequency (current_timeout); first_tick = true; }
void set_animation_flying_ball() { dprintf("flying_ball\n"); animation.delay_in_ms = FPS_TO_DELAY(5); // 50ms = 20 fps animation.duration_in_ms = 0; animation.animationStart = &flying_ball_animation_start; animation.animationStop = &animation_default_animation_stop; animation.animationLoop = &flying_ball_animation_loop; animation.animation_typematrix_row = &flying_ball_typematrix_row; }
void set_animation_type_o_matic() { dprintf("type_o_matic\n"); animation.brightness = 255; animation.delay_in_ms = FPS_TO_DELAY(4); animation.duration_in_ms = 0; animation.animationStart = &type_o_matic_animation_start; animation.animationStop = &type_o_matic_animation_stop; animation.animationLoop = &type_o_matic_animation_loop; animation.animation_typematrix_row = &type_o_matic_typematrix_row; }
TimeManager::TimeManager () { SetObjectType (Type::TIMEMANAGER); if (moonlight_flags & RUNTIME_INIT_MANUAL_TIMESOURCE) source = new ManualTimeSource(); else source = new SystemTimeSource(Deployment::GetCurrent ()); current_timeout = FPS_TO_DELAY (DEFAULT_FPS); /* something suitably small */ max_fps = MAXIMUM_FPS; flags = (TimeManagerOp) (TIME_MANAGER_UPDATE_CLOCKS | TIME_MANAGER_RENDER | TIME_MANAGER_TICK_CALL /*| TIME_MANAGER_UPDATE_INPUT*/); start_time = source->GetNow (); start_time_usec = start_time / 10; source->SetTimerFrequency (current_timeout); source->AddHandler (TimeSource::TickEvent, source_tick_callback, this); registered_timeouts = NULL; source_tick_pending = false; first_tick = true; emitting = false; rendering_args = new RenderingEventArgs (); applier = new Applier (); timeline = new ParallelTimeline(); timeline->SetDuration (Duration::Forever); root_clock = new RootClockGroup (timeline); char *name = g_strdup_printf ("Surface clock group for time manager (%p)", this); root_clock->SetName (name); root_clock->SetTimeManager (this); stop_time = 0; was_stopped = false; }