[Commit] grrobot/src args.c, 1.3, 1.4 args.h, 1.3,
1.4 grr_board_view.c, 1.18, 1.19 grr_icon.c, 1.6,
1.7 grr_icon.h, 1.4, 1.5
Carl Worth
commit at keithp.com
Thu Jun 16 11:11:49 PDT 2005
Committed by: cworth
Update of /local/src/CVS/grrobot/src
In directory home.keithp.com:/tmp/cvs-serv895/src
Modified Files:
args.c args.h grr_board_view.c grr_icon.c grr_icon.h
Log Message:
Remove generated file ltmain.sh
Index: args.c
===================================================================
RCS file: /local/src/CVS/grrobot/src/args.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- args.c 11 Jul 2003 01:11:41 -0000 1.3
+++ args.c 16 Jun 2005 18:11:46 -0000 1.4
@@ -37,14 +37,13 @@
static char args_doc[] = "[file]";
-static struct argp_option options[] = {
- /* name, key, arg, flags, doc */
- {"host", 'h', "HOST", 0, "Host running RR server"},
- {"port", 'p', "PORT", 0, "Port of server"},
- {"user", 'u', "USERNAME", 0, "Username for conection"},
- {"game", 'g', "GAME", 0, "Game to join"},
- {"watch", 'w', 0, 0, "Watch instad of join"},
- { 0 }
+static struct option options[] = {
+ {"host", required_argument, 0, 'h'},
+ {"port", required_argument, 0, 'p'},
+ {"user", required_argument, 0, 'u'},
+ {"game", required_argument, 0, 'g'},
+ {"watch", no_argument, 0, 'w'},
+ {0, 0, 0, 0}
};
static error_t
@@ -100,7 +99,7 @@
args->watch = 0;
args->file = NULL;
-
+ return 0;
return argp_parse (&argp, argc, argv,
ARGP_LONG_ONLY,
NULL, args);
Index: args.h
===================================================================
RCS file: /local/src/CVS/grrobot/src/args.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- args.h 11 Jul 2003 01:11:41 -0000 1.3
+++ args.h 16 Jun 2005 18:11:46 -0000 1.4
@@ -33,7 +33,7 @@
#include <argp.h>
-#define ARGS_HOST_DEFAULT "rr.nickle.org"
+#define ARGS_HOST_DEFAULT "localhost"
#define ARGS_PORT_DEFAULT "5252"
#define ARGS_USER_DEFAULT "grrobot"
#define ARGS_GAME_DEFAULT "game"
Index: grr_board_view.c
===================================================================
RCS file: /local/src/CVS/grrobot/src/grr_board_view.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- grr_board_view.c 25 Dec 2003 21:17:29 -0000 1.18
+++ grr_board_view.c 16 Jun 2005 18:11:46 -0000 1.19
@@ -30,6 +30,7 @@
#include <string.h>
#include <cairo.h>
+#include <cairo-xlib.h>
#include <svg-cairo.h>
#include <gtk/gtkmain.h>
@@ -337,6 +338,8 @@
rr_board_t *board;
Display *dpy;
Drawable drawable;
+ Visual *visual;
+ cairo_surface_t *surface;
cairo_t *xrs;
GdkDrawable *real_drawable;
gint x_off, y_off;
@@ -357,8 +360,11 @@
drawable = gdk_x11_drawable_get_xid (real_drawable);
/* Ignore GTK+ and use Cairo for drawing. */
- xrs = cairo_create ();
- cairo_set_target_drawable (xrs, dpy, drawable);
+ visual = GDK_VISUAL_XVISUAL (gdk_drawable_get_visual (real_drawable));
+ surface = cairo_xlib_surface_create (dpy, drawable, visual,
+ widget->allocation.width,
+ widget->allocation.height);
+ xrs = cairo_create (surface);
new_cell_width = widget->allocation.width / view->board_width;
if (new_cell_width == 0)
@@ -448,23 +454,18 @@
cairo_translate (xrs, i * view->cell_width, j * view->cell_height);
if ((i+j) % 2 == 0)
- grr_icon_draw_predrawn (view->cell1_icon, xrs);
+ grr_icon_draw_predrawn (view->cell1_icon, xrs, 1.0);
else
- grr_icon_draw_predrawn (view->cell2_icon, xrs);
+ grr_icon_draw_predrawn (view->cell2_icon, xrs, 1.0);
- if (target) {
- if (target && target != goal_target) {
- cairo_save (xrs);
- cairo_set_alpha (xrs, 0.25);
- grr_icon_draw_predrawn (view->target_icon[rr_target_idx (target)], xrs);
- cairo_restore (xrs);
- } else {
- grr_icon_draw_predrawn (view->target_icon[rr_target_idx (target)], xrs);
- }
- }
+ if (target)
+ grr_icon_draw_predrawn (view->target_icon[rr_target_idx (target)],
+ xrs,
+ target == goal_target ? 1.0 : 0.25);
if (robot)
- grr_icon_draw_predrawn (view->robot_icon[rr_robot_idx (robot)], xrs);
+ grr_icon_draw_predrawn (view->robot_icon[rr_robot_idx (robot)],
+ xrs, 1.0);
cairo_restore (xrs);
}
@@ -481,7 +482,7 @@
2 * view->cell_width / GRR_SVG_ASSUMED_WIDTH,
2 * view->cell_height / GRR_SVG_ASSUMED_HEIGHT);
cairo_rectangle (xrs, 0, 0, GRR_SVG_ASSUMED_WIDTH, GRR_SVG_ASSUMED_HEIGHT);
- cairo_set_rgb_color (xrs, 1, 1, 1);
+ cairo_set_source_rgb (xrs, 1, 1, 1);
cairo_fill (xrs);
grr_icon_draw (view->target_icon[rr_target_idx (goal_target)], xrs);
cairo_restore (xrs);
@@ -501,8 +502,7 @@
2 * M_PI * (60.0 - view->time) / 60.0 - M_PI_2);
cairo_close_path (xrs);
- cairo_set_rgb_color (xrs, 0.0, 0.0, 0.0);
- cairo_set_alpha (xrs, 0.5);
+ cairo_set_source_rgba (xrs, 0.0, 0.0, 0.0, 0.5);
cairo_fill (xrs);
cairo_restore (xrs);
Index: grr_icon.c
===================================================================
RCS file: /local/src/CVS/grrobot/src/grr_icon.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- grr_icon.c 25 Dec 2003 21:17:29 -0000 1.6
+++ grr_icon.c 16 Jun 2005 18:11:46 -0000 1.7
@@ -237,25 +237,28 @@
void
grr_icon_predraw (grr_icon_t *icon, cairo_t *xrs, int width, int height)
{
+ cairo_t *xrs2;
+
if (icon->surface_width != width || icon->surface_height != height) {
if (icon->surface)
cairo_surface_destroy (icon->surface);
icon->surface_width = width;
icon->surface_height = height;
- icon->surface = cairo_surface_create_similar (cairo_current_target_surface (xrs),
+ icon->surface = cairo_surface_create_similar (cairo_get_target (xrs),
CAIRO_FORMAT_ARGB32,
width, height);
}
- cairo_save (xrs);
- cairo_set_target_surface (xrs, icon->surface);
- grr_icon_draw (icon, xrs);
- cairo_restore (xrs);
+ xrs2 = cairo_create (icon->surface);
+ grr_icon_draw (icon, xrs2);
+ cairo_destroy (xrs2);
}
void
-grr_icon_draw_predrawn (grr_icon_t *icon, cairo_t *xrs)
+grr_icon_draw_predrawn (grr_icon_t *icon, cairo_t *xrs, double alpha)
{
- if (icon->surface)
- cairo_show_surface (xrs, icon->surface, icon->surface_width, icon->surface_height);
+ if (icon->surface) {
+ cairo_set_source_surface (xrs, icon->surface, 0.0, 0.0);
+ cairo_paint (xrs);
+ }
}
Index: grr_icon.h
===================================================================
RCS file: /local/src/CVS/grrobot/src/grr_icon.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- grr_icon.h 25 Dec 2003 21:17:29 -0000 1.4
+++ grr_icon.h 16 Jun 2005 18:11:46 -0000 1.5
@@ -51,7 +51,7 @@
grr_icon_predraw (grr_icon_t *icon, cairo_t *xrs, int width, int height);
void
-grr_icon_draw_predrawn (grr_icon_t *icon, cairo_t *xrs);
+grr_icon_draw_predrawn (grr_icon_t *icon, cairo_t *xrs, double alpha);
char *
grr_icon_robot_name (rr_robot_t robot);
More information about the Commit
mailing list