CAllegroDisplay::CAllegroDisplay(int width,int height,int color_depth,char *error_file)
{
  /*
    Init the error log handler
  */
  error_log = fopen(error_file,"at");
  if (error_file == NULL) 
  {
    error_log = stdout;
    PrintError("Error opening error_log file!!!\n");
  }
  
  /*
    Init allegro graphic library
  */
  allegro_init();
  install_timer();
  install_keyboard();
  install_mouse();
  alfont_init();
  
  show_mouse(NULL);
  /*
    Try to init display resolution
  */
  set_color_depth(color_depth);
  if (set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,width,height,0,0)) fatalError(allegro_error);
  set_display_switch_mode(SWITCH_PAUSE);
  srandom(time(0));
}
Beispiel #2
0
int main(){
    
    declarevalues();
 
 
    allegro_init();
    install_keyboard();
    install_mouse();
    set_color_depth(32);
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, Screen.getwidth(), Screen.getheight(), 0, 0);
    
    buffer = create_bitmap(Screen.getwidth(), Screen.getheight());


Loadproperties();


while (!key[KEY_ESC]) // Here is the game loop.
{

    declarearray();
    create_world();
     
     
     circlefill(buffer, mouse_x, mouse_y, 5, makecol(255, 0, 0));
    
    
        textprintf_ex(buffer, font, 10, 10, makecol(255, 100, 200), -1, "%s", testchar.testname.c_str() );
        
               
    blit(buffer, screen, 0, 0, 0, 0, Screen.getwidth(), Screen.getheight());
    clear_bitmap(buffer);
}   
    return 0;   
}   
Beispiel #3
0
int
main (void)
{
  int i;

  allegro_init ();
  install_keyboard ();
  install_mouse ();
  install_timer ();

  if (set_gfx_mode (GFX_XWINDOWS, 640, 480, 0, 0) < 0)
    {
      allegro_message ("Can not set graphics mode\n%s", allegro_error);
      return 0;
    }

  black = makecol (0, 0, 0);
  white = makecol (255, 255, 255);
  red = makecol (255, 0, 0);
  yellow = makecol (255, 255, 0);

  /* Clear key mappings.  */
  for (i = 0; i < 256; i++)
    keycode_to_scancode[i] = -1;

  /* Hook X-windows keyboard callback.  */
  _xwin_keyboard_callback = get_raw_keycode;

  show_main_dialog ();

  return 0;
}
void level_editor()
{
    int i,j;
    BITMAP* buffer;
    BITMAP* ecran_noir;
    char mot[50];
    mot[0]='c';
    mot[1]='\0';
    allegro_init();
    install_keyboard();
    install_mouse();
    set_color_depth(8);
    enable_hardware_cursor();
    BITMAP* affiche[15][19]={{load_bitmap("mur.bmp", NULL)}};
    ecran_noir= create_bitmap(192+5*32, 160);
    clear_to_color(ecran_noir, makecol(255, 255, 0));
    buffer= create_bitmap(TSPRITE*19, TSPRITE*15);
    if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, TSPRITE*19, TSPRITE*15, 0, 0)==0)
    {
    affiche[0][0]=load_bitmap("mur.bmp", NULL);
    for (i=0; i<15; i++)
    {
        for(j=0; j<19; j++){
                affiche[i][j]=affiche[0][0];
                if (affiche[i][j]!=NULL) draw_sprite(buffer, affiche[i][j], TSPRITE*j, TSPRITE*i);
        }
    }
    textprintf_ex(ecran_noir, font, 0, LIGNE, makecol(255,255,255),-1, "bienvenue sur l'editeur de niveau");
    draw_sprite(buffer, ecran_noir, 192-2*32, 160);
    blit(buffer, screen,0,0,0,0, 19*TSPRITE, 15*TSPRITE);
    rest(1100);
    menu(buffer, affiche, mot);
    destroy_bitmap(buffer);
    }
}
Beispiel #5
0
void init()
{
    allegro_init();
    set_color_depth(32);

    if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 240, 0, 0))
    {
        allegro_message("%s.", allegro_error);
        exit(1);
    }

    init_engine(SCREEN_W, SCREEN_H);
    point_at_color_buffer(&buffer);
    setup_projection(90.0, -1.333, 1.333, -1.0, 1.0, 0.0, 200.0);
    set_znear(1.0);
    set_clipping_rect(10, 10, buffer->w - 11, buffer->h - 11);
    init_clipper();
    set_rasterizer_function(flat_zbuff_sides);
    set_world_clip_func(2, wclip_to_rend_int, 0, 0, 0, 0);
    set_scr_clip_func(4, rend_int_to_tri, 0, 0, 0, 0);

    install_keyboard();
    install_mouse();
    srand(time(NULL));
}
Beispiel #6
0
void init(){
    allegro_init();
	set_color_depth(32);
    set_alpha_blender();
	set_gfx_mode(GFX_AUTODETECT_WINDOWED,SCREEN_LENG_X,SCREEN_LENG_Y,0,0);
	install_keyboard();
    install_mouse();
    BUFFER=create_bitmap(SCREEN_LENG_X,SCREEN_LENG_Y);
    PLAYER_SPRITE_ALIVE=load_tga("img/Player.tga",NULL);
    PLAYER_SPRITE_DEAD=load_tga("img/Explosion.tga",NULL);
    BLOCK_SPRITE=load_tga("img/Block.tga",NULL);
    GREEN_SPIKE_SPRITE=load_tga("img/Green_Spike.tga",NULL);
    RED_SPIKE_SPRITE=load_tga("img/Red_Spike.tga",NULL);
    GATE_SPRITE=load_tga("img/Gate.tga",NULL);
    KEY_SPRITE=load_tga("img/Key.tga",NULL);
    CHECK_POINT_SPRITE_VACANT=load_tga("img/Check_Point_Vacant.tga",NULL);
    CHECK_POINT_SPRITE_OCCUPIED=load_tga("img/Check_Point_Occupied.tga",NULL);
    EXIT_SPRITE=load_tga("img/Exit.tga",NULL);
    CURSOR_SPRITE=load_tga("img/Cursor.tga",NULL);
    blue=new Color(0,0,255);
    red=new Color(255,0,0);
    green=new Color(0,255,0);
    yellow=new Color(255,255,0);
    orange=new Color(255,100,0);
    purple=new Color(155,0,155);
    black=new Color(0,0,0);
    white=new Color(255,255,255);
    m_pressed=false;
    m_released=false;
}
Beispiel #7
0
/* init: init's the element lists and allegro, returns 0 upon success
 * and non-zero otherwise */
int init(void)
{
    /* init allegro */
    if (allegro_init() != 0) {
        printf("failed to initialize...");
        return 1;
    }

    set_color_depth(GFX_DEPTH);
    if (set_gfx_mode(GFX_AUTODETECT_WINDOWED,
                     EDITOR_WIN_W, EDITOR_WIN_H, 0, 0) != 0) {
        set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
        allegro_message("Failed to init a gfxmode.");
        return 1;
    }
    set_window_title("GUNPOWDER MapEditor");

    install_keyboard();
    install_mouse();
    show_mouse(screen);

    vscreen = create_bitmap(EDITOR_WIN_W, EDITOR_WIN_H);
    if (!vscreen) {
        close_program = 1;
    }

    /* init our lists */
    load_tiles();
    load_sprites();

    return 0;
}
Beispiel #8
0
int main()
{
	int ok;
	allegro_init();
	install_timer();

	do {
		set_color_depth(8);
		if (set_gfx_mode (GFX_AUTODETECT, 640, 480, 0, 0) < 0) {
			allegro_message ("Error setting plain graphics mode:\n%s\n", allegro_error);
			return -1;
		}
		
		install_allegro_gl();

		install_keyboard();
		install_mouse();
		ok = setup();
		remove_keyboard();
		remove_mouse();

		if (ok) run_demo();

		remove_allegro_gl();
	} while (ok);

	return 0;
}
Beispiel #9
0
/*  allegInitializations()

Initializes allegro and its associated packages (algif), as well as installing
hardware settings for mouse, keyboard, sound, timers, and the screen.
Autochecks for errors, and displays message and exits(1) on error.

*/
void allegInitializations()
{
	int error = 0;
	srand(time(0));
   error |= allegro_init ();
	algif_init ();

   	set_color_depth (16);
   	//set_gfx_mode(GFX_AUTODETECT_WINDOWED, 900,600,0,0);
   	set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 1024,768,0,0);
   	install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL);
   	install_keyboard ();
   	install_mouse();
   	error |= install_timer();
   	error |= install_int_ex(incrementTimer, BPS_TO_TIMER(60));
   	error |= install_int_ex(incrementUpdateCounter, BPS_TO_TIMER(4));
   	error |= install_int_ex(incrementAnimateCounter, BPS_TO_TIMER(8));
   	error |= install_int_ex(incrementEconomyCounter, BPM_TO_TIMER(60));
   	error |= install_int_ex(incrementFireCounter, BPS_TO_TIMER(12));
	if (error)
	{
		set_gfx_mode(GFX_TEXT, 1024,768,0,0);
		allegro_message("Allegro Failed to Initialize!");
		exit(1);
	}

}
bool Graphic::init()
{
    set_color_depth(m_depth); // profondeur des couleurs 8, 16, 24 ou 32
    set_uformat(U_ASCII); // pour gérer les accents

    allegro_init();

    if (install_mouse() == -1)
    {
        std::cerr << ("Failed to install mouse") << std::endl;
        return false;
    }
    if (install_keyboard() != 0)
    {
        std::cerr << ("Failed to install keyboard") << std::endl;
        return false;
    }
    if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, m_resX, m_resY, 0, 0) != 0)
    {
        std::cerr << ("Failed to enter in graphic mode") << std::endl;
        return false;
    }

    set_keyboard_rate(500, 100);

    show_mouse(screen);

    return this->_imageLoadSprites();
}
CChannelN::CChannelN (TImage * pImg, TImage * pCodeImg, int n_Chan)
{
	m_nCurPosition = 0;
	m_nChan=n_Chan;
	pImage = pImg;
	pCodeImage = pCodeImg;

	m_sSize.x=pImage->ClientRect.right;
	m_sSize.y=pImage->ClientRect.bottom;

	m_nVScale=Form1->VScale();

	m_pnDisplayState = new long[m_sSize.x*m_nChan];
	for (int i = 0; i < m_sSize.x*n_Chan; i++) {  //
		m_pnDisplayState[i] = 0;//5- rand() %10;
	}
	allegro_init();
	set_gdi_color_format();
	install_keyboard();
	install_mouse();
	install_timer();

	bmpCanvas = create_bitmap_ex(32,m_sSize.x,m_sSize.y);
	bmpCodeCanvas  = create_bitmap_ex(32,pCodeImage->ClientRect.Width(),Form1->ImageCode->ClientRect.Height());
	m_nColor=makecol24(0,255,255);

	PenYellow= CreatePen(PS_SOLID,1, 0x0000ff00);
	PenBlack = CreatePen(PS_SOLID,1, 0x00000000);
	PenGray  = CreatePen(PS_SOLID,1, clGray);
	PenRed   = CreatePen(PS_SOLID,1, clRed);
}
Beispiel #12
0
int main(void)
{
   int i;

   allegro_init();
   install_keyboard();
   install_mouse();
   install_timer();

   if (set_gfx_mode(GFX_SAFE, 640, 480, 0, 0) != 0) {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
      exit(EXIT_FAILURE);
   }
   set_palette(desktop_palette);
   gui_fg_color = palette_color[255];
   gui_bg_color = palette_color[16];

   black = makecol(0, 0, 0);
   white = makecol(255, 255, 255);
   red = makecol(255, 0, 0);
   yellow = makecol(255, 255, 0);

   /* Clear key mappings.  */
   for (i = 0; i < 256; i++)
      keycode_to_scancode[i] = -1;

   /* Hook the X keyboard callback.  */
   _xwin_keyboard_callback = get_raw_keycode;

   show_main_dialog();

   return 0;
}
Beispiel #13
0
const char *VideoDriver_Allegro::Start(const char * const *parm)
{
	if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) {
		DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
		return "Failed to set up Allegro";
	}
	_allegro_instance_count++;

	install_timer();
	install_mouse();
	install_keyboard();

#if defined _DEBUG
/* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
 * be triggered, so rereplace the signals and make the debugger useful. */
	signal(SIGABRT, NULL);
	signal(SIGSEGV, NULL);
#endif

#if defined(DOS)
	/* Force DOS builds to ALWAYS use full screen as
	 * it can't do windowed. */
	_fullscreen = true;
#endif

	GetVideoModes();
	if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
		return "Failed to set up Allegro video";
	}
	MarkWholeScreenDirty();
	set_close_button_callback(HandleExitGameRequest);

	return NULL;
}
Beispiel #14
0
void init()
{
 allegro_init();

 set_color_depth(32);
 if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, GFX_W, GFX_H, 0, 0))
  {
   allegro_message("Error: %s.", allegro_error);
   exit(1);
  }

 install_keyboard();
 install_mouse();

 buffer = create_bitmap(SCREEN_W, SCREEN_H);
 zbuffer = create_bitmap_ex(32, SCREEN_W, SCREEN_H);
 texture = load_bitmap("data/wall.bmp", NULL);
 skin = load_bitmap("data/babe_skin.bmp", NULL);
 texture2 = load_bitmap("data/color.bmp", NULL);

 setup_projection(90.0, -1.333, 1.333, -1.0, 1.0, -1.0, 200.0);
 init_renderer(GFX_H);
 bind_color_buffer(buffer);
 bind_zbuffer(zbuffer);
 bind_texture(texture);
}
Beispiel #15
0
void gui_enter()
{
        int x = 1;
        DIALOG_PLAYER *dp;       
        
        while (keypressed()) readkey();
        while (key[KEY_F11]) rest(100);

        gui_update();

        if (curtube != 3 && !mouse_amx) install_mouse();
        
        set_color_depth(dcol);
        show_mouse(screen);
        bemgui[0].x  = (windx / 2) - 36;
        bemgui[0].y  = windy - 8;
        bemgui[0].fg = makecol(255,255,255);
        dp=init_dialog(bemgui, 0);
        while (x && !key[KEY_F11] && !key[KEY_ESC])
        {
                x = update_dialog(dp);
        }
        shutdown_dialog(dp);
        show_mouse(NULL);
        set_color_depth(8);

        if (curtube != 3 && !mouse_amx) remove_mouse();
        
        while (key[KEY_F11]) rest(100);

        video_clearscreen();
}
Beispiel #16
0
Alleg4Display::Alleg4Display(int width, int height, int scale)
  : m_surface(NULL)
  , m_scale(0)
  , m_nativeCursor(kNoCursor)
  , m_restoredWidth(0)
  , m_restoredHeight(0)
{
  unique_display = this;

  if (install_mouse() < 0) throw DisplayCreationException(allegro_error);
  if (install_keyboard() < 0) throw DisplayCreationException(allegro_error);

#ifdef FULLSCREEN_PLATFORM
  set_color_depth(16);        // TODO Try all color depths for fullscreen platforms
#else
  set_color_depth(desktop_color_depth());
#endif

  if (set_gfx_mode(
#ifdef FULLSCREEN_PLATFORM
        GFX_AUTODETECT_FULLSCREEN,
#else
        GFX_AUTODETECT_WINDOWED,
#endif
        width, height, 0, 0) < 0)
    throw DisplayCreationException(allegro_error);

  show_mouse(NULL);
  setScale(scale);

#if _WIN32
  subclass_hwnd((HWND)nativeHandle());
#endif
}
Beispiel #17
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])
		{	
		shape_menu();
		get_mouse_info();
		circle_fill();
		
			if(cursor_x<=110&&cursor_y<=40)
			{
			circle_empty();
			}
			else if(cursor_x<=110&&cursor_y>=60||cursor_y<=120)
			{
			circle_fill();
			}
		}

return 0;   
}
int main() {
    
   /* initialize */
   if (allegro_init() != 0) {
      return 1;
   }
      
   install_keyboard(); 
   install_mouse();
   install_timer();
   
   if (set_gfx_mode(GFX_AUTODETECT, 340, 380, 0, 0) != 0) {
      if (set_gfx_mode(GFX_SAFE, 340, 380, 0, 0) != 0) {
	      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
	      allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
	      return 1;
      }
   }
   
   set_palette(default_palette); 

   /* run the dialog */
   do_dialog(color_builder, -1);

   return 0;
}
Beispiel #19
0
//Main function
int main(){
	//Allegro init
	allegro_init();
	set_color_depth(32); 
	set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1280, 960, 0, 0);
	set_window_title("Chuckie Egg");
	srand(time(NULL));

	//Installations
	install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,0);
	install_timer();
	install_keyboard();
	install_mouse();

	//Close button
    LOCK_FUNCTION(close_button_handler);
    set_close_button_callback(close_button_handler);

	//Show menu
	ce_menu *menu = new ce_menu();
	menu->setupMenu();
	menu->showMenu();
	delete menu;

	allegro_exit();

	return 1;
}
Beispiel #20
0
/* main program */
int main(void)
{
   int c;

   if (allegro_init() != 0)
      return 1;
   install_keyboard();
   install_mouse();
   install_timer();

   if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0) {
      if (set_gfx_mode(GFX_SAFE, 640, 480, 0, 0) != 0) {
	 set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
	 allegro_message("Unable to set any graphic mode\n%s\n",
			 allegro_error);
	 return 1;
      }
   }

   set_palette(desktop_palette);

   input_nodes();
   calc_tangents();

   curviness = ftofix(0.25);
   show_tangents = FALSE;
   show_control_points = FALSE;

   draw_splines();

   for (;;) {
      if (keypressed()) {
	 c = readkey() >> 8;
	 if (c == KEY_ESC)
	    break;
	 else if (c == KEY_UP) {
	    curviness += ftofix(0.05);
	    draw_splines();
	 }
	 else if (c == KEY_DOWN) {
	    curviness -= ftofix(0.05);
	    draw_splines();
	 }
	 else if (c == KEY_SPACE) {
	    walk();
	    draw_splines();
	 }
	 else if (c == KEY_T) {
	    show_tangents = !show_tangents;
	    draw_splines();
	 }
	 else if (c == KEY_C) {
	    show_control_points = !show_control_points;
	    draw_splines();
	 }
      }
   }

   return 0;
}
Beispiel #21
0
int main(int argc, char *argv[])
{
	allegro_init();
	install_allegro_gl();
	install_keyboard();
	install_mouse();
    
    try
    {
        Juego::Inicializar() ;
        
        Juego *juego = new Juego();
        juego->BuclePrincipal();
        delete juego ;    
            
        Juego::Cerrar();        
    }
    catch ( Excepcion &ex )
    {
        set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
        allegro_message("%s\n", ex.GetMensajeDeError().c_str());
    }
    catch ( exception &ex )
    {
        set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
        allegro_message("%s\n", ex.what() );
    }    
}
Beispiel #22
0
void main_setmouse()
{
        if (curtube != 3)
        {
                if (mouse_amx) install_mouse();
                else           remove_mouse();
        }
}
Beispiel #23
0
int cControls::Init()
{
   install_keyboard();
   install_joystick(JOY_TYPE_AUTODETECT);
   install_mouse();

   return 0;
}
Beispiel #24
0
void init() {

    allegro_init();
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, XWIN, YWIN, 0, 0);
    clear_to_color(screen, BGC);
    install_keyboard();
    install_mouse();
    srand(time(NULL));
}
Beispiel #25
0
    /**
     * Initialises the Allegro application. This function creates the global
     * Gui object that can be populated by various examples.
     */
    void init()
    {
        // We simply initialise Allegro as we would do with any Allegro application.
        allegro_init();

        int bpp = desktop_color_depth();
        if (bpp == 0)
        {
            bpp = 16;
        }

        set_color_depth(bpp);

        if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0))
        {
            if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0))
            {
                throw FCN_EXCEPTION("Unable to set graphics mode");
            }
        }

        screenBuffer = create_bitmap(SCREEN_W, SCREEN_H);

        if (screenBuffer == NULL)
        {
            throw FCN_EXCEPTION("Unable to create a screen buffer");
        }

        install_keyboard();
        install_mouse();
        install_timer();

        // Now it's time to initialise the Guichan Allegro back end.

        imageLoader = new fcn::AllegroImageLoader();
        // The ImageLoader Guichan should use needs to be passed to the Image object
        // using a static function.
        fcn::Image::setImageLoader(imageLoader);
        graphics = new fcn::AllegroGraphics();
        // Set the target for the graphics object to be the doublebuffer
        // for the screen. Drawing to the screen directly is not a good
        // idea, as it will produce flicker, unless you use page flipping.
        graphics->setTarget(screenBuffer);
        input = new fcn::AllegroInput();

        // Now we create the Gui object to be used with this Allegro application.
        globals::gui = new fcn::Gui();
        // The Gui object needs a Graphics to be able to draw itself and an Input
        // object to be able to check for user input. In this case we provide the
        // Gui object with Allegro implementations of these objects hence making Guichan
        // able to utilise Allegro.
        globals::gui->setGraphics(graphics);
        globals::gui->setInput(input);
    }
Beispiel #26
0
int main(int argc, char **argv) {
    allegro_init();
    set_color_depth(32);
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, SCRW, SCRH, 0, 0);
    install_keyboard();
    install_mouse();
    install_timer();

    LOCK_VARIABLE(timer);
    LOCK_FUNCTION(timerupdate);
    install_int_ex(timerupdate, BPS_TO_TIMER(TIMER_BPS));

    srand((unsigned)time(NULL));
    set_window_title("Skat");

    LOCK_FUNCTION(close_handler);
    set_close_button_callback(close_handler);

    cards = load_bitmap("images/cards.tga", NULL);
    game.p[0] = &human;
    game.p[1] = &cpu1;
    game.p[2] = &cpu2;
    human.choose_card = human_choose_card;
    cpu1.choose_card = cpu_choose_card;
    cpu2.choose_card = cpu_choose_card;
    human.choose_game = human_choose_game;
    cpu1.choose_game = cpu_choose_game;
    cpu2.choose_game = cpu_choose_game;
    human.reizen = human_reizen;
    cpu1.reizen = cpu_reizen;
    cpu2.reizen = cpu_reizen;
    human.schieben = human_schieben;
    cpu1.schieben = cpu_schieben;
    cpu2.schieben = cpu_schieben;
    human.kontra = human_kontra;
    cpu1.kontra = cpu_kontra;
    cpu2.kontra = cpu_kontra;
    human.name = "Stefan";
    cpu1.name = "Robert";
    cpu2.name = "Thomas";
    human.rtext = cpu1.rtext = cpu2.rtext = NULL;
    human.total_points = 0;
    cpu1.total_points = 0;
    cpu2.total_points = 0;

    enable_hardware_cursor();
    show_mouse(screen);

    buffered_do_dialog(main_dlg, -1);

    destroy_bitmap(cards);
}
Beispiel #27
0
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, 1440, 900, 0, 0);
	if (res != 0) {	allegro_message(allegro_error);	exit(-1);}
	install_timer();
	install_keyboard();
	install_mouse();
}
Beispiel #28
0
void init()
{
    allegro_init();
    
    install_mouse();
    install_keyboard();
    set_color_depth(32);
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
    
    buffer = create_bitmap(SCREEN_W, SCREEN_H);
    
    srand(time(NULL));
}
Beispiel #29
0
  Alleg4Display(int width, int height, int scale)
    : m_surface(NULL)
    , m_scale(0) {
    unique_display = this;

    if (install_mouse() < 0) throw DisplayCreationException(allegro_error);
    if (install_keyboard() < 0) throw DisplayCreationException(allegro_error);

#ifdef FULLSCREEN_PLATFORM
    set_color_depth(16);        // TODO Try all color depths for fullscreen platforms
#else
    set_color_depth(desktop_color_depth());
#endif

    if (set_gfx_mode(
#ifdef FULLSCREEN_PLATFORM
                     GFX_AUTODETECT_FULLSCREEN,
#else
                     GFX_AUTODETECT_WINDOWED,
#endif
                     width, height, 0, 0) < 0)
      throw DisplayCreationException(allegro_error);

    setScale(scale);

    m_queue = new Alleg4EventQueue();

    // Copy the initial queue to the display queue
    {
      base::scoped_lock hold(unique_display_mutex);
      Event ev;
      while (initial_queue.try_pop(ev))
        m_queue->queueEvent(ev);
    }

    // Add a hook to display-switch so when the user returns to the
    // screen it's completelly refreshed/redrawn.
    LOCK_VARIABLE(display_flags);
    LOCK_FUNCTION(display_switch_in_callback);
    set_display_switch_callback(SWITCH_IN, display_switch_in_callback);

#ifdef ALLEGRO4_WITH_RESIZE_PATCH
    // Setup the handler for window-resize events
    set_resize_callback(resize_callback);
#endif

#if WIN32
    subclass_hwnd((HWND)nativeHandle());
#endif
  }
Beispiel #30
0
void GameInit(void)
{

	allegro_init();
   	install_keyboard();
   	install_timer();
	install_mouse();
	clear_keybuf();

   	set_gfx_mode(GFX_AUTODETECT, 320, 240, 0, 0);
   	set_pallete(desktop_pallete);

	return;
}