/************************************************************************** ... **************************************************************************/ void map_canvas_expose(Widget w, XEvent *event, Region exposed, void *client_data) { Dimension width, height; bool map_resized; XtVaGetValues(w, XtNwidth, &width, XtNheight, &height, NULL); map_resized = map_canvas_resized(width, height); if (!can_client_change_view()) { if (!intro_gfx_sprite) { load_intro_gfx(); } if (height != scaled_intro_pixmap_height || width != scaled_intro_pixmap_width) { if (scaled_intro_pixmap) { XFreePixmap(display, scaled_intro_pixmap); } scaled_intro_pixmap=x_scale_pixmap(intro_gfx_sprite->pixmap, intro_gfx_sprite->width, intro_gfx_sprite->height, width, height, root_window); scaled_intro_pixmap_width=width; scaled_intro_pixmap_height=height; } if(scaled_intro_pixmap) XCopyArea(display, scaled_intro_pixmap, XtWindow(map_canvas), civ_gc, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height, event->xexpose.x, event->xexpose.y); return; } if(scaled_intro_pixmap) { XFreePixmap(display, scaled_intro_pixmap); scaled_intro_pixmap=0; scaled_intro_pixmap_height=0; } if (map_exists() && !map_resized) { /* First we mark the area to be updated as dirty. Then we unqueue * any pending updates, to make sure only the most up-to-date data * is written (otherwise drawing bugs happen when old data is copied * to screen). Then we draw all changed areas to the screen. */ unqueue_mapview_updates(FALSE); XCopyArea(display, mapview.store->pixmap, XtWindow(map_canvas), civ_gc, event->xexpose.x, event->xexpose.y, event->xexpose.width, event->xexpose.height, event->xexpose.x, event->xexpose.y); } refresh_overview_canvas(); }
/************************************************************************** ... **************************************************************************/ gboolean overview_canvas_expose(GtkWidget *w, GdkEventExpose *ev, gpointer data) { if (!can_client_change_view()) { if (radar_gfx_sprite) { gdk_draw_drawable(overview_canvas->window, civ_gc, radar_gfx_sprite->pixmap, ev->area.x, ev->area.y, ev->area.x, ev->area.y, ev->area.width, ev->area.height); } return TRUE; } refresh_overview_canvas(); return TRUE; }
/************************************************************************** ... **************************************************************************/ void handle_game_state(struct packet_generic_integer *packet) { if(client_state==CLIENT_SELECT_RACE_STATE && packet->value==CLIENT_GAME_RUNNING_STATE) { popdown_races_dialog(); } client_state=packet->value; if(client_state==CLIENT_GAME_RUNNING_STATE) { refresh_overview_canvas(); refresh_overview_viewrect(); player_set_unit_focus_status(game.player_ptr); update_unit_focus(); update_unit_info_label(get_unit_in_focus()); if(get_unit_in_focus()) center_tile_mapcanvas(get_unit_in_focus()->x, get_unit_in_focus()->y); } }