1107 |
unicodecharvector d_txt[7]; |
unicodecharvector d_txt[7]; |
1108 |
unicodecharvector m_txt; |
unicodecharvector m_txt; |
1109 |
|
|
1110 |
|
float scales[4]; |
1111 |
|
float shifts[4]; |
1112 |
|
|
1113 |
float week_num_w; |
float week_num_w; |
1114 |
float weekday_h; |
float weekday_h; |
1115 |
float month_name_h; |
float month_name_h; |
1132 |
String t6, |
String t6, |
1133 |
String t7, |
String t7, |
1134 |
String t8, |
String t8, |
1135 |
|
|
1136 |
|
float sc0, |
1137 |
|
float sc1, |
1138 |
|
float sc2, |
1139 |
|
float sc3, |
1140 |
|
|
1141 |
|
float sh0, |
1142 |
|
float sh1, |
1143 |
|
float sh2, |
1144 |
|
float sh3, |
1145 |
|
|
1146 |
float week_num_w, |
float week_num_w, |
1147 |
float weekday_h, |
float weekday_h, |
1161 |
d_txt[6] = t7; |
d_txt[6] = t7; |
1162 |
|
|
1163 |
m_txt = t8; |
m_txt = t8; |
1164 |
|
|
1165 |
|
this->scales[0] = sc0; |
1166 |
|
this->scales[1] = sc1; |
1167 |
|
this->scales[2] = sc2; |
1168 |
|
this->scales[3] = sc3; |
1169 |
|
|
1170 |
|
this->shifts[0] = sh0; |
1171 |
|
this->shifts[1] = sh1; |
1172 |
|
this->shifts[2] = sh2; |
1173 |
|
this->shifts[3] = sh3; |
1174 |
|
|
1175 |
this->linewidth = linewidth; |
this->linewidth = linewidth; |
1176 |
|
|
1187 |
"ExtraClass" : """ |
"ExtraClass" : """ |
1188 |
template<class Coords> struct Vertexer { |
template<class Coords> struct Vertexer { |
1189 |
const Coords &c; |
const Coords &c; |
|
|
|
1190 |
float scale; |
float scale; |
1191 |
float orig_y; |
|
1192 |
|
Vertexer(Coords &c, float scale) : c(c), scale(scale) { } |
|
Vertexer(Coords &c, float scale, float orig_y):c(c), scale(scale), orig_y(orig_y) { } |
|
1193 |
|
|
1194 |
template<class T> void operator()(const T &x, const T &y) { |
template<class T> void operator()(const T &x, const T &y) { |
1195 |
/* |
ZPt tmp(x, y, 0); |
|
ZVec tmp(x, y, 0); |
|
|
c.vertex(tmp); |
|
|
*/ |
|
|
|
|
|
ZPt tmp(x + 1, y - orig_y + 1, 0); |
|
1196 |
tmp.x *= scale; tmp.y *= scale; |
tmp.x *= scale; tmp.y *= scale; |
|
tmp.x -= 1; tmp.y += orig_y - 1; |
|
1197 |
c.vertex(tmp); |
c.vertex(tmp); |
|
|
|
1198 |
} |
} |
1199 |
}; |
}; |
1200 |
""", |
""", |
1263 |
|
|
1264 |
glEnable(GL_TEXTURE_2D); |
glEnable(GL_TEXTURE_2D); |
1265 |
|
|
1266 |
Vertexer<Coords> v(coords1, 1.0, 1.0); |
float date_shift = shifts[0]; |
1267 |
|
float date_scale = scales[0]; |
1268 |
|
|
1269 |
|
Vertexer<Coords> v_date(coords1, date_scale); |
1270 |
|
|
1271 |
for (int i=1; i<=days; i++) { |
for (int i=1; i<=days; i++) { |
1272 |
int column = (empty_days + i -1) % 7; |
int column = (empty_days + i -1) % 7; |
1281 |
frow = weekday_h + month_name_h; |
frow = weekday_h + month_name_h; |
1282 |
|
|
1283 |
if (i<10) { |
if (i<10) { |
1284 |
fcol += column + 0.30; |
fcol += column + date_shift + 0.20; |
1285 |
frow += row - 0.25; |
frow += row - date_shift - 0.15; |
1286 |
} else { |
} else { |
1287 |
fcol += column + 0.10; |
fcol += column + date_shift; |
1288 |
frow += row - 0.25; |
frow += row - date_shift - 0.15; |
1289 |
} |
} |
1290 |
|
|
1291 |
glColor3f(1.0, 1.0, 1.0); |
glColor3f(1.0, 1.0, 1.0); |
1292 |
|
|
1293 |
Text::renderIter(*r_date, buffer, buffer+strlen(buffer), |
Text::renderIter(*r_date, buffer, buffer+strlen(buffer), |
1294 |
fcol , frow, v |
fcol*(1/date_scale) , frow*(1/date_scale), v_date |
1295 |
); |
); |
1296 |
|
|
1297 |
if (column == 6) glColor3f(1.0, 0.0, 0.0); |
if (column == 6) glColor3f(1.0, 0.0, 0.0); |
1298 |
else glColor3f(0.0, 0.0, 0.0); |
else glColor3f(0.0, 0.0, 0.0); |
1299 |
|
|
1300 |
Text::renderIter(*r_date, buffer, buffer+strlen(buffer), |
Text::renderIter(*r_date, buffer, buffer+strlen(buffer), |
1301 |
fcol + 0.03 , frow + 0.03, v |
(fcol + 0.03)*(1/date_scale), |
1302 |
|
(frow + 0.03)*(1/date_scale), |
1303 |
|
v_date |
1304 |
); |
); |
1305 |
|
|
1306 |
} |
} |
1307 |
|
|
1308 |
glColor3f(0.0, 0.0, 0.0); |
glColor3f(0.0, 0.0, 0.0); |
1309 |
|
|
|
|
|
|
|
|
1310 |
// Week numbers |
// Week numbers |
1311 |
|
float week_num_scale = scales[1]; |
1312 |
|
Vertexer<Coords> v_week_num(coords1, week_num_scale); |
1313 |
|
|
1314 |
for (int i=0; i<weeks; i++) { |
for (int i=0; i<weeks; i++) { |
1315 |
static char buffer[64]; |
static char buffer[64]; |
1316 |
sprintf(buffer, "%i", first_week_number + i); |
sprintf(buffer, "%i", first_week_number + i); |
1317 |
|
|
1318 |
Text::renderIter(*r, buffer, buffer+strlen(buffer), |
Text::renderIter(*r, buffer, buffer+strlen(buffer), |
1319 |
0.1 , month_name_h + weekday_h + i + 0.8, v |
(0.1)*(1/week_num_scale), |
1320 |
|
(month_name_h + weekday_h + i + shifts[1])*(1/week_num_scale), |
1321 |
|
v_week_num |
1322 |
); |
); |
1323 |
|
|
1324 |
} |
} |
1325 |
|
|
|
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); |
|
|
|
|
1326 |
// Weekdays |
// Weekdays |
1327 |
|
float weekday_scale = scales[2]; |
1328 |
|
Vertexer<Coords> v_weekday(coords1, weekday_scale); |
1329 |
|
|
1330 |
for (int i=0; i<7; i++) { |
for (int i=0; i<7; i++) { |
1331 |
Text::renderIter(*r, d_txt[i].begin(), d_txt[i].end(), |
Text::renderIter(*r, d_txt[i].begin(), d_txt[i].end(), |
1332 |
week_num_w + i, month_name_h + weekday_h -0.1, |
(week_num_w + i+ 0.1)*(1/weekday_scale), |
1333 |
|
(month_name_h + weekday_h - shifts[2]) * (1/weekday_scale), |
1334 |
v_weekday |
v_weekday |
1335 |
); |
); |
1336 |
} |
} |
1337 |
|
|
1338 |
|
|
1339 |
|
// Month name |
1340 |
|
float month_name_scale = scales[3]; |
1341 |
|
Vertexer<Coords> v_month(coords1, month_name_scale); |
1342 |
|
|
1343 |
Text::renderIter(*r, m_txt.begin(), m_txt.end(), |
Text::renderIter(*r, m_txt.begin(), m_txt.end(), |
1344 |
week_num_w+1.5, month_name_h-0.1, v |
(week_num_w+shifts[3])*(1/month_name_scale), // x |
1345 |
|
(month_name_h-0.15)*(1/month_name_scale), // y |
1346 |
|
v_month |
1347 |
); |
); |
1348 |
|
|
1349 |
glPopAttrib(); |
glPopAttrib(); |