diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-03-15 18:35:10 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-03-15 18:35:10 -0700 |
commit | c741788a37b2fe8fa6ae2a9249031a7fda97f842 (patch) | |
tree | 6c6e570220c169d0e159f32459636e38ffe5b8bf | |
parent | 3f3df289f6068a26fb23c20ccd7de2911ceb3dff (diff) |
various files
-rw-r--r-- | tests/hello_world_file.cpp | 13 | ||||
-rw-r--r-- | tests/hello_world_file.txt | 4 | ||||
-rw-r--r-- | tests/screenshot.jpg | bin | 0 -> 50759 bytes | |||
-rw-r--r-- | tests/sdl_image.c | 33 |
4 files changed, 50 insertions, 0 deletions
diff --git a/tests/hello_world_file.cpp b/tests/hello_world_file.cpp new file mode 100644 index 00000000..71fb953b --- /dev/null +++ b/tests/hello_world_file.cpp @@ -0,0 +1,13 @@ +#include <stdio.h> +int main() { + FILE *file = fopen("tests/hello_world_file.txt", "rb"); + while (!feof(file)) { + char c = fgetc(file); + if (c != EOF) { + putchar(c); + } + } + fclose (file); + return 0; +} + diff --git a/tests/hello_world_file.txt b/tests/hello_world_file.txt new file mode 100644 index 00000000..8de0d699 --- /dev/null +++ b/tests/hello_world_file.txt @@ -0,0 +1,4 @@ +== +This data has been read from a file. +The file is readable as if it were at the same location in the filesystem, including directories, as in the local filesystem where you compiled the source. +== diff --git a/tests/screenshot.jpg b/tests/screenshot.jpg Binary files differnew file mode 100644 index 00000000..0c15dd3e --- /dev/null +++ b/tests/screenshot.jpg diff --git a/tests/sdl_image.c b/tests/sdl_image.c new file mode 100644 index 00000000..3f55374f --- /dev/null +++ b/tests/sdl_image.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <SDL/SDL.h> +#include <SDL/SDL_image.h> +#include <emscripten.h> + +int main() { + SDL_Init(SDL_INIT_VIDEO); + SDL_Surface *screen = SDL_SetVideoMode(600, 450, 32, SDL_SWSURFACE); + + if (SDL_MUSTLOCK(screen)) SDL_LockSurface(screen); + + SDL_Surface *image = IMG_Load("screenshot.jpg"); + if (!image) + { + printf("IMG_Load: %s\n", IMG_GetError()); + return 1; + } + SDL_BlitSurface (image, NULL, screen, NULL); + SDL_FreeSurface (image); + + if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); + SDL_Flip(screen); + + printf("you should see an image.\n"); + + SDL_Quit(); + + int result = image->w; + REPORT_RESULT(); + + return 0; +} + |