Run a game by dropping the file on the window
This commit is contained in:
@@ -198,6 +198,8 @@ int main(int argc,char*argv[]) {
|
|||||||
lua_init(NULL);
|
lua_init(NULL);
|
||||||
lua_call_init();
|
lua_call_init();
|
||||||
|
|
||||||
|
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
|
||||||
|
|
||||||
while(!exit) {
|
while(!exit) {
|
||||||
if (should_reset) {
|
if (should_reset) {
|
||||||
should_reset = false;
|
should_reset = false;
|
||||||
@@ -210,6 +212,12 @@ int main(int argc,char*argv[]) {
|
|||||||
mouse_wheel = 0;
|
mouse_wheel = 0;
|
||||||
while(SDL_PollEvent(&mini_eve)) {
|
while(SDL_PollEvent(&mini_eve)) {
|
||||||
if (mini_eve.type == SDL_QUIT) { exit=true; break; }
|
if (mini_eve.type == SDL_QUIT) { exit=true; break; }
|
||||||
|
if (mini_eve.type == SDL_DROPFILE) {
|
||||||
|
char* dropped_filedir = mini_eve.drop.file;
|
||||||
|
load(dropped_filedir);
|
||||||
|
//SDL_ShowSimpleMessageBox( SDL_MESSAGEBOX_INFORMATION, "File dropped on window", dropped_filedir, mini_win );
|
||||||
|
SDL_free(dropped_filedir);
|
||||||
|
}
|
||||||
if (mini_eve.type == SDL_KEYDOWN) {
|
if (mini_eve.type == SDL_KEYDOWN) {
|
||||||
if (mini_eve.key.keysym.scancode == SDL_SCANCODE_ESCAPE) {
|
if (mini_eve.key.keysym.scancode == SDL_SCANCODE_ESCAPE) {
|
||||||
if (lua_is_playing()) {
|
if (lua_is_playing()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user