// Copyright 2005, The Tanoshi development team // Assigned to public domain, Use as you wish withou restriction. #include #include class main_proc : public sigc::trackable { public: Tanoshi::Timer timera; Tanoshi::Timer timerb; Tanoshi::EventManager eventmanager; void run(); void timera_slot(); void timerb_slot(); unsigned int time; }; void main_proc::run() { time = 100; timera.setEventManager(&eventmanager); timerb.setEventManager(&eventmanager); timera.timeout.connect(sigc::mem_fun(this, &main_proc::timera_slot)); timerb.timeout.connect(sigc::mem_fun(this, &main_proc::timerb_slot)); timera.setTimeOut(time, true); timera.setRunOnce(true); timerb.setTimeOut(time*2, true); timerb.setRunOnce(true); timera.start(); timerb.start(); for(;;) { eventmanager.processEvent(); eventmanager.sleep(); } } void main_proc::timera_slot() { printf("TimerA: %d\n", time); time+=50; timera.setTimeOut(time, true); timera.start(); } void main_proc::timerb_slot() { printf("TimerB: %d\n", time*2); timerb.setTimeOut(time*2, true); timerb.start(); } int main() { class main_proc test; test.run(); }