Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save georgy7/ade186facd48a6f6f8693ab429dc51c1 to your computer and use it in GitHub Desktop.
Save georgy7/ade186facd48a6f6f8693ab429dc51c1 to your computer and use it in GitHub Desktop.
SDL2 DropEvent minimal example
#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