Changeset 3550


Ignore:
Timestamp:
07/10/09 12:47:31 (4 years ago)
Author:
pterjan
Message:
  • Use utf8 format instead of ansi.

With ansi the width of the sprite canvas is 80 so they have to go very far to the left before getting re-positionned.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/screensaver.c

    r3549 r3550  
    125125        caca_import_memory(flying_toaster->toaster[i], 
    126126                           toaster_text[i], 
    127                            strlen(toaster_text[i]), "ansi");         
     127                           strlen(toaster_text[i]), "utf8");         
    128128        caca_import_memory(flying_toaster->mask[i], 
    129129                           toaster_mask[i], 
    130                            strlen(toaster_mask[i]), "ansi");         
     130                           strlen(toaster_mask[i]), "utf8");         
    131131    } 
    132132 
     
    157157{ 
    158158    struct flying_toaster *d = screen_list->screensaver_data; 
    159     int i, w, h; 
     159    int i, w, h, x, y, s; 
    160160    if(!d) return; 
    161161 
    162162    w = caca_get_canvas_width(screen_list->cv); 
    163163    h = caca_get_canvas_height(screen_list->cv); 
    164  
    165164 
    166165    caca_set_color_ansi(screen_list->cv, CACA_WHITE, CACA_BLACK); 
     
    169168    for(i = 0; i < COUNT; i++) 
    170169    { 
    171         caca_blit(screen_list->cv, d->x[i]/PRECISION, d->y[i]/PRECISION, d->toaster[d->s[i]/PRECISION], d->mask[d->s[i]/PRECISION]); 
     170        x = d->x[i]/PRECISION; 
     171        y = d->y[i]/PRECISION; 
     172        s = d->s[i]/PRECISION; 
     173 
     174        caca_blit(screen_list->cv, x, y, d->toaster[s], d->mask[s]); 
    172175 
    173176        d->x[i]-=40; 
    174177        d->y[i]+=10; 
    175178 
    176         if((d->x[i]/PRECISION) + caca_get_canvas_width(d->toaster[d->s[i]/PRECISION])<=0) 
    177             d->x[i] = ((rand()%w)+w) * PRECISION; 
    178         if((d->y[i]/PRECISION)>=h) 
    179             d->y[i] = ((rand()%h)-h) * PRECISION; 
     179        if(d->x[i]/PRECISION + caca_get_canvas_width(d->toaster[s])<=0) 
     180            d->x[i] = ((rand()%w)/3+w) * PRECISION; 
     181        if(d->y[i]/PRECISION>=h) 
     182            d->y[i] = ((rand()%h)/2-h) * PRECISION; 
    180183 
    181184        d->s[i] = ((d->s[i]+24)%(3*PRECISION)); 
Note: See TracChangeset for help on using the changeset viewer.