- 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 99 95 99 190 190 190
end
button grid 120 120
button grid 120 180
line 10 35 100 35 190 190 190
line 10 75 100 75 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;
int txoff,tyoff;
int anchoreditem;
int x,y;
if ((state == S_SAVING) || (state == S_LOADING) || (state == S_MAPNAMING)) {
@ -3095,10 +3096,7 @@ void drawmap(void) {
fillcol = SDL_MapRGB(buffer->format, map[curmap].bgcol.r,map[curmap].bgcol.g,map[curmap].bgcol.b);
SDL_FillRect(buffer, NULL, fillcol);
/* draw grid if required */
if (grid) {
int x,y;
/* draw lines */
/* always draw grid */
for (x = 0; x < map[curmap].width; x += (gridsize*2)) {
drawline(buffer,x,0,x,map[curmap].height-1, gridcol, (LS_BIGDASH << 8) | 1);
if ((x+gridsize) < map[curmap].width) {
@ -3113,15 +3111,6 @@ void drawmap(void) {
}
}
/*
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) {
printf("DRAWING THINGS \n"); fflush(stdout);
}
@ -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);
}
}
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) {
int style;
/* 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);
strcpy(currentfilename, filename);
/* disable grid when we load a map */
grid = FALSE;
updatewm();
drawmap();
@ -7287,10 +7286,10 @@ void toggleflow(int oid, int otype) {
void togglegrid(void) {
if (grid) {
grid = FALSE;
strcpy(statustext, "Grid mode disabled.");
strcpy(statustext, "Snap-To-Grid mode disabled.");
} else {
grid = TRUE;
strcpy(statustext, "Grid mode enabled.");
strcpy(statustext, "Snap-To-Grid mode enabled.");
}
}