Mercurial > sdl-ios-xcode
annotate test/testerror.c @ 897:9e27fdb98eab
Date: Tue, 11 May 2004 22:05:32 -0400
From: Bob Ippolito
Subject: [SDL] SDL_QuartzWM patches
I've sent in two small patches to SDL_QuartzWM directly to Sam over the
past few months (well, I think I sent both anyway) and neither of them
have been implemented. I didn't receive a response, so I'm sure he was
just busy and/or they got lost, so I decided to sign up to the list and
post them here.
This patch rolls both of them together:
- Mouse cursor becomes visible if hidden when it moves outside of the
game window. If you want it to stay invisible you should warp it
because if it's not warped a user might click some random other
application! Commercial games behave in this way (or at least Warcraft
III does, which is the only one that uses a custom mouse cursor and no
warping that I've played in recent memory).
- Right mouse button emulation is changed from Command-Click to
Control-Click, which is how OS X behaves.
Consider copyright assigned to whomever needs it under whichever
license it needs to be under.. yadda yadda yadda.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 17 May 2004 00:16:24 +0000 |
parents | 74212992fb08 |
children | be9c9c8f6d53 |
rev | line source |
---|---|
0 | 1 |
2 /* Simple test of the SDL threading code and error handling */ | |
3 | |
4 #include <stdio.h> | |
5 #include <stdlib.h> | |
6 #include <signal.h> | |
7 | |
8 #include "SDL.h" | |
9 #include "SDL_thread.h" | |
10 | |
11 static int alive = 0; | |
12 | |
13 int ThreadFunc(void *data) | |
14 { | |
15 /* Set the child thread error string */ | |
16 SDL_SetError("Thread %s (%d) had a problem: %s", | |
17 (char *)data, SDL_ThreadID(), "nevermind"); | |
18 while ( alive ) { | |
19 printf("Thread '%s' is alive!\n", (char *)data); | |
20 SDL_Delay(1*1000); | |
21 } | |
22 printf("Child thread error string: %s\n", SDL_GetError()); | |
23 return(0); | |
24 } | |
25 | |
26 int main(int argc, char *argv[]) | |
27 { | |
28 SDL_Thread *thread; | |
29 | |
30 /* Load the SDL library */ | |
31 if ( SDL_Init(0) < 0 ) { | |
32 fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); | |
33 exit(1); | |
34 } | |
35 atexit(SDL_Quit); | |
36 | |
37 /* Set the error value for the main thread */ | |
38 SDL_SetError("No worries"); | |
39 | |
40 alive = 1; | |
41 thread = SDL_CreateThread(ThreadFunc, "#1"); | |
42 if ( thread == NULL ) { | |
43 fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError()); | |
44 exit(1); | |
45 } | |
46 SDL_Delay(5*1000); | |
47 printf("Waiting for thread #1\n"); | |
48 alive = 0; | |
49 SDL_WaitThread(thread, NULL); | |
50 | |
51 printf("Main thread error string: %s\n", SDL_GetError()); | |
52 | |
53 return(0); | |
54 } |