GNOME Bugzilla – Bug 97732
using dot line for opened mine
Last modified: 2004-12-22 21:47:04 UTC
Description of Problem: This is a UI enhancement request. I have some trouble to distinguish opened mine (without number in it) from untouched mine, especially in big minefield. I suggest using dot line instead of solid line to draw all opened mines. Additional Information: Index: minefield.c =================================================================== RCS file: /cvs/gnome/gnome-games/gnomine/minefield.c,v retrieving revision 1.34 diff -r1.34 minefield.c 259a260,278 > static void gtk_mine_draw_dot_line(GdkDrawable *drawable, GdkGC *gc, > gint x1, gint y1, gint x2, gint y2) > { > gint x, y; > > if (y1==y2) { /* vertical */ > for (x=x1; x<x2; x+=2) { > gdk_draw_point(drawable, gc, x, y1); > } > return; > } else if (x1==x2) { /* horizontal */ > for (y=y1; y<y2; y+=2) { > gdk_draw_point(drawable, gc, x1, y); > } > } else { > /* oops, this should never happen! */ > } > } > 282c301 < gdk_draw_line(widget->window, /* top */ --- > gtk_mine_draw_dot_line(widget->window, /* top */ 290c309 < gdk_draw_line(widget->window, /* left */ --- > gtk_mine_draw_dot_line(widget->window, /* left */ 297c316 < gdk_draw_line(widget->window, /* right */ --- > gtk_mine_draw_dot_line(widget->window, /* right */ 303c322 < gdk_draw_line(widget->window, /* bottom */ --- > gtk_mine_draw_dot_line(widget->window, /* bottom */ I have tested the above patch in Redhat 8.0.
not a good patch. Better use gdk_draw_points(). :)
This is a fair comment - with aa fonts enabled, it is quite hard to tell the difference between ground that has yet to be sweeped, and ground that has been sweeped but is just empty (ie: it has neither a number indicating the proximity of a mine, or a flag indicating a mine).
A quick thought - shouldn't ground that has been uncovered, but is empty be shaded a slightly darker grey, to give the visual impression of uncovered ground? http://www.mat.bham.ac.uk/R.W.Kaye/minesw/fig3.gif shows how windoze deals with this - uncovered tiles do not have white 3D shading giving a depth illusion and making uncovered tiles appear a darker color.
To be fair, I think the look of windoze minesweeper will be OK. Be ware that the comments (horizontal/vertical) in the previous patch is wrong. Here is the new gtk_mine_draw_dot_line() using gdk_draw_points(). static void gtk_mine_draw_dot_line(GdkDrawable *drawable, GdkGC *gc, gint x1, gint y1, gint x2, gint y2) { gint n, i; GdkPoint *points; if (y1==y2) { /* horizontal */ n = (x2-x1)/2+1; points = malloc(sizeof(*points)*n); if (!points) return; for (i=0; i<n; i++) { points[i].x = x1; points[i].y = y1; x1 += 2; } return; } else if (x1==x2) { /* vertical */ n = (y2-y1)/2+1; points = malloc(sizeof(*points)*n); if (!points) return; for (i=0; i<n; i++) { points[i].x = x1; points[i].y = y1; y1 += 2; } } else { return; /* oops, this should never happen! */ } gdk_draw_points(drawable, gc, points, n); free(points); }
Sorry, bug in the previous function: should remove "return;" before "} else if (x1==x2) { /* vertical */".
As per the terms of my degree course, I'm stuck in Windows XP hell right now - can somebody please check out the patch, and is it possible to post up a screenshot of the patch in action?
Created attachment 12124 [details] screenshot of the dot_line patch
That's certainly an improvement :) Is it possible to thicken the borders a little bit to get a slightly more "3D" effect?
These patches just missed the GNOME 2.2 feature freeze, hopefully we can get something sorted for 2.4 though.
Actually, I think this patch should be fine for the feature freeze. This is more along the lines of a bug fix or cleanup. Ross, feel free to commit if you feel it's necessary.
Cool, I'll do this tonight then I hope.
Hrm. Now that I look at the code, I think it should be cleaned up a bit. Some comments: * In general, you should use g_malloc/g_free in GNOME code. * A better way to draw the points would be to use a stipple on the gc. You can do something like (untested code): #define stipple_width 2 #define stipple_height 2 static char stipple_data[] = { 0x02, 0x01, }; static GdkPixmap *stipple = NULL; if (stipple == NULL) { stipple = gdk_bitmap_create_from_data (NULL, stipple_data, stipple_width, stipple_height); } gdk_gc_set_stipple (gc, stipple); gdk_gc_set_fill (gc, GDK_STIPPLED); gdk_draw_line (...); gdk_gc_set_stipple (gc, NULL); gdk_gc_set_fill (gc, GDK_SOLID); to do this.
I've just applied this suggestion to CVS (should be out in 2.3.2). I used Jonathans stipple suggestion for the actual code, although I had to use an even coarser dash to make it look right (the lighter look from a one-pixel dot still didn't work for some themes). It now looks right using all the themes shipped with gnome, judging by the improvements I don't think there should be any trouble with other themes. Amusingly the "high contrast" theme was the worst for showing no contrast. Closing.
*** Bug 103343 has been marked as a duplicate of this bug. ***