~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/sdl_gfx_primitives.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "SDL/SDL.h"
 
2
#include "SDL/SDL_gfxPrimitives.h"
 
3
 
 
4
#ifdef EMSCRIPTEN
 
5
#include "emscripten.h"
 
6
#endif
 
7
 
 
8
int main(int argc, char **argv) {
 
9
    SDL_Init(SDL_INIT_VIDEO);
 
10
 
 
11
    const int width = 400;
 
12
    const int height = 400;
 
13
    SDL_Surface *screen = SDL_SetVideoMode(width, height, 32, SDL_SWSURFACE);
 
14
    boxColor(screen, 0, 0, width, height, 0xff);
 
15
 
 
16
    boxColor(screen, 0, 0, 98, 98, 0xff0000ff);
 
17
    boxRGBA(screen, 100, 0, 198, 98, 0, 0, 0xff, 0xff);
 
18
    // check that the x2 > x1 case is handled correctly
 
19
    boxColor(screen, 298, 98, 200, 0, 0x00ff00ff);
 
20
    boxColor(screen, 398, 98, 300, 0, 0xff0000ff);
 
21
 
 
22
    rectangleColor(screen, 0, 100, 98, 198, 0x000ffff);
 
23
    rectangleRGBA(screen, 100, 100, 198, 198, 0xff, 0, 0, 0xff);
 
24
 
 
25
    ellipseColor(screen, 300, 150, 99, 49, 0x00ff00ff);
 
26
    filledEllipseColor(screen, 100, 250, 99, 49, 0x00ff00ff);
 
27
    filledEllipseRGBA(screen, 250, 300, 49, 99, 0, 0, 0xff, 0xff);
 
28
 
 
29
    lineColor(screen, 300, 200, 400, 300, 0x00ff00ff);
 
30
    lineRGBA(screen, 300, 300, 400, 400, 0, 0xff, 0, 0xff);
 
31
 
 
32
    SDL_UpdateRect(screen, 0, 0, 0, 0);
 
33
 
 
34
#ifndef EMSCRIPTEN
 
35
    SDL_Event evt;
 
36
    SDL_SaveBMP(screen, "native_output.bmp");
 
37
    while (1) {
 
38
       if (SDL_PollEvent(&evt) != 0 && evt.type == SDL_QUIT) break;
 
39
       SDL_Delay(33);
 
40
    }
 
41
#endif
 
42
 
 
43
    SDL_Quit();
 
44
 
 
45
    return 1;
 
46
}