[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx librenderables/renderables.py demo/cale...
From: |
Matti Katila |
Subject: |
[Gzz-commits] gzz/gfx librenderables/renderables.py demo/cale... |
Date: |
Thu, 31 Oct 2002 07:27:04 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 02/10/31 07:27:04
Modified files:
gfx/librenderables: renderables.py
gfx/demo : calendarvobtest.py
Log message:
scaleing problem..
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.117&tr2=1.118&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/calendarvobtest.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/calendarvobtest.py
diff -u gzz/gfx/demo/calendarvobtest.py:1.5 gzz/gfx/demo/calendarvobtest.py:1.6
--- gzz/gfx/demo/calendarvobtest.py:1.5 Wed Oct 30 10:36:46 2002
+++ gzz/gfx/demo/calendarvobtest.py Thu Oct 31 07:27:03 2002
@@ -19,11 +19,13 @@
putnoc(vs, background(self.bgcolor))
cs_home = vs.coords.affineCoordsys(0,0,
- w/2 + self.tx*self.scale,
- h/2 + self.ty*self.scale,
- w*self.scale, 0,0, h*self.scale);
+ w/2 + self.tx*self.scale,
+ h/2 + self.ty*self.scale,
+ w*self.scale, 0,0, h*self.scale);
vs.matcher.add(cs_home, "cs_koti")
+
+
# these don't efect
gzz.vob.CalendarVob.setStatics(style_date, style_n, 3)
@@ -34,7 +36,9 @@
for i in range(1, 13):
cs_cal = vs.coords.affineCoordsys(cs_home , 0, 0 , i*9, 1,0,0,1)
vs.matcher.add(cs_cal, "cs_cal"+str(i))
- vs.map.put(gzz.vob.CalendarVob(2002, i), cs_cal)
+ cs_text = vs.coords.affineCoordsys(cs_home, 0, 0, i*9, 1.0, 0, 0,
1.0)
+ vs.matcher.add(cs_text, "cs_text"+str(i))
+ vs.map.put(gzz.vob.CalendarVob(2002, i), cs_cal, cs_text)
# one test vob
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.117
gzz/gfx/librenderables/renderables.py:1.118
--- gzz/gfx/librenderables/renderables.py:1.117 Wed Oct 30 10:36:46 2002
+++ gzz/gfx/librenderables/renderables.py Thu Oct 31 07:27:03 2002
@@ -1093,7 +1093,7 @@
} ,
{
- "Type": "1",
+ "Type": "2",
"Name": "CalendarPaper",
"Data": """
TextRenderer *r_date;
@@ -1165,11 +1165,22 @@
template<class Coords> struct Vertexer {
const Coords &c;
- Vertexer(Coords &c):c(c) {}
+ float scale;
+ float orig_y;
+
+ Vertexer(Coords &c, float scale, float orig_y):c(c), scale(scale),
orig_y(orig_y) { }
template<class T> void operator()(const T &x, const T &y) {
+ /*
ZVec tmp(x, y, 0);
c.vertex(tmp);
+ */
+
+ ZPt tmp(x + 1, y - orig_y + 1, 0);
+ tmp.x *= scale; tmp.y *= scale;
+ tmp.x -= 1; tmp.y += orig_y - 1;
+ c.vertex(tmp);
+
}
};
""",
@@ -1238,7 +1249,7 @@
glEnable(GL_TEXTURE_2D);
- Vertexer<Coords> v(coords1);
+ Vertexer<Coords> v(coords1, 1.0, 1.0);
for (int i=1; i<=days; i++) {
int column = (empty_days + i -1) % 7;
@@ -1277,6 +1288,9 @@
glColor3f(0.0, 0.0, 0.0);
+
+
+ // Week numbers
for (int i=0; i<weeks; i++) {
static char buffer[64];
sprintf(buffer, "%i", first_week_number + i);
@@ -1287,16 +1301,28 @@
}
+ float scale = 0.3;
+
+ ZPt box(2,2,0); // compensate for -1/1 coordsys
+ box = coords2.transform(box);
+
+ cout << box.y << " box\\n";
+ float y = box.y/2 - (weekday_h)/4;
+ cout << y << "\\n";
+ Vertexer<Coords> v_weekday(coords1, scale, y/100);
+
+ // Weekdays
for (int i=0; i<7; i++) {
Text::renderIter(*r, d_txt[i].begin(), d_txt[i].end(),
- week_num_w + i, month_name_h + weekday_h -0.1, v
+ week_num_w + i, month_name_h + weekday_h -0.1,
+ v_weekday
);
}
+
Text::renderIter(*r, m_txt.begin(), m_txt.end(),
week_num_w+1.5, month_name_h-0.1, v
);
-
glPopAttrib();