From 4817c889966a591c823873ff4128b3e02b632ff9 Mon Sep 17 00:00:00 2001 From: steffen Date: Fri, 22 Feb 2013 20:46:26 +0000 Subject: [PATCH] some fixes.. --- Makefile | 2 +- gui/gui.c | 10 ++++----- main/gui_buttons.c | 10 ++++----- main/gui_mainmenu.c | 4 ++-- sdlgl/sdl_gfx.c | 52 +++++++++++++++++++++++++++++++++------------ 5 files changed, 51 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 4f308d8..9b3fdd4 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ sposmroute: do if ! make -C $$i; then \ exit -2; \ fi done - $(CC) -o sposmroute -lgtk -lmapsys -lgui -ldraw -lmain -lbase -Lbase -Lmain -Lgtk -Ldraw -Lgui -Lmapsys `pkg-config --libs gtk+-2.0 libxml-2.0` -lbz2 $(DEBUG) + $(CC) -o sposmroute -lgtk -lmapsys -lgui -ldraw -lmain -lbase -lgui -Lbase -Lmain -Lgtk -Ldraw -Lgui -Lmapsys `pkg-config --libs gtk+-2.0 libxml-2.0` -lbz2 $(DEBUG) cleanapp: rm -rf sposmroute diff --git a/gui/gui.c b/gui/gui.c index 8808aeb..44b881a 100644 --- a/gui/gui.c +++ b/gui/gui.c @@ -1,4 +1,4 @@ -/* $Id: gui.c,v 1.6 2013/02/21 23:07:19 steffen Exp $ */ +/* $Id: gui.c,v 1.7 2013/02/22 20:46:26 steffen Exp $ */ /*************************************************************************** * gui.c * @@ -76,12 +76,12 @@ void gui_draw () { } else { ls.width = 1.0; - ls.c = ls.borderc = color[COLOR_white][3]; + ls.c = ls.borderc = color[COLOR_red][3]; draw_polygonstart (); draw_polygonadd (0, 0); - draw_polygonadd (0, currentwin->h-1); - draw_polygonadd (currentwin->w-1, currentwin->h-1); - draw_polygonadd (currentwin->w-1, 0); + draw_polygonadd (0, currentwin->h); + draw_polygonadd (currentwin->w, currentwin->h); + draw_polygonadd (currentwin->w, 0); draw_polygonfinish (currentwin->screen, ls, color[COLOR_white][0], 1); gfx_draw_text (currentwin->screen, 4, 0, currentwin->title, &color[COLOR_white][3]); } diff --git a/main/gui_buttons.c b/main/gui_buttons.c index e28410f..2d7f331 100644 --- a/main/gui_buttons.c +++ b/main/gui_buttons.c @@ -59,31 +59,31 @@ void gui_buttons_show () { /* add buttons */ if (btn_zoomin == NULL) { - btn_zoomin = gui_button_new (_("+"), 0, 0, 31, 31); + btn_zoomin = gui_button_new (_("+"), 1, 1, 30, 30); btn_zoomin->callback_clicked = (void*)gui_buttons_zoomin; btn_zoomin->callback_draw = (void*)gui_buttons_draw; } if (btn_zoomout == NULL) { - btn_zoomout = gui_button_new (_("-"), 40, 0, 31, 31); + btn_zoomout = gui_button_new (_("-"), 41, 1, 30, 30); btn_zoomout->callback_clicked = (void*)gui_buttons_zoomout; btn_zoomout->callback_draw = (void*)gui_buttons_draw; } if (btn_gps == NULL) { - btn_gps = gui_button_new (_("GPS"), 80, 0, 31, 31); + btn_gps = gui_button_new (_("GPS"), 81, 1, 30, 30); btn_gps->callback_clicked = (void*)gui_buttons_gps; btn_gps->callback_draw = (void*)gui_buttons_draw; } if (btn_menu == NULL) { - btn_menu = gui_button_new (_("M"), 120, 0, 31, 31); + btn_menu = gui_button_new (_("M"), 121, 1, 30, 30); btn_menu->callback_clicked = (void*)gui_buttons_menu; btn_menu->callback_draw = (void*)gui_buttons_draw; } if (btn_fav == NULL) { - btn_fav = gui_button_new (_("F"), 160, 0, 31, 31); + btn_fav = gui_button_new (_("F"), 161, 1, 30, 30); btn_fav->callback_clicked = (void*)gui_buttons_fav; btn_fav->callback_draw = (void*)gui_buttons_draw; } diff --git a/main/gui_mainmenu.c b/main/gui_mainmenu.c index 9bf28b2..3349ae4 100644 --- a/main/gui_mainmenu.c +++ b/main/gui_mainmenu.c @@ -1,4 +1,4 @@ -/* $Id: gui_mainmenu.c,v 1.4 2013/02/21 23:07:19 steffen Exp $ */ +/* $Id: gui_mainmenu.c,v 1.5 2013/02/22 20:46:26 steffen Exp $ */ /*************************************************************************** * gui_mainmenu.c * @@ -48,7 +48,7 @@ GUIButton *mbtn_config= NULL; static GUIWindow wmmenu = {0}; void gui_mainmenu_show () { - if (wmmenu.screen == NULL) gui_window_new (&wmmenu, 175, 200, _("OSMroute Menu")); + if (wmmenu.screen == NULL) gui_window_new (&wmmenu, 200, 200, _("OSMroute Menu")); wmmenu.screen_changed = 1; wmmenu.style = WGUI_S_VCENTER | WGUI_S_HCENTER; diff --git a/sdlgl/sdl_gfx.c b/sdlgl/sdl_gfx.c index 81cc111..8685884 100644 --- a/sdlgl/sdl_gfx.c +++ b/sdlgl/sdl_gfx.c @@ -140,7 +140,7 @@ void gfx_draw_line (struct image *dimg, int x1, int y1, int x2, int y2, struct l gfx_fbo_switch (dimg); if (style.width < 1.0) style.width = 1.0; glLineWidth (style.width); - glColor3f (style.c.c.r, style.c.c.g, style.c.c.b); + glColor4f(style.c.c.r, style.c.c.g, style.c.c.b, 1.0); glBegin (GL_LINES); glVertex2i (x1, y1); glVertex2i (x2, y2); @@ -155,19 +155,25 @@ void gfx_draw_polygon (struct image *dimg, iPoint *p, int pcnt, struct line_styl int i; gfx_fbo_switch (dimg); + if (dimg) { + d_printf ("%d,%d", dimg->width, dimg->height); + } glBegin (GL_POLYGON); glColor4f (c.c.r, c.c.g, c.c.b, 1.0f); - for (i = 0; i < pcnt; i++) + for (i = 0; i < pcnt; i++) { + d_printf (" %d, %d", p[i].x, p[i].y); glVertex2i (p[i].x, p[i].y); + } glEnd (); -// glBegin (GL_LINES); -// d_printf ("line width: %f",style.width); -// glLineWidth (style.width/2.0); -// glColor4f (style.c.c.r, style.c.c.g, style.c.c.b, 1.0f); -// for (i = 0; i < pcnt; i++) -// glVertex2i (p[i].x, p[i].y); -// glEnd (); + if (style.width > 0.0) { + glBegin (GL_LINE_LOOP); + glLineWidth (style.width/2.0); + glColor4f (style.c.c.r, style.c.c.g, style.c.c.b, 1.0f); + for (i = 0; i < pcnt; i++) + glVertex2i (p[i].x, p[i].y); + glEnd (); + } }; @@ -194,11 +200,13 @@ void gfx_draw_img (struct image *dimg, int dx, int dy, int dw, int dh, struct im glBegin (GL_QUADS); glColor4f (1.0f, 1.0f, 1.0f, 1.0f); - fx = (float) sx/(float) simg->width; - fy = (float) sy/(float) simg->height; - fw = (float) dw/(float) simg->width; - fh = (float) dh/(float) simg->height; - + fx = (float) sx/(float) (simg->width); + fy = (float) sy/(float) (simg->height); + fw = (float) dw/(float) (simg->width); + fh = (float) dh/(float) (simg->height); + + d_printf ("%d, %d ---- (%d, %d, %d, %d) --- (%f, %f, %f, %f)", simg->width, simg->height, sx, sy, dw, dh, fx, fy, fw, fh); + glTexCoord2d (fx, fy); glVertex2i (dx, dy); glTexCoord2d (fx, fy+fh); @@ -296,6 +304,22 @@ void gfx_img_free (struct image *img) { void gfx_draw_rect (struct image *dimg, int x1, int y1, int x2, int y2, struct color *c) { + d_printf ("rect..."); +// int i; +// +// gfx_fbo_switch (dimg); +// glBegin (GL_POLYGON); +// glColor4f (c.c.r, c.c.g, c.c.b, 1.0f); +// for (i = 0; i < pcnt; i++) +// glVertex2i (p[i].x, p[i].y); +// glEnd (); +// +// glBegin (GL_LINES); +// glLineWidth (style.width/2.0); +// glColor4f (style.c.c.r, style.c.c.g, style.c.c.b, 1.0f); +// for (i = 0; i < pcnt; i++) +// glVertex2i (p[i].x, p[i].y); +// glEnd (); };