# HG changeset patch # User Paul Boddie # Date 1381765179 0 # Node ID 448730147f030b45637ae5d5fb7a8f265da1ec93 # Parent e037b6ad9b714c4bc0b5d9fe0ff25ec7958091da Added direction labels for the most central elevation. diff -r e037b6ad9b71 -r 448730147f03 gui.c --- a/gui.c Mon Oct 14 14:36:36 2013 +0000 +++ b/gui.c Mon Oct 14 15:39:39 2013 +0000 @@ -111,21 +111,23 @@ void gui_sky(vectorf *viewx, vectorf *viewy, vectorf *viewz) { double direction, elevation; - int d, e, estart, efinish, dcount; + int d, e, eclosest, estart, efinish, dcount; int16_t lastminx, lastminy, thisminx, thisminy, lastmaxx, lastmaxy, thismaxx, thismaxy; uint32_t colour; vectorf point; + char buffer[5]; direction = vectorf_direction(viewz); elevation = vectorf_elevation(viewz); d = closest(raddeg(direction), SKY_GRID_STEP); + eclosest = closest(raddeg(elevation), SKY_GRID_STEP); /* Plot points between elevations -90 and 90 degrees. */ - estart = max(-90, closest(raddeg(elevation), SKY_GRID_STEP) - (SKY_GRID_STEP * 3)); - efinish = min(90, closest(raddeg(elevation), SKY_GRID_STEP) + (SKY_GRID_STEP * 3)); + estart = max(-90, eclosest - (SKY_GRID_STEP * 3)); + efinish = min(90, eclosest + (SKY_GRID_STEP * 3)); for (e = estart; e <= efinish; e += SKY_GRID_STEP) { @@ -196,6 +198,16 @@ break; } + /* Write labels for the most central set of points. */ + + if (e == eclosest) + { + sprintf(buffer, "%d", d - dcount); + stringRGBA(screen, thisminx, thisminy, buffer, 255, 255, 255, 255); + sprintf(buffer, "%d", d + dcount); + stringRGBA(screen, thismaxx, thismaxy, buffer, 255, 255, 255, 255); + } + lastminx = thisminx; lastminy = thisminy; lastmaxx = thismaxx; lastmaxy = thismaxy; }