1093 |
} , |
} , |
1094 |
|
|
1095 |
{ |
{ |
1096 |
"Type": "1", |
"Type": "2", |
1097 |
"Name": "CalendarPaper", |
"Name": "CalendarPaper", |
1098 |
"Data": """ |
"Data": """ |
1099 |
TextRenderer *r_date; |
TextRenderer *r_date; |
1165 |
template<class Coords> struct Vertexer { |
template<class Coords> struct Vertexer { |
1166 |
const Coords &c; |
const Coords &c; |
1167 |
|
|
1168 |
Vertexer(Coords &c):c(c) {} |
float scale; |
1169 |
|
float orig_y; |
1170 |
|
|
1171 |
|
Vertexer(Coords &c, float scale, float orig_y):c(c), scale(scale), orig_y(orig_y) { } |
1172 |
|
|
1173 |
template<class T> void operator()(const T &x, const T &y) { |
template<class T> void operator()(const T &x, const T &y) { |
1174 |
|
/* |
1175 |
ZVec tmp(x, y, 0); |
ZVec tmp(x, y, 0); |
1176 |
c.vertex(tmp); |
c.vertex(tmp); |
1177 |
|
*/ |
1178 |
|
|
1179 |
|
ZPt tmp(x + 1, y - orig_y + 1, 0); |
1180 |
|
tmp.x *= scale; tmp.y *= scale; |
1181 |
|
tmp.x -= 1; tmp.y += orig_y - 1; |
1182 |
|
c.vertex(tmp); |
1183 |
|
|
1184 |
} |
} |
1185 |
}; |
}; |
1186 |
""", |
""", |
1249 |
|
|
1250 |
glEnable(GL_TEXTURE_2D); |
glEnable(GL_TEXTURE_2D); |
1251 |
|
|
1252 |
Vertexer<Coords> v(coords1); |
Vertexer<Coords> v(coords1, 1.0, 1.0); |
1253 |
|
|
1254 |
for (int i=1; i<=days; i++) { |
for (int i=1; i<=days; i++) { |
1255 |
int column = (empty_days + i -1) % 7; |
int column = (empty_days + i -1) % 7; |
1288 |
|
|
1289 |
glColor3f(0.0, 0.0, 0.0); |
glColor3f(0.0, 0.0, 0.0); |
1290 |
|
|
1291 |
|
|
1292 |
|
|
1293 |
|
// Week numbers |
1294 |
for (int i=0; i<weeks; i++) { |
for (int i=0; i<weeks; i++) { |
1295 |
static char buffer[64]; |
static char buffer[64]; |
1296 |
sprintf(buffer, "%i", first_week_number + i); |
sprintf(buffer, "%i", first_week_number + i); |
1301 |
|
|
1302 |
} |
} |
1303 |
|
|
1304 |
|
float scale = 0.3; |
1305 |
|
|
1306 |
|
ZPt box(2,2,0); // compensate for -1/1 coordsys |
1307 |
|
box = coords2.transform(box); |
1308 |
|
|
1309 |
|
cout << box.y << " box\\n"; |
1310 |
|
float y = box.y/2 - (weekday_h)/4; |
1311 |
|
cout << y << "\\n"; |
1312 |
|
Vertexer<Coords> v_weekday(coords1, scale, y/100); |
1313 |
|
|
1314 |
|
// Weekdays |
1315 |
for (int i=0; i<7; i++) { |
for (int i=0; i<7; i++) { |
1316 |
Text::renderIter(*r, d_txt[i].begin(), d_txt[i].end(), |
Text::renderIter(*r, d_txt[i].begin(), d_txt[i].end(), |
1317 |
week_num_w + i, month_name_h + weekday_h -0.1, v |
week_num_w + i, month_name_h + weekday_h -0.1, |
1318 |
|
v_weekday |
1319 |
); |
); |
1320 |
} |
} |
1321 |
|
|
1322 |
|
|
1323 |
Text::renderIter(*r, m_txt.begin(), m_txt.end(), |
Text::renderIter(*r, m_txt.begin(), m_txt.end(), |
1324 |
week_num_w+1.5, month_name_h-0.1, v |
week_num_w+1.5, month_name_h-0.1, v |
1325 |
); |
); |
1326 |
|
|
|
|
|
1327 |
glPopAttrib(); |
glPopAttrib(); |
1328 |
|
|
1329 |
if (dbg) cout << "Calendar done\\n"; |
if (dbg) cout << "Calendar done\\n"; |