Exemple #1
0
/**************************************************************************
...
**************************************************************************/
static Boolean toplevel_work_proc(XtPointer client_data)
{
  /* This will cause the connect dialog to pop-up.
     We do it here so that the main window exists when that happens,
     so that the connect dialog can position itself relative to it. */
  set_client_state(C_S_DISCONNECTED);
  return (True);
}
Exemple #2
0
/*************************************************************************
  Close socket and cleanup.  This one doesn't print a message, so should
  do so before-hand if necessary.
**************************************************************************/
static void close_socket_nomessage(struct connection *pc)
{
  if (with_ggz || in_ggz) {
    remove_ggz_input();
  }
  if (in_ggz) {
    gui_ggz_embed_leave_table();
  }
  connection_common_close(pc);
  remove_net_input();
  popdown_races_dialog(); 
  close_connection_dialog();

  set_client_state(C_S_DISCONNECTED);
}
static int login_rsp(const void* msg)
{
    set_client_state(EAT_TRUE);

    return 0;
}
Exemple #4
0
/**************************************************************************
  The main loop for the UI.  This is called from main(), and when it
  exits the client will exit.
**************************************************************************/
void ui_main(int argc, char *argv[])
{
    SDL_Event __Net_User_Event;
    SDL_Event __GGZ_User_Event;
    SDL_Event __Anim_User_Event;
    SDL_Event __Info_User_Event;
    SDL_Event __Flush_User_Event;
    SDL_Event __pMap_Scroll_User_Event;

    parse_options(argc, argv);

    __Net_User_Event.type = SDL_USEREVENT;
    __Net_User_Event.user.code = NET;
    __Net_User_Event.user.data1 = NULL;
    __Net_User_Event.user.data2 = NULL;
    pNet_User_Event = &__Net_User_Event;

    __GGZ_User_Event.type = SDL_USEREVENT;
    __GGZ_User_Event.user.code = GGZ;
    __GGZ_User_Event.user.data1 = NULL;
    __GGZ_User_Event.user.data2 = NULL;
    pGGZ_User_Event = &__GGZ_User_Event;

    __Anim_User_Event.type = SDL_USEREVENT;
    __Anim_User_Event.user.code = EVENT_ERROR;
    __Anim_User_Event.user.data1 = NULL;
    __Anim_User_Event.user.data2 = NULL;
    pAnim_User_Event = &__Anim_User_Event;

    __Info_User_Event.type = SDL_USEREVENT;
    __Info_User_Event.user.code = SHOW_WIDGET_INFO_LABBEL;
    __Info_User_Event.user.data1 = NULL;
    __Info_User_Event.user.data2 = NULL;
    pInfo_User_Event = &__Info_User_Event;

    __Flush_User_Event.type = SDL_USEREVENT;
    __Flush_User_Event.user.code = FLUSH;
    __Flush_User_Event.user.data1 = NULL;
    __Flush_User_Event.user.data2 = NULL;
    pFlush_User_Event = &__Flush_User_Event;

    __pMap_Scroll_User_Event.type = SDL_USEREVENT;
    __pMap_Scroll_User_Event.user.code = MAP_SCROLL;
    __pMap_Scroll_User_Event.user.data1 = NULL;
    __pMap_Scroll_User_Event.user.data2 = NULL;
    pMap_Scroll_User_Event = &__pMap_Scroll_User_Event;

    is_unit_move_blocked = FALSE;

    SDL_Client_Flags |= (CF_DRAW_PLAYERS_NEUTRAL_STATUS|
                         CF_DRAW_PLAYERS_WAR_STATUS|
                         CF_DRAW_PLAYERS_CEASEFIRE_STATUS|
                         CF_DRAW_PLAYERS_PEACE_STATUS|
                         CF_DRAW_PLAYERS_ALLIANCE_STATUS);

    tileset_init(tileset);
    tileset_load_tiles(tileset);
    tileset_use_prefered_theme(tileset);

    load_cursors();

    callbacks = callback_list_new();

    diplomacy_dialog_init();
    intel_dialog_init();

    clear_double_messages_call();

    setup_auxiliary_tech_icons();

    if (gui_sdl_fullscreen) {
#ifdef SMALL_SCREEN
#ifdef UNDER_CE
        /* set 320x240 fullscreen */
        set_video_mode(gui_sdl_screen.width, gui_sdl_screen.height,
                       SDL_SWSURFACE | SDL_ANYFORMAT | SDL_FULLSCREEN);
#else  /* UNDER_CE */
        /* small screen on desktop -> don't set 320x240 fullscreen mode */
        set_video_mode(gui_sdl_screen.width, gui_sdl_screen.height,
                       SDL_SWSURFACE | SDL_ANYFORMAT);
#endif /* UNDER_CE */
#else  /* SMALL_SCREEN */
        set_video_mode(gui_sdl_screen.width, gui_sdl_screen.height,
                       SDL_SWSURFACE | SDL_ANYFORMAT | SDL_FULLSCREEN);
#endif /* SMALL_SCREEN */

    } else {

#ifdef SMALL_SCREEN
#ifdef UNDER_CE
        set_video_mode(gui_sdl_screen.width, gui_sdl_screen.height,
                       SDL_SWSURFACE | SDL_ANYFORMAT);
#else  /* UNDER_CE */
        set_video_mode(gui_sdl_screen.width, gui_sdl_screen.height,
                       SDL_SWSURFACE | SDL_ANYFORMAT);
#endif /* UNDER_CE */
#else  /* SMALL_SCREEN */
        set_video_mode(gui_sdl_screen.width, gui_sdl_screen.height,
                       SDL_SWSURFACE | SDL_ANYFORMAT);
#endif /* SMALL_SCREEN */

#if 0
        /*
         * call this for other that X enviroments - currently not supported.
         */
        center_main_window_on_screen();
#endif /* 0 */
    }

    /* SDL_WM_SetCaption(_("SDL Client for Freeciv"), _("Freeciv")); */

    /* this need correct Main.screen size */
    init_mapcanvas_and_overview();

    set_client_state(C_S_DISCONNECTED);

    /* Main game loop */
    gui_event_loop(NULL, NULL, main_key_down_handler, main_key_up_handler,
                   main_mouse_button_down_handler, main_mouse_button_up_handler,
                   main_mouse_motion_handler);

}