OSDN Git Service

SDL_atomic_t サンプルコードを修正 https://wiki.libsdl.org/SDL_atomic_t?action=diff&rev1=3&rev2=4
[sdl2referencejp/sdl2referencejp.git] / SDL_SetWindowTitle.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="CategoryVideo.html" title="1\82Â\8fã">\r
9 <title>SDL_SetWindowTitle</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="CategoryVideo.html">\83f\83B\83X\83v\83\8c\83C\82Æ\83E\83B\83\93\83h\83E</a> - SDL_SetWindowTitle\r
13 <hr>\r
14 <h1>SDL_SetWindowTitle</h1>\r
15 \83E\83B\83\93\83h\83E\82Ì\83^\83C\83g\83\8b\82ð\90Ý\92è\82·\82é\r
16 <h2>\8d\\95¶</h2>\r
17 <code>void SDL_SetWindowTitle(SDL_Window* window, const char* title)</code>\r
18 <h2>\88ø\90\94</h2>\r
19 <table border="1" summary="SDL_SetWindowTitle">\r
20 <tr><td>window</td><td>\90Ý\92è\82·\82é\83E\83B\83\93\83h\83E</td></tr>\r
21 <tr><td>title</td><td>\83E\83B\83\93\83h\83E\82Ì\83^\83C\83g\83\8b\82ÌUTF-8\95\8e\9a\97ñ</td></tr>\r
22 </table>\r
23 <h2>\83T\83\93\83v\83\8b\83R\81[\83h</h2>\r
24 <p>\r
25 <code>\r
26 <pre>\r
27 // \83E\83B\83\93\83h\83E\82Ì\83^\83C\83g\83\8b\82ð\93®\93I\82É\90Ý\92è\82·\82é\r
28 \r
29 #include "SDL.h"\r
30 \r
31 int main(int argc, char* argv[]){\r
32 \r
33     SDL_Window *window;\r
34     SDL_Event e;\r
35 \r
36     const char *titles[] = { // \82½\82¾\82Ì\82¨\97V\82Ñ\82Å\82 \82é. marquee\83^\83O\82Ì\82æ\82¤\82É\83A\83j\83\81\81[\83V\83\87\83\93\82³\82¹\82Ä\83\86\81[\83U\82ð\83C\83\89\82Â\82©\82¹\82æ\82¤\r
37         "t", "thi", "this w", "this win", "this windo", "this window's", "this window's ti", "this window's title",\r
38         "chis window's title is", "chih window's title is ", "chih wandnw's title is ", "c  h wandnw'g title is ",\r
39         "c  h  a  nw'g titln is ", "c  h  a  n  g  i  n ig ", "c  h  a  n  g  i  n  g!", "", \r
40         "c  h  a  n  g  i  n  g!", "", "c  h  a  n  g  i  n  g!", "c  h  a  n  g  i  n  g!"\r
41     };\r
42 \r
43     SDL_Init(SDL_INIT_VIDEO); // SDL2\82ð\8f\89\8aú\89»\82·\82é\r
44   \r
45     // \83E\83B\83\93\83h\83E\82ð\90\90¬\82·\82é\r
46     window = SDL_CreateWindow(\r
47         "This will surely be overwritten", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 320, 240, SDL_WINDOW_RESIZABLE\r
48     );\r
49 \r
50     // \83\81\83C\83\93\83\8b\81[\83v\82É\93ü\82é. \89½\82©\83L\81[\82ð\89\9f\82·\82©X\82ð\83N\83\8a\83b\83N\82·\82é\82Æ\8fI\97¹\82·\82é\r
51     for( ; e.type!=SDL_QUIT&amp;&amp;e.type!=SDL_KEYDOWN; SDL_PollEvent(&amp;e)){ \r
52         static int i = 0, t = 0;\r
53 \r
54         if(!(++t%9)){ // 9\83t\83\8c\81[\83\80\82²\82Æ\82É...\r
55             SDL_SetWindowTitle(window, titles[i]);             // \83\8b\81[\83v\82Å\r
56             if(++i >= sizeof(titles)/sizeof(titles[0])) i = 0; // \83^\83C\83g\83\8b\82Ì\94z\97ñ\82ð\92Ê\82é\r
57         }\r
58 \r
59     SDL_Delay(10);\r
60 \r
61     }\r
62 \r
63     SDL_DestroyWindow(window);\r
64     SDL_Quit();\r
65     return 0;\r
66 \r
67 }\r
68 </pre>\r
69 </code>\r
70 </p>\r
71 <h2>\8aÖ\98A\8d\80\96Ú(\8aÖ\90\94)</h2>\r
72 <a href="SDL_GetWindowTitle.html">SDL_GetWindowTitle</a><br>\r
73 <h2>SDL Wiki\82Ö\82Ì\83\8a\83\93\83N</h2>\r
74 <a href="https://wiki.libsdl.org/SDL_SetWindowTitle">SDL_SetWindowTitle - SDL Wiki</a>\r
75 <hr>\r
76 </body>\r
77 </html>\r