Bienvenido a Tecnohackers

Tecnohackers » Programacion » Area de Programacion » Programacion a Bajo Nivel. APIs, Hooking, ASM, C/C++, etc.
 » 

Dibujar por Pantalla[Allegro]



Autor Tema: Dibujar por Pantalla[Allegro]  (Leído 882 veces)

Desconectado P4|3L0

  • Asiduo
  • *
  • Mensajes: 75
  • TecnoHacker un nuevo proyecto.
    • http://www.tecnohacker.com
Dibujar por Pantalla[Allegro]
« en: Diciembre 29, 2009, 05:04:41 pm »
Vestigios de un Paint? -Nahhh  ;D

Lo que hace esto es activar el ratón y puedes dibujar circulos, de diferentes colores segun al numero que le des..y para hacer mas grande el pincel dale al plus_pad


Código: You are not allowed to view links. Register or Login
#include <allegro.h>

BITMAP* buffer;

int cursor_x = 20;
int cursor_y = 20;
int grosor=5;
int r=255,g=255,b=255;
void getMouseInfo(){

     if(mouse_b & 1){

                  cursor_x = mouse_x;
                  cursor_y = mouse_y;
     }
     if(key[KEY_1]){
      r=0;
     g=0;
     b=255;
     }
     if(key[KEY_2]){
         r=255;
         g=0;
         b=0;
     }
     if(key[KEY_0]){
         r=255;
         g=255;
         b=255;
     }
     if(key[KEY_3]){
      r=0;
      g=255;
      b=0;

     }
     if(key[KEY_4]){
         r=255;
         g=255;
         b=0;
     }
     if(key[KEY_5]){
         r=0;
         g=255;
         b=255;
     }
     if(key[KEY_6]){
         r=250;
         g=5;
         b=250;
     }
     if(key[KEY_7]){
         r=100;
         g=100;
         b=100;
     }
     if(key[KEY_PLUS_PAD]){
         grosor++;
     }
     if(key[KEY_MINUS_PAD]){
         grosor--;
     }

}

void updateScreen(){
if(grosor<3){
    grosor=3;
}
     circlefill ( buffer, cursor_x, cursor_y, grosor, makecol(r,g,b));
     draw_sprite( screen, buffer, 0, 0);

}

int main(){

    allegro_init();
    install_mouse();
    install_keyboard();
    set_color_depth(16);
    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);

    buffer = create_bitmap( 640, 480);

    show_mouse(buffer);

    while( !key[KEY_ESC]){

           getMouseInfo();
           updateScreen();
    }

    return 0;

}
END_OF_MAIN();



Tags:
Tags:

 


SMF 2.0.19 | SMF © 2016, Simple Machines
Paginas Afiliadas
Twitter - FaceBook - Daraxblog
Designed by Smf Personal