diff options
author | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-05-10 15:00:57 +0000 |
---|---|---|
committer | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-05-10 15:00:57 +0000 |
commit | 502626eba0a3e8a5e1b01ec178434cad49244611 (patch) | |
tree | 1c9fb4a2eb51615baefc784f190de0f87e952a0b /src | |
parent | 1a0973fe479aa8a142500cb52436166a41c9e6b0 (diff) |
draw nice flags
draw nice flags
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.cxx | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index b09ae81..d789414 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -1,5 +1,5 @@ // -// "$Id: GipfelWidget.cxx,v 1.25 2005/05/08 18:02:38 hofmann Exp $" +// "$Id: GipfelWidget.cxx,v 1.26 2005/05/10 17:00:57 hofmann Exp $" // // PSEditWidget routines. // @@ -46,7 +46,7 @@ static Fl_Menu_Item menuitems[] = { {0}, { 0 } }; - + GipfelWidget::GipfelWidget(int X,int Y,int W, int H): Fl_Widget(X, Y, W, H) { int i; @@ -92,6 +92,21 @@ GipfelWidget::set_viewpoint(const char *pos) { return pan->set_viewpoint(pos); } +static void +draw_flag(int x, int y, char *s) { + Fl_Color c = fl_color(); + + fl_polygon(x, y - 10, x, y - 20, x + 10, y - 15); + fl_yxline(x, y, y - 10); + + + if (s) { + fl_color(FL_WHITE); + fl_draw(s, x , y - 12); + fl_color(c); + } +} + void GipfelWidget::draw() { Hills *mnts; @@ -112,13 +127,12 @@ GipfelWidget::draw() { for (i=0; i<mnts->get_num(); i++) { m = mnts->get(i); - if (m == m1 || m == m2) { + if (m == m1) { + fl_color(FL_RED); + draw_flag(center_x + m->x + x(), center_y + m->y + y(), "1"); + } else if (m == m2) { fl_color(FL_RED); - fl_polygon(center_x + m->x + x(), center_y + m->y + y() - 10, - center_x + m->x + x(), center_y + m->y + y() - 20, - center_x + m->x + x() + 10, center_y + m->y + y() - 15); - fl_yxline(center_x + m->x + x(), center_y + m->y + y(), - center_y + m->y + y() - 10); + draw_flag(center_x + m->x + x(), center_y + m->y + y(), "2"); } else { fl_color(FL_BLACK); } @@ -137,6 +151,7 @@ GipfelWidget::draw() { fl_color(FL_GREEN); fl_xyline(center_x + m->x + x() - 3, center_y + m->y + y(), center_x + m->x + x() + 3); fl_yxline(center_x + m->x + x(), center_y + m->y + y() - 3, center_y + m->y + y() + 3); + draw_flag(center_x + m->x + x(), center_y + m->y + y(), NULL); } fl_pop_clip(); |