Changeset 1757


Ignore:
Timestamp:
Feb 23, 2007, 3:34:48 PM (13 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added squared transition to cacademo
Location:
libcaca/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/build-kernel

    r1055 r1757  
    3434
    3535# For further development: create floppy images using the kernel
    36 #gcc -traditional -c -o bootsect.o /usr/src/linux/arch/i386/boot/bootsect.S
    37 #ld -Ttext 0x0 -s --oformat binary bootsect.o -o cacademo.img
     36gcc -traditional -c -o bootsect.o /usr/src/linux/arch/i386/boot/bootsect.S
     37ld -Ttext 0x0 -s --oformat binary bootsect.o -o cacademo.img
    3838
  • libcaca/trunk/src/cacademo.c

    r1462 r1757  
    5353#define TRANSITION_FRAMES 40
    5454
    55 #define TRANSITION_COUNT  2
     55#define TRANSITION_COUNT  3
    5656#define TRANSITION_CIRCLE 0
    5757#define TRANSITION_STAR   1
    58 
     58#define TRANSITION_SQUARE 2
    5959
    6060/* Common macros for dither-based demos */
     
    211211    static float star_rot[sizeof(star)/sizeof(*star)];
    212212
     213
     214    static float const square[] =
     215    {
     216        -1, -1,
     217        1, -1,
     218        1, 1,
     219        -1, 1
     220    };
     221    static float square_rot[sizeof(square)/sizeof(*square)];
     222
    213223    float mulx = 0.0075f * completed * cucul_get_canvas_width(mask);
    214224    float muly = 0.0075f * completed * cucul_get_canvas_height(mask);
     
    220230    switch(tmode)
    221231    {
     232        case TRANSITION_SQUARE:
     233            /* Compute rotated coordinates */
     234            for(i = 0; i < (sizeof(square) / sizeof(*square)) / 2; i++)
     235            {
     236                x = square[i * 2];
     237                y = square[i * 2 + 1];
     238
     239                square_rot[i * 2] = x * cos(angle) - y * sin(angle);
     240                square_rot[i * 2 + 1] = y * cos(angle) + x * sin(angle);
     241            }
     242
     243            mulx *= 1.8;
     244            muly *= 1.8;
     245            cucul_fill_triangle(mask,
     246                                square_rot[0*2] * mulx + w2, square_rot[0*2+1] * muly + h2, \
     247                                square_rot[1*2] * mulx + w2, square_rot[1*2+1] * muly + h2, \
     248                                square_rot[2*2] * mulx + w2, square_rot[2*2+1] * muly + h2, '#');
     249            cucul_fill_triangle(mask,
     250                                square_rot[0*2] * mulx + w2, square_rot[0*2+1] * muly + h2, \
     251                                square_rot[2*2] * mulx + w2, square_rot[2*2+1] * muly + h2, \
     252                                square_rot[3*2] * mulx + w2, square_rot[3*2+1] * muly + h2, '#');
     253            break;
     254
     255
    222256        case TRANSITION_STAR:
    223257            /* Compute rotated coordinates */
     
    553587                draw_line(dx / 3, dy / 3, (i / DISCTHICKNESS) % 2);
    554588                draw_line(dy / 3, dx / 3, (i / DISCTHICKNESS) % 2);
    555        
     589
    556590                t += t > 0 ? dx - dy-- : dx;
    557591            }
Note: See TracChangeset for help on using the changeset viewer.