Adding function to detect joystick names on Win/Mac/Linux.

This commit is contained in:
bendmorris
2014-02-06 12:34:15 -05:00
parent 36051e31c8
commit 770350fd4c
4 changed files with 24 additions and 0 deletions

View File

@@ -684,6 +684,10 @@ public:
double mDownX;
double mDownY;
const char *getJoystickName(int id) {
return SDL_JoystickNameForIndex(id);
}
Surface *GetPrimarySurface()
{

View File

@@ -507,6 +507,10 @@ public:
double mDownX;
double mDownY;
const char *getJoystickName(int id) {
return SDL_JoystickNameForIndex(id);
}
Surface *GetPrimarySurface()
{

View File

@@ -1260,6 +1260,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));
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(scale_mode,ScaleMode,alloc_int,val_int)
DO_STAGE_PROP(align,Align,alloc_int,val_int)