OSDN Git Service

SDL_EventState 関連項目(関数)にSDL_GetEventStateを追加 https://wiki.libsdl.org/SDL_EventState...
[sdl2referencejp/sdl2referencejp.git] / SDL_CreateThread.html
index 738e0cc..35ab7f4 100644 (file)
@@ -30,9 +30,8 @@
 <pre>\r
 #include &lt;stdio.h&gt;\r
 #include "SDL_thread.h"\r
-#include "SDL_timer.h"\r
 \r
-/\82Æ\82Ä\82à\8aÈ\92P\82È\83X\83\8c\83b\83h - 50ms\8aÔ\8au\82Å0\82©\82ç9\82Ü\82Å\83J\83E\83\93\83g\82·\82é\r
+/\82Æ\82Ä\82à\92P\8f\83\82È\83X\83\8c\83b\83h - 50ms\8aÔ\8au\82Å0\82©\82ç9\82Ü\82Å\83J\83E\83\93\83g\82·\82é */\r
 static int TestThread(void *ptr)\r
 {\r
     int cnt;\r
@@ -47,27 +46,21 @@ static int TestThread(void *ptr)
 \r
 int main(int argc, char *argv[])\r
 {\r
-    SDL_Thread   *thread;\r
-    SDL_threadID threadID;\r
-    int          threadReturnValue;\r
+    SDL_Thread *thread;\r
+    int         threadReturnValue;\r
 \r
-    printf("\n\8aÈ\92P\82ÈSDL_CreateThread\82Ì\83e\83X\83g:");\r
+    printf("\n\92P\8f\83\82ÈSDL_CreateThread\82Ì\83e\83X\83g:");\r
 \r
-    /\92P\82É\83X\83\8c\83b\83h\82ð\90\90¬\82·\82é\r
+    /\92P\82É\83X\83\8c\83b\83h\82ð\90\90¬\82·\82é */\r
     thread = SDL_CreateThread(TestThread, "TestThread", (void *)NULL);\r
 \r
     if (NULL == thread) {\r
         printf("\nSDL_CreateThread \8e¸\94s: %s\n", SDL_GetError());\r
-        exit(-1);\r
+    } else {\r
+        SDL_WaitThread(thread, &threadReturnValue);\r
+        printf("\n\83X\83\8c\83b\83h\82Ì\96ß\82è\92l: %d", threadReturnValue);\r
     }\r
 \r
-    // \90V\82µ\82­\8aJ\8en\82³\82ê\82½\83X\83\8c\83b\83h\82ÌID\82ð\93¾\82é\r
-    threadID = SDL_GetThreadID(thread);\r
-\r
-    // \83X\83\8c\83b\83h\82Ì\8a®\97¹\82ð\91Ò\82¿\96ß\82è\92l\82ð\93¾\82é\r
-    SDL_WaitThread(thread, &amp;threadReturnValue);\r
-    printf("\n\83X\83\8c\83b\83h\82Ì\96ß\82è\92l: %d", threadReturnValue);\r
-\r
     return 0;\r
 }\r
 </pre>\r