X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=SDL_DropEvent.html;h=bafd1ee97892cf57293d712a0f0362115066c632;hb=0c077a2182c135926d863efde467d53e6e5a7735;hp=254877541ceea3a2aa99594d141adc20cb8bb9b7;hpb=399a8ec7c9a3550e4d455b4185413a901958b6ce;p=sdl2referencejp%2Fsdl2referencejp.git diff --git a/SDL_DropEvent.html b/SDL_DropEvent.html index 2548775..bafd1ee 100644 --- a/SDL_DropEvent.html +++ b/SDL_DropEvent.html @@ -5,35 +5,107 @@ - +
Uint32 | type | SDL_DROPFILE |
Uint32 | type | SDL_DROPFILE, SDL_DROPTEXT, SDL_DROPBEGIN, Ü½Í SDL_DROPCOMPLETE |
Uint32 | timestamp | CxgÌ^CX^v |
char* | file | t@C¼ SDL_Free()Åðú·éKvª é |
char* | file | t@C¼. SDL_free()Åðú·éKvª é. SDL_DROPBEGIN, SDL_DROPCOMPLETEÌÆ«ÍNULL |
Uint32 | windowID | ൠêÎhbvµ½EBhE |
+
+// TvvO:
+// SDL_DropEventÌg¢û
+
+#include "SDL.h"
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+ SDL_Window *window;
+ SDL_Event event; // CxgnhÌé¾
+ char* dropped_filedir; // hbv³ê½t@CÆfBNgÖÌ|C^
+
+ SDL_Init(SDL_INIT_VIDEO); // SDL2ðú»·é
+
+ window = SDL_CreateWindow( // EBhE𶬷é
+ "SDL_DropEventÌg¢û ±ÌEBhEÉt@CðhbvµÄ¾³¢",
+ SDL_WINDOWPOS_CENTERED,
+ SDL_WINDOWPOS_CENTERED,
+ 640,
+ 480,
+ SDL_WINDOW_OPENGL
+ );
+
+ // EBhE̶¬É¬÷µ½©`FbN·é
+ if (window == NULL) {
+ // EBhEª¶¬³êÈ©Á½Æ«...
+ printf("EBhEð¶¬Å«È©Á½: %s\n", SDL_GetError());
+ return 1;
+ }
+
+ SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
+
+ for(;;) { // vO[v
+ while (SDL_PollEvent(&event)) {
+ switch (event.type) {
+ case (SDL_QUIT): { // I¹Ìê
+ return 0; // I¹ÍȪ·é
+ }
+
+ case (SDL_DROPFILE): { // t@Cªhbv³ê½Æ«
+ dropped_filedir = event.drop.file;
+ // hbv³ê½t@CÆfBNgð\¦·é
+ SDL_ShowSimpleMessageBox(
+ SDL_MESSAGEBOX_INFORMATION,
+ "EBhEÉhbv³ê½t@C",
+ dropped_filedir,
+ window
+ );
+ SDL_free(dropped_filedir); // dropped_filedirÌððú·é
+ break;
+ }
+ }
+ }
+ SDL_Delay(0);
+ }
+
+ SDL_DestroyWindow(window); // EBhEð¶Äjü·é
+
+ SDL_Quit(); // I¹
+ return 0;
+}
+
+
-SDL_DropEventÍSDL_EventÌoÅ, typeªSDL_DROPFILEÌÆ«ñ³êé. +SDL_DropEventÍSDL_EventÌoÅ, typeªSDL_DROPFILE, SDL_DROPTEXT, SDL_DROPBEGIN, ܽÍSDL_DROPCOMPLETEÌÆ«ñ³êé. CxgÌdroptB[h©çANZXÅ«é.
-±ÌCxgÍftHgÅͳøÉÈÁÄ¢é. -SDL_EventState()ÅLøÉÅ«é. +±êçÌCxgÍftHgÅLøÅ é. +SDL_EventState()ųøÉÅ«é.
-൱ÌCxgðLøɵ½ÈçÎ, CxgÌfilenameÍðú·éKvª é. +൱êçÌCxgðLøɵ½ÈçÎ, CxgÅSDL_free()ðgÁÄfilenameððú·éKvª é. +
++SDL_DROPTEXT, SDL_DROPBEGIN, »µÄSDL_DROPCOMPLETEÍSDL 2.0.5È~Åg¦é.