[xiph-commits] r10062 - trunk/planarity
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Sun Sep 25 03:08:46 PDT 2005
Author: xiphmont
Date: 2005-09-25 03:08:44 -0700 (Sun, 25 Sep 2005)
New Revision: 10062
Modified:
trunk/planarity/Makefile
trunk/planarity/dialog_level_icons.c
trunk/planarity/gameboard_draw_text.c
trunk/planarity/version.h
Log:
Makefile bugfix; ass libpng to static target
Improve expose behavior of level dialog renderer; don't repaint all
text every frame, only when the clip region includes it.
Modified: trunk/planarity/Makefile
===================================================================
--- trunk/planarity/Makefile 2005-09-25 09:26:29 UTC (rev 10061)
+++ trunk/planarity/Makefile 2005-09-25 10:08:44 UTC (rev 10062)
@@ -48,6 +48,7 @@
GTK = /usr/local/lib
EXPAT= /usr/lib/libexpat.a
XINERAMA = /usr/X11R6/lib/libXinerama.a
+PNG = /usr/lib/libpng.a
PIXMAN = /usr/lib/libpixman.a
SLIBS = $(GTK)/libgtk-x11-2.0.a \
$(GTK)/libgdk-x11-2.0.a $(GTK)/libgdk_pixbuf-2.0.a \
@@ -57,7 +58,8 @@
$(GTK)/libatk-1.0.a $(GTK)/libgmodule-2.0.a \
$(GTK)/libgobject-2.0.a $(GTK)/libglib-2.0.a \
-lpthread $(EXPAT) -lfreetype -lz -lm -lc \
- -lXext -lXrandr $(XINERAMA) -lXcursor -lX11 $(PIXMAN) -lXft
+ -lXext -lXrandr $(XINERAMA) -lXcursor -lX11 $(PIXMAN)\
+ -lXft $(PNG)
all:
$(MAKE) target CFLAGS="-O2 -ffast-math $(GCF) $(ADD_DEF)"
Modified: trunk/planarity/dialog_level_icons.c
===================================================================
--- trunk/planarity/dialog_level_icons.c 2005-09-25 09:26:29 UTC (rev 10061)
+++ trunk/planarity/dialog_level_icons.c 2005-09-25 10:08:44 UTC (rev 10062)
@@ -27,6 +27,10 @@
static int center_x;
static int level_lit;
static int reset_deployed;
+static GdkRectangle text1;
+static GdkRectangle text2;
+static GdkRectangle text3;
+static GdkRectangle text4;
static void draw_forward_arrow(onelevel *l, cairo_t *c,int fill){
int w = l->w;
@@ -130,7 +134,7 @@
g_source_remove(g->gtk_timer);
g->gtk_timer = g_timeout_add(BUTTON_ANIM_INTERVAL, animate_button_frame, (gpointer)g);
}
-
+
}
static void undeploy_reset_button(Gameboard *g){
@@ -174,6 +178,10 @@
if(levelstate_in_progress())
deploy_reset_button(g);
+ memset(&text1,0,sizeof(text1));
+ memset(&text2,0,sizeof(text2));
+ memset(&text3,0,sizeof(text3));
+ memset(&text4,0,sizeof(text4));
}
void render_level_icons(Gameboard *g, cairo_t *c, int ex,int ey, int ew, int eh){
@@ -229,54 +237,70 @@
cairo_matrix_t ma;
// above text
- snprintf(buffer,160,"Level %d:",get_level_num()+1);
- cairo_select_font_face (c, "Arial",
- CAIRO_FONT_SLANT_NORMAL,
- CAIRO_FONT_WEIGHT_BOLD);
- cairo_matrix_init_scale (&ma, 20.,20.);
- cairo_set_font_matrix (c,&ma);
- cairo_set_source_rgba (c, TEXT_COLOR);
- render_bordertext_centered(c, buffer,w/2,y+45);
-
- cairo_select_font_face (c, "Arial",
- CAIRO_FONT_SLANT_NORMAL,
- CAIRO_FONT_WEIGHT_NORMAL);
- cairo_matrix_init_scale (&ma, 18.,18.);
- cairo_set_font_matrix (c,&ma);
- cairo_set_source_rgba (c, TEXT_COLOR);
- render_bordertext_centered(c, get_level_desc(),w/2,y+70);
-
- if(levelstate_get_hiscore()==0){
- cairo_select_font_face (c, "Arial",
- CAIRO_FONT_SLANT_ITALIC,
- CAIRO_FONT_WEIGHT_NORMAL);
- snprintf(buffer,160,"[not yet completed]");
- }else{
- cairo_select_font_face (c, "Arial",
- CAIRO_FONT_SLANT_NORMAL,
- CAIRO_FONT_WEIGHT_NORMAL);
- snprintf(buffer,160,"level high score: %ld",levelstate_get_hiscore());
+ if(text1.width==0 ||
+ (ey<text1.y+text1.height && ey2>text1.y)){
+
+ snprintf(buffer,160,"Level %d:",get_level_num()+1);
+ cairo_select_font_face (c, "Arial",
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_BOLD);
+ cairo_matrix_init_scale (&ma, 20.,20.);
+ cairo_set_font_matrix (c,&ma);
+ cairo_set_source_rgba (c, TEXT_COLOR);
+ text1=render_bordertext_centered(c, buffer,w/2,y+45);
}
-
- cairo_matrix_init_scale (&ma, 18.,18.);
- cairo_set_font_matrix (c,&ma);
- cairo_set_source_rgba (c, TEXT_COLOR);
- render_bordertext_centered(c, buffer,w/2,y+245);
-
- snprintf(buffer,160,"total score all levels: %ld",levelstate_total_hiscore());
- cairo_select_font_face (c, "Arial",
- CAIRO_FONT_SLANT_NORMAL,
- CAIRO_FONT_WEIGHT_NORMAL);
- cairo_matrix_init_scale (&ma, 18.,18.);
- cairo_set_font_matrix (c,&ma);
- cairo_set_source_rgba (c, TEXT_COLOR);
- render_bordertext_centered(c, buffer,w/2,y+265);
+ if(text2.width==0 ||
+ (ey<text2.y+text2.height && ey2>text2.y)){
+ cairo_select_font_face (c, "Arial",
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_NORMAL);
+ cairo_matrix_init_scale (&ma, 18.,18.);
+ cairo_set_font_matrix (c,&ma);
+ cairo_set_source_rgba (c, TEXT_COLOR);
+ text2=render_bordertext_centered(c, get_level_desc(),w/2,y+70);
+ }
+ if(text3.width==0 ||
+ (ey<text3.y+text3.height && ey2>text3.y)){
+
+ if(levelstate_get_hiscore()==0){
+ cairo_select_font_face (c, "Arial",
+ CAIRO_FONT_SLANT_ITALIC,
+ CAIRO_FONT_WEIGHT_NORMAL);
+ snprintf(buffer,160,"[not yet completed]");
+ }else{
+ cairo_select_font_face (c, "Arial",
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_NORMAL);
+ snprintf(buffer,160,"level high score: %ld",levelstate_get_hiscore());
+ }
+
+ cairo_matrix_init_scale (&ma, 18.,18.);
+ cairo_set_font_matrix (c,&ma);
+ cairo_set_source_rgba (c, TEXT_COLOR);
+ text3=render_bordertext_centered(c, buffer,w/2,y+245);
+ }
+ if(text4.width==0 ||
+ (ey<text4.y+text4.height && ey2>text4.y)){
-
- }
+ snprintf(buffer,160,"total score all levels: %ld",levelstate_total_hiscore());
+
+ cairo_select_font_face (c, "Arial",
+ CAIRO_FONT_SLANT_NORMAL,
+ CAIRO_FONT_WEIGHT_NORMAL);
+ cairo_matrix_init_scale (&ma, 18.,18.);
+ cairo_set_font_matrix (c,&ma);
+ cairo_set_source_rgba (c, TEXT_COLOR);
+ text4=render_bordertext_centered(c, buffer,w/2,y+265);
+ }
+ }else{
+ memset(&text1,0,sizeof(text1));
+ memset(&text2,0,sizeof(text2));
+ memset(&text3,0,sizeof(text3));
+ memset(&text4,0,sizeof(text4));
+ }
}
}
Modified: trunk/planarity/gameboard_draw_text.c
===================================================================
--- trunk/planarity/gameboard_draw_text.c 2005-09-25 09:26:29 UTC (rev 10061)
+++ trunk/planarity/gameboard_draw_text.c 2005-09-25 10:08:44 UTC (rev 10062)
@@ -12,12 +12,12 @@
cairo_text_extents (c, s, &ex);
- r.x=x-(ex.width/2)-ex.x_bearing;
- r.y=y-(ex.height/2)-ex.y_bearing;
+ r.x=x-(ex.width/2);
+ r.y=y-(ex.height/2);
r.width=ex.width;
r.height=ex.height;
- cairo_move_to (c, r.x, r.y);
+ cairo_move_to (c, r.x-ex.x_bearing, r.y-ex.y_bearing);
cairo_show_text (c, s);
return r;
@@ -29,13 +29,13 @@
cairo_text_extents (c, s, &ex);
- r.x=x-(ex.width/2)-ex.x_bearing-2;
- r.y=y-(ex.height/2)-ex.y_bearing-2;
+ r.x=x-(ex.width/2)-2;
+ r.y=y-(ex.height/2)-2;
r.width=ex.width+5;
r.height=ex.height+5;
cairo_save(c);
- cairo_move_to (c, r.x+2, r.y+2 );
+ cairo_move_to (c, r.x-ex.x_bearing+2, r.y-ex.y_bearing+2 );
cairo_set_line_width(c,3);
cairo_set_source_rgba(c,1,1,1,.9);
cairo_text_path (c, s);
Modified: trunk/planarity/version.h
===================================================================
--- trunk/planarity/version.h 2005-09-25 09:26:29 UTC (rev 10061)
+++ trunk/planarity/version.h 2005-09-25 10:08:44 UTC (rev 10062)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Sun Sep 25 05:26:10 EDT 2005] */
+/* DO NOT EDIT: Automated versioning hack [Sun Sep 25 06:06:53 EDT 2005] */
More information about the commits
mailing list