Re: [Freeciv-Dev] grid lines
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, 17 Mar 1999, Trent Piepho wrote:
> I though of several different ways of making grid lines, but I'm not sure
> which one I like best.
>
> So here is a patch which demonstrates them. It's not finished, it doesn't let
> you turn them on or off. Every time you scroll the map, the line type will
> change. First it's dashed black lines, then solid xor lines, dashed xor
> lines, and finally solid black lines.
>
> I'm thinking either dashed black lines or solid xor lines.
>
+ for(x=tile_x; x<=tile_x+width; x++)
+ XDrawLine(display, map_canvas_store, civ_gc,
+ x*NORMAL_TILE_WIDTH, tile_y*NORMAL_TILE_HEIGHT,
+ x*NORMAL_TILE_WIDTH, (tile_y+height)*NORMAL_TILE_HEIGHT);
+ for(y=tile_y; y<=tile_y+height; y++)
+ XDrawLine(display, map_canvas_store, civ_gc,
+ tile_x*NORMAL_TILE_WIDTH, y*NORMAL_TILE_HEIGHT,
+ (tile_x+width)*NORMAL_TILE_WIDTH, y*NORMAL_TILE_HEIGHT);
Why are you doing that x*NORMAL_TILE_WIDTH stuff over and over again?
Most things can be precalculated...
n_tile_x *= NORMAL_TILE_WIDTH;
n_width *= NORMAL_TILE_WIDTH;
n_tile_y *= NORMAL_TILE_HEIGHT;
n_height *= NORMAL_TILE_HEIGHT;
for(x=tile_x; x<=n_tile_x+n_width; x+=NORMAL_TILE_WIDTH)
XDrawLine(display, map_canvas_store, civ_gc,
x, n_tile_y,
x, n_tile_y+n_height);
for(y=tile_y; y<=n_tile_y+n_height; y+=NORMAL_TILE_HEIGHT)
XDrawLine(display, map_canvas_store, civ_gc,
n_tile_x, y,
n_tile_x+n_width, y);
---
Vasco Alexandre da Silva Costa, student @ Instituto Superior Tecnico,
Technical University of Lisbon - Software & Computer Engineering
|
|