-
-
Save georgy7/ade186facd48a6f6f8693ab429dc51c1 to your computer and use it in GitHub Desktop.
SDL2 DropEvent minimal example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SDL2/SDL.h> | |
int main() { | |
SDL_Init(SDL_INIT_EVERYTHING); | |
SDL_Window *window = SDL_CreateWindow("Drag-and-Drop", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN); | |
int running = 1; | |
while (running) { | |
SDL_Event event; | |
while (SDL_PollEvent(&event)) { | |
switch (event.type) { | |
case SDL_DROPFILE: | |
printf("Dropped file: %s\n", event.drop.file); | |
break; | |
case SDL_QUIT: | |
running = 0; | |
break; | |
} | |
} | |
} | |
SDL_DestroyWindow(window); | |
SDL_Quit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment