- Now always showing grid

- Added red/green light on grid button to show status
This commit is contained in:
Rob Pearce 2005-11-18 08:57:26 +00:00
parent c91d52f869
commit 07ed12904b
3 changed files with 27 additions and 28 deletions

View File

@ -69,7 +69,7 @@ line 60 74 95 74 190 190 190
line 60 86 95 86 190 190 190 line 60 86 95 86 190 190 190
line 60 99 95 99 190 190 190 line 60 99 95 99 190 190 190
end end
button grid 120 120 button grid 120 180
line 10 35 100 35 190 190 190 line 10 35 100 35 190 190 190
line 10 75 100 75 190 190 190 line 10 75 100 75 190 190 190
line 35 10 35 100 190 190 190 line 35 10 35 100 190 190 190

Binary file not shown.

View File

@ -3064,6 +3064,7 @@ void drawmap(void) {
Uint32 fillcol; Uint32 fillcol;
int txoff,tyoff; int txoff,tyoff;
int anchoreditem; int anchoreditem;
int x,y;
if ((state == S_SAVING) || (state == S_LOADING) || (state == S_MAPNAMING)) { if ((state == S_SAVING) || (state == S_LOADING) || (state == S_MAPNAMING)) {
@ -3095,31 +3096,19 @@ void drawmap(void) {
fillcol = SDL_MapRGB(buffer->format, map[curmap].bgcol.r,map[curmap].bgcol.g,map[curmap].bgcol.b); fillcol = SDL_MapRGB(buffer->format, map[curmap].bgcol.r,map[curmap].bgcol.g,map[curmap].bgcol.b);
SDL_FillRect(buffer, NULL, fillcol); SDL_FillRect(buffer, NULL, fillcol);
/* draw grid if required */ /* always draw grid */
if (grid) { for (x = 0; x < map[curmap].width; x += (gridsize*2)) {
int x,y; drawline(buffer,x,0,x,map[curmap].height-1, gridcol, (LS_BIGDASH << 8) | 1);
/* draw lines */ if ((x+gridsize) < map[curmap].width) {
for (x = 0; x < map[curmap].width; x += (gridsize*2)) { drawline(buffer,x+gridsize,0,x+gridsize,map[curmap].height-1, gridcol, (LS_DOTTED << 8) | 1);
drawline(buffer,x,0,x,map[curmap].height-1, gridcol, (LS_BIGDASH << 8) | 1);
if ((x+gridsize) < map[curmap].width) {
drawline(buffer,x+gridsize,0,x+gridsize,map[curmap].height-1, gridcol, (LS_DOTTED << 8) | 1);
}
} }
}
for (y = 0; y < map[curmap].height; y += (gridsize*2)) { for (y = 0; y < map[curmap].height; y += (gridsize*2)) {
drawline(buffer,0,y,map[curmap].width-1, y,gridcol, (LS_BIGDASH << 8) | 1); drawline(buffer,0,y,map[curmap].width-1, y,gridcol, (LS_BIGDASH << 8) | 1);
if ((y+gridsize) < map[curmap].height) { if ((y+gridsize) < map[curmap].height) {
drawline(buffer,0,y+gridsize,map[curmap].width-1, y+gridsize,gridcol, (LS_DOTTED << 8) | 1); drawline(buffer,0,y+gridsize,map[curmap].width-1, y+gridsize,gridcol, (LS_DOTTED << 8) | 1);
}
} }
/*
for (y = 0; y < map[curmap].height; y += gridsize) {
for (x = 0; x < map[curmap].width; x += gridsize) {
drawpixel(buffer, x, y, gridcol);
}
}
*/
} }
if (testing) { if (testing) {
@ -3966,6 +3955,19 @@ void drawtoolbox(void) {
drawline(screen, area.x+(area.w/2)+3, area.y+(area.h/2)-3-4, area.x+(area.w/2)-3, area.y+(area.h/2)+3-4,white,1); drawline(screen, area.x+(area.w/2)+3, area.y+(area.h/2)-3-4, area.x+(area.w/2)-3, area.y+(area.h/2)+3-4,white,1);
} }
} }
if (i == TB_GRID) {
if (grid) {
drawbox(screen, area.x+5,area.y+20,area.x + area.w - 15, area.y + area.h - 5, black, &black);
if (state == S_DRAWFLOW) {
drawbox(screen, area.x+area.w - 14,area.y+20,area.x + area.w - 7, area.y + area.h - 5, yellow, &yellow);
} else {
drawbox(screen, area.x+area.w - 14,area.y+20,area.x + area.w - 7, area.y + area.h - 5, green, &green);
}
} else {
drawbox(screen, area.x+5,area.y+20,area.x + area.w - 15, area.y + area.h - 5, red, &red);
drawbox(screen, area.x+area.w - 14,area.y+20,area.x + area.w - 7, area.y + area.h - 5, black, &black);
}
}
if (i == TB_LINESTYLE) { if (i == TB_LINESTYLE) {
int style; int style;
/* show line thickness */ /* show line thickness */
@ -5169,9 +5171,6 @@ int loadmap(void) {
sprintf(statustext,"Successfully loaded map from '%s' (%d maps). [file version: '%s']\n",filename,nummaps, vers); sprintf(statustext,"Successfully loaded map from '%s' (%d maps). [file version: '%s']\n",filename,nummaps, vers);
strcpy(currentfilename, filename); strcpy(currentfilename, filename);
/* disable grid when we load a map */
grid = FALSE;
updatewm(); updatewm();
drawmap(); drawmap();
@ -7287,10 +7286,10 @@ void toggleflow(int oid, int otype) {
void togglegrid(void) { void togglegrid(void) {
if (grid) { if (grid) {
grid = FALSE; grid = FALSE;
strcpy(statustext, "Grid mode disabled."); strcpy(statustext, "Snap-To-Grid mode disabled.");
} else { } else {
grid = TRUE; grid = TRUE;
strcpy(statustext, "Grid mode enabled."); strcpy(statustext, "Snap-To-Grid mode enabled.");
} }
} }