[Top][All Lists]
[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: |
Tue, 29 Oct 2002 12:32:59 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Matti Katila <address@hidden> 02/10/29 12:32:58
Modified files:
gfx/librenderables: renderables.py
Log message:
Simple version of CalendarPaper.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.113&tr2=1.114&r1=text&r2=text
Patches:
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.113
gzz/gfx/librenderables/renderables.py:1.114
--- gzz/gfx/librenderables/renderables.py:1.113 Thu Oct 24 22:57:18 2002
+++ gzz/gfx/librenderables/renderables.py Tue Oct 29 12:32:58 2002
@@ -1094,6 +1094,104 @@
{
"Type": "1",
+ "Name": "CalendarPaper",
+ "Data": """
+ TextRenderer *r;
+ float linewidth;
+ """,
+ "Params": """
+ Font f,
+ float linewidth
+ """,
+ "ParamCode": """
+ r = f;
+ this->linewidth = linewidth;
+ """,
+ "ExtraClass" : """
+ template<class Coords> struct Vertexer {
+ const Coords &c;
+
+ Vertexer(Coords &c):c(c) {}
+
+ template<class T> void operator()(const T &x, const T &y) {
+ ZVec tmp(x, y, 0);
+ c.vertex(tmp);
+ }
+ };
+ """,
+ "RenderCode" : """
+ if (dbg) cout << "Calendar - linewidth: " << linewidth << "\\n";
+
+ glPushAttrib(GL_ENABLE_BIT);
+ glEnable(GL_BLEND);
+
+ // STILL STATIC MONTH
+ int empty = 2;
+ int days = 30;
+ int weeks = (days + empty) / 7;
+ if ( (days + empty) % 7 != 0) weeks++;
+
+ if (dbg) cout << "w" << weeks << " d " << days << " e " << empty
<< "\\n";
+
+ // Coordinating system
+ ZPt cs;
+
+ glLineWidth(linewidth);
+ glColor3f(0.0, 0.0, 0.0);
+
+ glBegin(GL_LINES);
+
+ // Vertical lines.
+ for (int i=0; i<=7; i++) {
+ cs = coords1.transform( ZPt(i, 0.0, 0.0) );
+ glVertex3f(cs.x, cs.y, cs.z);
+
+ cs = coords1.transform( ZPt(i, weeks, 0.0) );
+ glVertex3f(cs.x, cs.y, cs.z);
+ }
+ // Horizontal lines.
+ for (int i=0; i<=weeks; i++) {
+ cs = coords1.transform( ZPt(0.0, i, 0.0) );
+ glVertex3f(cs.x, cs.y, cs.z);
+
+ cs = coords1.transform( ZPt(7.0, i, 0.0) );
+ glVertex3f(cs.x, cs.y, cs.z);
+ }
+ glEnd();
+
+
+ for (int i=1; i<=days; i++) {
+ int column = (empty + i) % 7;
+ int row = 1 + (empty + i) / 7;
+
+ Vertexer<Coords> v(coords1);
+
+ static char buffer[64];
+ sprintf(buffer, "%i", i);
+
+ float fcol, frow;
+
+ if (i<10) {
+ fcol = column + 0.30;
+ frow = row - 0.25;
+ } else {
+ fcol = column + 0.10;
+ frow = row - 0.25;
+ }
+ Text::renderIter(*r, buffer, buffer+strlen(buffer),
+ fcol , frow, v
+ );
+
+ }
+ glPopAttrib();
+
+ if (dbg) cout << "Calendar done\\n";
+ """
+},
+
+
+{
+ "Type": "1",
"Name": "HorizText",
"Data": """
TextRenderer *r;
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/01
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/01
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/01
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Tuomas J. Lukka, 2002/10/06
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Matti Katila, 2002/10/10
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Matti Katila, 2002/10/14
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Matti Katila, 2002/10/15
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/18
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Janne V. Kujala, 2002/10/18
- [Gzz-commits] gzz/gfx/librenderables renderables.py,
Matti Katila <=
- [Gzz-commits] gzz/gfx/librenderables renderables.py, Matti Katila, 2002/10/30