Beispiel #1
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 #2
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;
}
Beispiel #3
0
void on_exit_room (int fd, struct message *msg)
{
	printf ("on_exit_room\n");
	if (get_color () == BLACK)
	{
		struct message msg;
		msg.type = EXIT_ROOM;
		sprintf (msg.buff, "%s", get_room_number ());
		send_message (&msg);

		show_message_dialog (GTK_MESSAGE_ERROR, "游戏已被房主解散");
		hide_room_dialog ();
		show_main_dialog ();
	}
	else
	{
		show_message_dialog (GTK_MESSAGE_ERROR, "对方已经退出房间");
		opp_exit_room ();
	}
}
Beispiel #4
0
void on_login (int fd, struct message *msg)
{
	printf ("on_login\n");
	printf ("msg.type = %d\n", msg->type);
	printf ("msg.buff = %d\n", msg->buff[0]);
	if (msg->buff[0] == 0)
	{
		hide_login_dialog ();
		create_main_dialog ();
		show_main_dialog ();
		msg->type = GET_ROOM_INFO;
		send_message (msg);
		//play_sound ("sound/bg.mp3",0);
	}
	else if (msg->buff[0] == 1)
	{
		show_message_dialog (GTK_MESSAGE_ERROR, "密码错误!");
	}
	else
	{
		show_message_dialog (GTK_MESSAGE_ERROR, "用户不存在!");
	}
}