Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void init();
- void deinit();
- void desenhaInstrucoes( BITMAP *bmp[] ) {
- bmp[0] = load_bitmap( "mover.bmp", NULL );
- }
- typedef struct personagem
- {
- int x, y;
- enum direcao d;
- bool andando;
- int image;
- int pixels_andados;
- //BITMAP *img;
- } personagem;
- int mouseSobreBotaoInstrucao( personagem *j, int x, int y ) {
- if( 400 <= x && x < 400 + j.pixels_andados &&
- j.y <= y && y < j.y + j.pixels_andados ) {
- set_mouse_sprite( j->bmpInstrucao[0] );
- return 1;
- }
- else
- return 0;
- }
- int main() {
- init();
- rectfill( screen, 0, 0, 499, 499, makecol( 23,47, 60 ) );
- allegro_message("Welcome to tibia");
- int grab = 0;
- while (!key[KEY_ESC])
- {
- if( mouse_b & 1 ) {
- if( !grab ) {
- int mouseX = mouse_pos >> 16,
- mouseY = mouse_pos & 0x0000ffff;
- if( mouseSobreBotaoInstrucao( &personagem, mouseX, mouseY ) ) {
- select_mouse_cursor( MOUSE_CURSOR_ALLEGRO );
- show_mouse( screen );
- grab = 1;
- }
- }
- }
- else if( grab ) {
- select_mouse_cursor( MOUSE_CURSOR_ARROW );
- show_mouse( screen );
- grab = 0;
- }
- }
- }
- deinit();
- return 0;
- }
- END_OF_MAIN()
- void init() {
- int depth, res;
- allegro_init();
- depth = desktop_color_depth();
- if (depth == 0) depth = 32;
- set_color_depth(depth);
- res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 500, 500, 0, 0);
- if (res != 0) {
- allegro_message(allegro_error);
- exit(-1);
- }
- install_timer();
- install_keyboard();
- install_mouse();
- /* add other initializations here */
- enable_hardware_cursor();
- select_mouse_cursor( MOUSE_CURSOR_ARROW );
- show_mouse( screen );
- }
- void deinit() {
- clear_keybuf();
- /* add other deinitializations here */
- }
Add Comment
Please, Sign In to add comment