OSDN Git Service

SDL_atomic_t サンプルコードを修正 https://wiki.libsdl.org/SDL_atomic_t?action=diff&rev1=3&rev2=4
[sdl2referencejp/sdl2referencejp.git] / SDL_Point.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
2 <html lang="ja-JP">\r
3 <head>\r
4 <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">\r
5 <meta http-equiv="Content-Style-Type" content="text/css">\r
6 <meta name="keywords" content="Simple Directmedia Layer SDL2.0">\r
7 <link rel="top" href="index.html" title="\83z\81[\83\80">\r
8 <link rel="parent" href="CategoryRect.html" title="1\82Â\8fã">\r
9 <title>SDL_Point</title>\r
10 </head>\r
11 <body>\r
12 <a href="index.html">\96Ú\8e\9f</a> - <a href="ApiByCategory.html">API(\8b@\94\\95Ê)</a> - <a href="CategoryRect.html">\97Ì\88æ</a> - SDL_Point\r
13 <hr>\r
14 <h1>SDL_Point</h1>\r
15 2\8e\9f\8c³\8fã\82Ì\93_\82ð\92è\8b`\82·\82é\8d\\91¢\91Ì\r
16 <h2>\83t\83B\81[\83\8b\83h</h2>\r
17 <table border="1" summary="SDL_Point">\r
18 <tr><td>int</td><td>x</td><td>\93_\82ÌX\8dÀ\95W</td></tr>\r
19 <tr><td>int</td><td>y</td><td>\93_\82ÌY\8dÀ\95W</td></tr>\r
20 </table>\r
21 <p>\r
22 <h2>\83T\83\93\83v\83\8b\83R\81[\83h</h2>\r
23 <code>\r
24 <pre>\r
25 // \83T\83\93\83v\83\8b\83v\83\8d\83O\83\89\83\80:\r
26 // \83R\81[\83h\82Ì\8ae\8f\8a\82ÅSDL_Point\82ð\8eg\82Á\82Ä\82¢\82é\r
27 \r
28 #include "SDL.h"\r
29 #include &lt;stdio.h&gt;\r
30 \r
31 int main(int argc, char *argv[]) {\r
32 \r
33     SDL_Window *window;\r
34 \r
35     SDL_Point window_position = {         //    \83E\83B\83\93\83h\83E\82Ì\88Ê\92u\r
36         SDL_WINDOWPOS_CENTERED,\r
37         SDL_WINDOWPOS_CENTERED\r
38     };\r
39     SDL_Point window_size = {640, 480};   //    \83E\83B\83\93\83h\83E\82Ì\83T\83C\83Y\r
40 \r
41     SDL_Point mouse_position;             //    \83}\83E\83X\82Ì\8dÀ\95W\r
42 \r
43     SDL_Init(SDL_INIT_VIDEO);             //    SDL2\82ð\8f\89\8aú\89»\82·\82é\r
44 \r
45     // \8e\9f\82Ì\90Ý\92è\82Å\83A\83v\83\8a\83P\81[\83V\83\87\83\93\83E\83B\83\93\83h\83E\82ð\90Ý\92è\82·\82é\r
46     window = SDL_CreateWindow( \r
47         "SDL_Point usage",                //    \83^\83C\83g\83\8b\r
48         window_position.x,                //    X\8dÀ\95W\82Ì\8f\89\8aú\92l\r
49         window_position.y,                //    Y\8dÀ\95W\82Ì\8f\89\8aú\92l\r
50         window_size.x,                    //    \95\9d\83s\83N\83Z\83\8b\90\94\r
51         window_size.y,                    //    \8d\82\82³\83s\83N\83Z\83\8b\90\94\r
52         SDL_WINDOW_OPENGL                 //    \83t\83\89\83O\r
53     );\r
54 \r
55     // \83E\83B\83\93\83h\83E\82ð\90\90¬\82Å\82«\82½\82©\83`\83F\83b\83N\82·\82é\r
56     if (window == NULL) {\r
57         SDL_Log("\83E\83B\83\93\83h\83E\82ð\90\90¬\82Å\82«\82È\82©\82Á\82½: %s", SDL_GetError());\r
58         return 1;\r
59     }\r
60 \r
61     SDL_GetMouseState(                    //    \83}\83E\83X\82Ì\83E\83B\83\93\83h\83E\8fã\82Ì...\r
62         &amp;mouse_position.x,            // ...\8dÀ\95W\82ð\93¾\82é\r
63         &amp;mouse_position.y\r
64     );\r
65 \r
66     SDL_Log("\83}\83E\83X\82Ì\88Ê\92u: x=%d y=%d",    //    \83}\83E\83X\82Ì\88Ê\92u\82ð\95\\8e¦\82·\82é\r
67          mouse_position.x, mouse_position.y\r
68     );\r
69 \r
70     // \83E\83B\83\93\83h\83E\82ð\95Â\82\82Ä\94j\8aü\82·\82é\r
71     SDL_DestroyWindow(window); \r
72 \r
73     // \8fI\97¹\8f\88\97\9d\r
74     SDL_Quit();\r
75     return 0; \r
76 }\r
77 </pre>\r
78 </code>\r
79 </p>\r
80 <h2>\8fÚ\8d×</h2>\r
81 <a href="SDL_Point.html">SDL_Point</a>\82Í1\82Â\82Ì2\8e\9f\8c³\8fã\82Ì\93_\82ð\92è\8b`\82·\82é.\r
82 \93_\88È\8aO\82Å\82à\8eg\82¦\82é\82ª, \83T\83C\83Y\82ð\8e\9d\82½\82È\82¢.\r
83 <a href="SDL_Point.html">SDL_Point</a>\82Í, \93_\82Ì\94z\97ñ\82ª\92·\95û\8c`(<a href="SDL_Rect.html">SDL_Rect</a>)\82Ì\92\86\82É\82 \82é\82©\82ð<a href="SDL_EnclosePoints.html">SDL_EnclosePoints()</a>\82Å\83`\83F\83b\83N\82Å\82«\82é.\r
84 <a href="SDL_Point.html">SDL_Point</a>\82ð\8eg\82Á\82Ä\8e©\95ª\82Å\8aÖ\90\94\82ð\8dì\82é\82±\82Æ\82à\82Å\82«\82é\82ª, \82±\82Ì\8aÖ\90\94\82Í\97L\97p\82Å\82 \82é.\r
85 <h2>\8aÖ\98A\8d\80\96Ú(\8d\\91¢\91Ì)</h2>\r
86 <a href="SDL_Rect.html">SDL_Rect</a><br>\r
87 <h2>\8aÖ\98A\8d\80\96Ú(\8aÖ\90\94)</h2>\r
88 <a href="SDL_EnclosePoints.html">SDL_EnclosePoints</a><br>\r
89 <h2>SDL Wiki\82Ö\82Ì\83\8a\83\93\83N</h2>\r
90 <a href="https://wiki.libsdl.org/SDL_Point">SDL_Point - SDL Wiki</a><br>\r
91 <hr>\r
92 </body>\r
93 </html>\r