mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +02:00
Merge default into minor
--HG-- branch : minor
This commit is contained in:
@@ -158,6 +158,17 @@ void System::vibrate(double seconds) const
|
||||
#endif
|
||||
}
|
||||
|
||||
bool System::hasBackgroundMusic() const
|
||||
{
|
||||
#if defined(LOVE_ANDROID)
|
||||
return love::android::hasBackgroundMusic();
|
||||
#elif defined(LOVE_IOS)
|
||||
return love::ios::hasBackgroundMusic();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool System::getConstant(const char *in, System::PowerState &out)
|
||||
{
|
||||
return powerStates.find(in, out);
|
||||
|
||||
@@ -106,6 +106,14 @@ public:
|
||||
*/
|
||||
virtual void vibrate(double seconds) const;
|
||||
|
||||
/**
|
||||
* Gets if the user is playing music on background.
|
||||
* Throws an exception on unsupported platforms.
|
||||
*
|
||||
* @return Whether a music is playing on background.
|
||||
**/
|
||||
bool hasBackgroundMusic() const;
|
||||
|
||||
static bool getConstant(const char *in, PowerState &out);
|
||||
static bool getConstant(PowerState in, const char *&out);
|
||||
|
||||
|
||||
@@ -95,6 +95,12 @@ int w_vibrate(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_hasBackgroundMusic(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, instance()->hasBackgroundMusic());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getOS", w_getOS },
|
||||
@@ -104,6 +110,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getPowerInfo", w_getPowerInfo },
|
||||
{ "openURL", w_openURL },
|
||||
{ "vibrate", w_vibrate },
|
||||
{ "hasBackgroundMusic", w_hasBackgroundMusic },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user