Mercurial > repos > blastem
comparison render_sdl.c @ 1397:89eb967fed72
Initial support for drag and drop. Some work needed for proper menu integration.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 14 Jun 2017 09:48:46 -0700 |
parents | 8c6d2ed3b959 |
children | 08116cb5ffaa |
comparison
equal
deleted
inserted
replaced
1396:aca496957999 | 1397:89eb967fed72 |
---|---|
912 [SDL_SCANCODE_KP_9] = 0x7D, | 912 [SDL_SCANCODE_KP_9] = 0x7D, |
913 [SDL_SCANCODE_KP_0] = 0x70, | 913 [SDL_SCANCODE_KP_0] = 0x70, |
914 [SDL_SCANCODE_KP_PERIOD] = 0x71, | 914 [SDL_SCANCODE_KP_PERIOD] = 0x71, |
915 }; | 915 }; |
916 | 916 |
917 static drop_handler drag_drop_handler; | |
918 void render_set_drag_drop_handler(drop_handler handler) | |
919 { | |
920 drag_drop_handler = handler; | |
921 } | |
922 | |
917 static int32_t handle_event(SDL_Event *event) | 923 static int32_t handle_event(SDL_Event *event) |
918 { | 924 { |
919 switch (event->type) { | 925 switch (event->type) { |
920 case SDL_KEYDOWN: | 926 case SDL_KEYDOWN: |
921 handle_keydown(event->key.keysym.sym, scancode_map[event->key.keysym.scancode]); | 927 handle_keydown(event->key.keysym.sym, scancode_map[event->key.keysym.scancode]); |
983 gl_setup(); | 989 gl_setup(); |
984 } | 990 } |
985 #endif | 991 #endif |
986 break; | 992 break; |
987 } | 993 } |
994 break; | |
995 case SDL_DROPFILE: | |
996 if (drag_drop_handler) { | |
997 drag_drop_handler(event->drop.file); | |
998 } | |
999 SDL_free(event->drop.file); | |
988 break; | 1000 break; |
989 case SDL_QUIT: | 1001 case SDL_QUIT: |
990 puts(""); | 1002 puts(""); |
991 exit(0); | 1003 exit(0); |
992 } | 1004 } |