Subversion Repositories Kolibri OS

Rev

Rev 9204 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9204 Rev 9766
Line 15... Line 15...
15
 
15
 
16
    pixmem32 = (Uint32*) screen->pixels  + y + x;
16
    pixmem32 = (Uint32*)screen->pixels + y + x;
17
    *pixmem32 = colour;
17
    *pixmem32 = colour;
Line 18... Line -...
18
}
-
 
19
 
18
}
20
 
19
 
21
void DrawScreen(SDL_Surface* screen, int h)
20
void DrawScreen(SDL_Surface* screen, int h)
Line 22... Line 21...
22
{
21
{
23
    int x, y, ytimesw;
-
 
24
 
22
    int x, y, ytimesw;
-
 
23
 
25
    if(SDL_MUSTLOCK(screen))
24
    if (SDL_MUSTLOCK(screen)) {
Line 26... Line 25...
26
    {
25
        if (SDL_LockSurface(screen) < 0)
27
        if(SDL_LockSurface(screen) < 0) return;
-
 
28
    }
26
            return;
29
 
27
    }
30
    for(y = 0; y < screen->h; y++ )
-
 
31
    {
28
 
32
        ytimesw = y*screen->pitch/BPP;
29
    for (y = 0; y < screen->h; y++) {
33
        for( x = 0; x < screen->w; x++ )
30
        ytimesw = y * screen->pitch / BPP;
-
 
31
        for (x = 0; x < screen->w; x++) {
34
        {
32
            setpixel(screen, x, ytimesw, (x * x) / 256 + 3 * y + h, (y * y) / 256 + x + h, h);
Line 35... Line 33...
35
            setpixel(screen, x, ytimesw, (x*x)/256+3*y+h, (y*y)/256+x+h, h);
33
        }
36
        }
34
    }
Line 37... Line -...
37
    }
-
 
38
    if(SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen);
35
    if (SDL_MUSTLOCK(screen))
39
 
36
        SDL_UnlockSurface(screen);
40
    SDL_Flip(screen);
37
 
41
}
38
    SDL_Flip(screen);
Line 42... Line 39...
42
 
39
}
43
 
40
 
Line 44... Line 41...
44
int main(int argc, char* argv[])
41
int main(int argc, char* argv[])
-
 
42
{
Line 45... Line 43...
45
{
43
    SDL_Surface* screen;
46
    SDL_Surface *screen;
-
 
47
    SDL_Event event;
44
    SDL_Event event;
48
 
45
 
49
    int keypress = 0;
46
    int keypress = 0;
Line 50... Line 47...
50
    int h=0;
47
    int h = 0;
51
 
-
 
52
    if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1;
48
 
53
   
49
    if (SDL_Init(SDL_INIT_VIDEO) < 0)
54
    if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_FULLSCREEN|SDL_HWSURFACE)))
-
 
55
    {
50
        return 1;
56
        SDL_Quit();
-
 
57
        return 1;
51
 
58
    }
52
    if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_FULLSCREEN | SDL_HWSURFACE))) {
59
 
53
        SDL_Quit();
60
    while(!keypress)
54
        return 1;
61
    {
55
    }