Merge pull request #39 from bendmorris/gamepad

Adding function to detect joystick names on Win/Mac/Linux.
This commit is contained in:
Joshua Granick
2014-03-14 11:10:42 -07:00
4 changed files with 24 additions and 0 deletions

View File

@@ -447,6 +447,8 @@ public:
virtual uint32 getBackgroundMask() { return 0xffffffff; }
virtual const char *getJoystickName(int id) { return NULL; }
Matrix GetFullMatrix(bool inStageScaling);
bool FinishEditOnEnter();

View File

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

View File

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

View File

@@ -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)