aboutsummaryrefslogtreecommitdiff
path: root/tests/sdl_image.c
blob: 89bf1122b86843a4bb4e911b3aa016efc1df61d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#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);

  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);

  SDL_Flip(screen); 

  printf("you should see an image.\n");

  SDL_Quit();

  int result = image->w;
  REPORT_RESULT();

  return 0;
}