gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx/librenderables renderables.py


From: Matti Katila
Subject: [Gzz-commits] gzz/gfx/librenderables renderables.py
Date: Fri, 01 Nov 2002 04:35:42 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Matti Katila <address@hidden>   02/11/01 04:35:42

Modified files:
        gfx/librenderables: renderables.py 

Log message:
        ÄRF!

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.119&tr2=1.120&r1=text&r2=text

Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.119 
gzz/gfx/librenderables/renderables.py:1.120
--- gzz/gfx/librenderables/renderables.py:1.119 Thu Oct 31 12:34:07 2002
+++ gzz/gfx/librenderables/renderables.py       Fri Nov  1 04:35:41 2002
@@ -1188,12 +1188,36 @@
        template<class Coords> struct Vertexer {
            const Coords &c;
             float scale;
+            ZPt orig;
             
-           Vertexer(Coords &c, float scale) : c(c), scale(scale) { }
+           Vertexer(Coords &c, float scale, ZPt orig) : c(c), scale(scale), 
orig(orig) { }
 
            template<class T> void operator()(const T &x, const T &y) {
+            /*  horiz text 2
+               ZPt tmp(x + 1, y - orig_y + 1, 0);
+                tmp.x *= scale; tmp.y *= scale;
+                tmp.x -= 1; tmp.y += orig_y - 1;
+            */
+            /*
                ZPt tmp(x, y, 0);
                 tmp.x *= scale; tmp.y *= scale;
+                tmp.x += orig.x; tmp.y += orig.y;
+            */
+            
+                ZPt tmp(x, y, 0);
+
+                orig.x *= scale; 
+                orig.y *= scale;
+
+                tmp.x -= orig.x;
+                tmp.y -= orig.y;
+                
+                tmp.x *= scale;
+                tmp.y *= scale;
+
+                tmp.x += orig.x;
+                tmp.y += orig.y;
+
                c.vertex(tmp);
            }
        };
@@ -1263,10 +1287,13 @@
 
             glEnable(GL_TEXTURE_2D);
 
+            ZPt p_text(2,2,0);
+            p_text = coords2.transform(p_text);
+
             float date_shift = shifts[0];
             float date_scale = scales[0];
 
-            Vertexer<Coords> v_date(coords1, date_scale);
+            Vertexer<Coords> v_date(coords1, date_scale, p_text);
 
             for (int i=1; i<=days; i++) {
                 int column = (empty_days + i -1) % 7;
@@ -1292,6 +1319,7 @@
                 
                Text::renderIter(*r_date, buffer, buffer+strlen(buffer), 
                      fcol*(1/date_scale) , frow*(1/date_scale), v_date
+                     //fcol, frow, v_date
                );
 
                 if (column == 6) glColor3f(1.0, 0.0, 0.0);
@@ -1309,7 +1337,7 @@
 
             // Week numbers
             float week_num_scale = scales[1];
-           Vertexer<Coords> v_week_num(coords1, week_num_scale);
+           Vertexer<Coords> v_week_num(coords1, week_num_scale, p_text);
 
             for (int i=0; i<weeks; i++) {
                 static char buffer[64];
@@ -1325,7 +1353,7 @@
 
             // Weekdays
             float weekday_scale = scales[2];
-           Vertexer<Coords> v_weekday(coords1, weekday_scale);
+           Vertexer<Coords> v_weekday(coords1, weekday_scale, p_text);
 
             for (int i=0; i<7; i++) {
                Text::renderIter(*r, d_txt[i].begin(), d_txt[i].end(), 
@@ -1338,7 +1366,7 @@
 
             // Month name
             float month_name_scale = scales[3];
-           Vertexer<Coords> v_month(coords1, month_name_scale);
+           Vertexer<Coords> v_month(coords1, month_name_scale, p_text);
 
             Text::renderIter(*r, m_txt.begin(), m_txt.end(), 
                 (week_num_w+shifts[3])*(1/month_name_scale),  // x




reply via email to

[Prev in Thread] Current Thread [Next in Thread]