Mercurial > mxe-octave
annotate src/sdl_image-test.c @ 5947:09d3533acacf
* src/build-cmake.mk, src/cmake.mk: update v3.21.4
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Thu, 11 Nov 2021 09:49:11 -0500 |
parents | 99516e73b368 |
children |
rev | line source |
---|---|
2351
8a6c466753e2
Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents:
2333
diff
changeset
|
1 /* |
8a6c466753e2
Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents:
2333
diff
changeset
|
2 * This file is part of MXE. |
2353
99516e73b368
Move doc/index.html -> index.html
Volker Grabsch <vog@notjusthosting.com>
parents:
2351
diff
changeset
|
3 * See index.html for further information. |
2351
8a6c466753e2
Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents:
2333
diff
changeset
|
4 */ |
733
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
5 |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
6 #include <SDL.h> |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
7 #include <SDL_image.h> |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
8 |
946
35a9e556c82c
improved coding style of test programs
Volker Grabsch <vog@notjusthosting.com>
parents:
733
diff
changeset
|
9 int main(int argc, char *argv[]) |
733
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
10 { |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
11 SDL_Surface *image; |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
12 SDL_Surface *screen; |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
13 |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
14 (void)argc; |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
15 (void)argv; |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
16 |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
17 if (SDL_Init(SDL_INIT_EVERYTHING) < 0) return 1; |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
18 |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
19 image = IMG_Load("test.png"); |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
20 screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE); |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
21 |
1632
870ce42b74d3
package sdl_image: show image on screen in test program
Tony Theodore <tonyt@logyst.com>
parents:
946
diff
changeset
|
22 if (SDL_BlitSurface(image, NULL, screen, NULL) < 0) return 1; |
870ce42b74d3
package sdl_image: show image on screen in test program
Tony Theodore <tonyt@logyst.com>
parents:
946
diff
changeset
|
23 SDL_UpdateRect(screen, 0, 0, image->w, image->h); |
870ce42b74d3
package sdl_image: show image on screen in test program
Tony Theodore <tonyt@logyst.com>
parents:
946
diff
changeset
|
24 SDL_Delay(3000); |
733
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
25 SDL_Quit(); |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
26 return 0; |
6f7cdcfc3279
bugfix and test program for package sdl_image
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
27 } |