/[pcsx2_0.9.7]/trunk/3rdparty/SDL-1.3.0-5387/test/testwm2.c
ViewVC logotype

Contents of /trunk/3rdparty/SDL-1.3.0-5387/test/testwm2.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 401 - (show annotations) (download)
Fri Feb 25 17:31:09 2011 UTC (9 years, 9 months ago) by william
File MIME type: text/plain
File size: 1712 byte(s)
Auto Commited Import of: pcsx2-0.9.7-DEBUG (upstream: v0.9.7.4358 local: v0.9.7.313-latest) in ./trunk
1
2 #include <stdlib.h>
3 #include <stdio.h>
4
5 #include "common.h"
6
7 static CommonState *state;
8
9 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
10 static void
11 quit(int rc)
12 {
13 CommonQuit(state);
14 exit(rc);
15 }
16
17 int
18 main(int argc, char *argv[])
19 {
20 int i, done;
21 SDL_Event event;
22
23 /* Initialize test framework */
24 state = CommonCreateState(argv, SDL_INIT_VIDEO);
25 if (!state) {
26 return 1;
27 }
28 state->skip_renderer = SDL_TRUE;
29 for (i = 1; i < argc;) {
30 int consumed;
31
32 consumed = CommonArg(state, i);
33 if (consumed == 0) {
34 consumed = -1;
35 }
36 if (consumed < 0) {
37 fprintf(stderr, "Usage: %s %s\n", argv[0], CommonUsage(state));
38 quit(1);
39 }
40 i += consumed;
41 }
42 if (!CommonInit(state)) {
43 quit(2);
44 }
45
46 /* Main render loop */
47 done = 0;
48 while (!done) {
49 /* Check for events */
50 while (SDL_PollEvent(&event)) {
51 CommonEvent(state, &event, &done);
52
53 if (event.type == SDL_WINDOWEVENT) {
54 if (event.window.event == SDL_WINDOWEVENT_MOVED) {
55 SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
56 if (window) {
57 printf("Window %d moved to %d,%d (display %d)\n",
58 event.window.windowID,
59 event.window.data1,
60 event.window.data2,
61 SDL_GetWindowDisplay(window));
62 }
63 }
64 }
65 }
66 }
67 quit(0);
68 // keep the compiler happy ...
69 return(0);
70 }
71
72 /* vi: set ts=4 sw=4 expandtab: */

  ViewVC Help
Powered by ViewVC 1.1.22