Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Come and help me this poor guy

This thread is locked; no one can reply to it. rss feed Print
Come and help me this poor guy
keprast
Member #16,794
January 2018

HELP!HELP!

Timer conflict caused by the problem, how to solve?
As long as I start two timers, I get in conflict.
like this:

#SelectExpand
1 ALLEGRO_TIMER * fps = NULL; 2 ALLEGRO_TIMER * soli_move = NULL; 3 4 fps = al_create_timer(1 / 60.0); 5 soli_move = al_create_timer(0.0);//error?yes.》》al_create_timer(0.2) 6 al_set_timer_speed(soli_move, 0.2);//error?no 7 8 al_register_event_source(event_queue, al_get_timer_event_source(fps)); 9 al_register_event_source(event_queue, al_get_timer_event_source(soli_move)); 10 11 al_start_timer(fps); 12 al_start_timer(soli_move); 13//something 14 case ALLEGRO_EVENT_TIMER: 15 if (event.timer.source == fps) 16 { 17 al_set_target_bitmap(al_get_backbuffer(display)); 18 al_clear_to_color(al_map_rgb(255, 255, 255)); 19 al_draw_bitmap(soli, x, y, 0); 20 21 al_flip_display(); 22 } 23 if (event.timer.source == soli_move){/*something*/} 24//something

???
As long as I start fps and soli_move, conflicts are inevitable.
If I only use fps, it is safe.
An error occurred in the Settings section.

What happened?
----------------------------------------------------
error:
Assertion failed: timer, file C:\dev\allegro_winpkg\universal\allegro\src\timernu.c, line 349

----------------------------------------------------
:-[ I am stupid, al_set_timer_speed not so useful

Chris Katko
Member #1,881
January 2002
avatar

I don't think you can create a timer with zero as the delay!

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Go to: