Mail Archives: djgpp/1999/02/23/15:05:49
ok im stuck again. just learning the allegro library and monkeying around now.
how do i print text on the screen when i hit the mouse button. it woks when i
hit esc and then click a button.
#include <stdlib.h>
#include <stdio.h>
#include "allegro.h"
PALLETE my_pallete;
BITMAP *scry;
DIALOG the_dialog[] =
{
{ d_clear_proc, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0,
NULL },
{ d_icon_proc, 2, 2, 32, 32, 255, 9, 0, 0, 0, 0,
NULL },
{ d_check_proc, 32, 64, 88, 12, 255, 0, 't', 0, 0, 0,
"&Toggle Me" },
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
NULL }
};
int main()
{
allegro_init();
install_keyboard();
install_mouse();
install_timer();
set_gfx_mode(GFX_VESA1,1024,768,0,0);
set_pallete(desktop_pallete);
scry = load_bmp("shield.bmp",my_pallete);
the_dialog[1].dp=scry;
do_dialog(the_dialog, -1);
do{
if (mouse_b & 1)
textout(screen,font,"Left button is pressed",116,112,255);
if (mouse_b & 2)
textout(screen,font,"Right button is pressed",116,112,255);
} while (!keypressed());
readkey();
return 0;
}
- Raw text -