diff --git a/project/include/Display.h b/project/include/Display.h index f0fdc7dd9..463cbc1f5 100644 --- a/project/include/Display.h +++ b/project/include/Display.h @@ -447,6 +447,8 @@ public: virtual uint32 getBackgroundMask() { return 0xffffffff; } + virtual const char *getJoystickName(int id) { return NULL; } + Matrix GetFullMatrix(bool inStageScaling); bool FinishEditOnEnter(); diff --git a/project/src/backend/sdl/SDLStage.cpp b/project/src/backend/sdl/SDLStage.cpp index b9b66b76d..f1d5c4091 100644 --- a/project/src/backend/sdl/SDLStage.cpp +++ b/project/src/backend/sdl/SDLStage.cpp @@ -683,6 +683,10 @@ public: double mDownX; double mDownY; + + const char *getJoystickName(int id) { + return SDL_JoystickNameForIndex(id); + } Surface *GetPrimarySurface() { diff --git a/project/src/backend/sdl2/SDL2Stage.cpp b/project/src/backend/sdl2/SDL2Stage.cpp index 48c7ad6e0..f740a41ba 100644 --- a/project/src/backend/sdl2/SDL2Stage.cpp +++ b/project/src/backend/sdl2/SDL2Stage.cpp @@ -643,6 +643,10 @@ public: double mDownX; double mDownY; + const char *getJoystickName(int id) { + return SDL_JoystickNameForIndex(id); + } + Surface *GetPrimarySurface() { diff --git a/project/src/common/ExternalInterface.cpp b/project/src/common/ExternalInterface.cpp index 2190d3da8..df35820d8 100644 --- a/project/src/common/ExternalInterface.cpp +++ b/project/src/common/ExternalInterface.cpp @@ -1343,6 +1343,20 @@ value lime_stage_set_focus(value inStage,value inObject,value inDirection) } DEFINE_PRIM(lime_stage_set_focus,3); +value lime_stage_get_joystick_name(value inStage, value inId) +{ + #if (defined(HX_WINDOWS) || defined(HX_MACOS) || defined(HX_LINUX)) + Stage *stage; + if (AbstractToObject(inStage,stage)) + { + const char *joystickName = stage->getJoystickName(val_int(inId)); + if (joystickName != NULL) return alloc_string(joystickName); + } + #endif + return alloc_null(); +} +DEFINE_PRIM(lime_stage_get_joystick_name,2); + DO_STAGE_PROP(focus_rect,FocusRect,alloc_bool,val_bool) DO_STAGE_PROP(autos3d,AutoS3D,alloc_bool,val_bool) DO_STAGE_PROP(align,Align,alloc_int,val_int)