FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DAllegro on D2 - install_int not interrupting

 
Post new topic   Reply to topic     Forum Index -> dallegro
View previous topic :: View next topic  
Author Message
ggvicviper



Joined: 13 Apr 2011
Posts: 1

PostPosted: Wed Apr 13, 2011 3:29 pm    Post subject: DAllegro on D2 - install_int not interrupting Reply with quote

Hey, I was compiling a sample allegro app I created with D, and it worked fine in D 1.0, but in D 2.0, (2.052 to be specific) it didn't install the interrupt handler. I compiled with -d. Is there something that I should change in my code to make the interrupt handler work with D 2.0, or is this a bug? Any help would be appreciated.

I am running on Windows XP. The code (one source file):

Code:
import allegro.allegro;

int i = 0;

extern (C) void fpsTimer()
{
   volatile i++;
}

int main(char[][] args)
{
   allegro_init();
   install_timer();
   install_keyboard();

   set_color_depth(32);
   set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 240, 0, 0);

   BITMAP *buffer = create_bitmap(screen.w, screen.h);

   install_int(&fpsTimer, 16);

   while(!key[KEY_ESC])
   {
      textprintf_ex(buffer, font, 0, 0, -1, -1, "%d", i);

      vsync();
      acquire_screen();
      blit(buffer, screen, 0, 0, 0, 0, 320, 240);
      release_screen();

      clear_bitmap(buffer);
      rest(0);
   }

   destroy_bitmap(buffer);

   remove_int(&fpsTimer);
   remove_timer();
   allegro_exit();

   return 0;
}
Back to top
View user's profile Send private message Send e-mail
torhu



Joined: 30 Mar 2006
Posts: 56

PostPosted: Sat Oct 22, 2011 8:54 am    Post subject: Reply with quote

I'm sorry I haven't checked this forum for a while, but I will leave a reply anyway.

Try declaring i as shared or __gshared. Globals in D2 are thread-local by default, and IIRC, Allegro uses a separate thread for the timers.

You could also have a look at DAllegro5, since Allegro 4 is getting old now.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> dallegro All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group