Changeset 1037
- Timestamp:
- Sep 16, 2006, 11:27:59 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/cacademo.c
r1034 r1037 77 77 }; 78 78 79 float star_rot[sizeof(star)/sizeof(*star)]; 79 80 80 81 /* Global variables */ … … 89 90 unsigned int i; 90 91 int transition = cucul_rand(0, TRANSITION_COUNT); 91 92 93 92 94 93 /* Set up two canvases, a mask, and attach a display to the front one */ … … 217 216 int w2 = cucul_get_canvas_width(mask) / 2; 218 217 int h2 = cucul_get_canvas_height(mask) / 2; 219 218 float angle = (time*360)*3.14/180, x,y; 219 unsigned int i; 220 220 switch(transition) 221 221 { 222 222 case TRANSITION_STAR: 223 /* Compute rotated coordinates */ 224 for(i=0;i<(sizeof(star)/sizeof(*star))/2;i++) 225 { 226 x = star[OFFSET_X(i)]; 227 y = star[OFFSET_Y(i)]; 228 229 star_rot[OFFSET_X(i)] = x*cos(angle) - y*sin(angle); 230 star_rot[OFFSET_Y(i)] = y*cos(angle) + x*sin(angle); 231 } 232 223 233 mulx*=1.8; 224 234 muly*=1.8; 225 235 cucul_fill_triangle(mask, 226 star[OFFSET_X(0)]*mulx+w2, star[OFFSET_Y(0)]*muly+h2, 227 star[OFFSET_X(1)]*mulx+w2, star[OFFSET_Y(1)]*muly+h2, 228 star[OFFSET_X(9)]*mulx+w2, star[OFFSET_Y(9)]*muly+h2, 236 star_rot[OFFSET_X(0)]*mulx+w2, 237 star_rot[OFFSET_Y(0)]*muly+h2, 238 star_rot[OFFSET_X(1)]*mulx+w2, 239 star_rot[OFFSET_Y(1)]*muly+h2, 240 star_rot[OFFSET_X(9)]*mulx+w2, 241 star_rot[OFFSET_Y(9)]*muly+h2, 229 242 "#"); 230 243 cucul_fill_triangle(mask, 231 star[OFFSET_X(1)]*mulx+w2, star[OFFSET_Y(1)]*muly+h2, 232 star[OFFSET_X(2)]*mulx+w2, star[OFFSET_Y(2)]*muly+h2, 233 star[OFFSET_X(3)]*mulx+w2, star[OFFSET_Y(3)]*muly+h2, 244 star_rot[OFFSET_X(1)]*mulx+w2, 245 star_rot[OFFSET_Y(1)]*muly+h2, 246 star_rot[OFFSET_X(2)]*mulx+w2, 247 star_rot[OFFSET_Y(2)]*muly+h2, 248 star_rot[OFFSET_X(3)]*mulx+w2, 249 star_rot[OFFSET_Y(3)]*muly+h2, 234 250 "#"); 235 251 cucul_fill_triangle(mask, 236 star[OFFSET_X(3)]*mulx+w2, star[OFFSET_Y(3)]*muly+h2, 237 star[OFFSET_X(4)]*mulx+w2, star[OFFSET_Y(4)]*muly+h2, 238 star[OFFSET_X(5)]*mulx+w2, star[OFFSET_Y(5)]*muly+h2, 252 star_rot[OFFSET_X(3)]*mulx+w2, 253 star_rot[OFFSET_Y(3)]*muly+h2, 254 star_rot[OFFSET_X(4)]*mulx+w2, 255 star_rot[OFFSET_Y(4)]*muly+h2, 256 star_rot[OFFSET_X(5)]*mulx+w2, 257 star_rot[OFFSET_Y(5)]*muly+h2, 239 258 "#"); 240 259 cucul_fill_triangle(mask, 241 star[OFFSET_X(5)]*mulx+w2, star[OFFSET_Y(5)]*muly+h2, 242 star[OFFSET_X(6)]*mulx+w2, star[OFFSET_Y(6)]*muly+h2, 243 star[OFFSET_X(7)]*mulx+w2, star[OFFSET_Y(7)]*muly+h2, 260 star_rot[OFFSET_X(5)]*mulx+w2, 261 star_rot[OFFSET_Y(5)]*muly+h2, 262 star_rot[OFFSET_X(6)]*mulx+w2, 263 star_rot[OFFSET_Y(6)]*muly+h2, 264 star_rot[OFFSET_X(7)]*mulx+w2, 265 star_rot[OFFSET_Y(7)]*muly+h2, 244 266 "#"); 245 267 cucul_fill_triangle(mask, 246 star[OFFSET_X(7)]*mulx+w2, star[OFFSET_Y(7)]*muly+h2, 247 star[OFFSET_X(8)]*mulx+w2, star[OFFSET_Y(8)]*muly+h2, 248 star[OFFSET_X(9)]*mulx+w2, star[OFFSET_Y(9)]*muly+h2, 268 star_rot[OFFSET_X(7)]*mulx+w2, 269 star_rot[OFFSET_Y(7)]*muly+h2, 270 star_rot[OFFSET_X(8)]*mulx+w2, 271 star_rot[OFFSET_Y(8)]*muly+h2, 272 star_rot[OFFSET_X(9)]*mulx+w2, 273 star_rot[OFFSET_Y(9)]*muly+h2, 249 274 "#"); 250 275 cucul_fill_triangle(mask, 251 star[OFFSET_X(9)]*mulx+w2, star[OFFSET_Y(9)]*muly+h2, 252 star[OFFSET_X(1)]*mulx+w2, star[OFFSET_Y(1)]*muly+h2, 253 star[OFFSET_X(5)]*mulx+w2, star[OFFSET_Y(5)]*muly+h2, 276 star_rot[OFFSET_X(9)]*mulx+w2, 277 star_rot[OFFSET_Y(9)]*muly+h2, 278 star_rot[OFFSET_X(1)]*mulx+w2, 279 star_rot[OFFSET_Y(1)]*muly+h2, 280 star_rot[OFFSET_X(5)]*mulx+w2, 281 star_rot[OFFSET_Y(5)]*muly+h2, 254 282 "#"); 255 283 cucul_fill_triangle(mask, 256 star[OFFSET_X(9)]*mulx+w2, star[OFFSET_Y(9)]*muly+h2, 257 star[OFFSET_X(5)]*mulx+w2, star[OFFSET_Y(5)]*muly+h2, 258 star[OFFSET_X(7)]*mulx+w2, star[OFFSET_Y(7)]*muly+h2, 284 star_rot[OFFSET_X(9)]*mulx+w2, 285 star_rot[OFFSET_Y(9)]*muly+h2, 286 star_rot[OFFSET_X(5)]*mulx+w2, 287 star_rot[OFFSET_Y(5)]*muly+h2, 288 star_rot[OFFSET_X(7)]*mulx+w2, 289 star_rot[OFFSET_Y(7)]*muly+h2, 259 290 "#"); 260 291 cucul_fill_triangle(mask, 261 star[OFFSET_X(1)]*mulx+w2, star[OFFSET_Y(1)]*muly+h2, 262 star[OFFSET_X(3)]*mulx+w2, star[OFFSET_Y(3)]*muly+h2, 263 star[OFFSET_X(5)]*mulx+w2, star[OFFSET_Y(5)]*muly+h2, 292 star_rot[OFFSET_X(1)]*mulx+w2, 293 star_rot[OFFSET_Y(1)]*muly+h2, 294 star_rot[OFFSET_X(3)]*mulx+w2, 295 star_rot[OFFSET_Y(3)]*muly+h2, 296 star_rot[OFFSET_X(5)]*mulx+w2, 297 star_rot[OFFSET_Y(5)]*muly+h2, 264 298 "#"); 265 299 break;
Note: See TracChangeset
for help on using the changeset viewer.