mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Rename love.sensor.isAvailable to love.sensor.hasSensor.
This commit is contained in:
@@ -49,7 +49,7 @@ public:
|
||||
/**
|
||||
* Check the availability of the sensor.
|
||||
**/
|
||||
virtual bool isAvailable(SensorType type) = 0;
|
||||
virtual bool hasSensor(SensorType type) = 0;
|
||||
|
||||
/**
|
||||
* Check if the sensor is enabled.
|
||||
|
||||
@@ -49,7 +49,7 @@ const char *Sensor::getName() const
|
||||
return "love.sensor.sdl";
|
||||
}
|
||||
|
||||
bool Sensor::isAvailable(SensorType type)
|
||||
bool Sensor::hasSensor(SensorType type)
|
||||
{
|
||||
for (int i = 0; i < SDL_NumSensors(); i++)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
// Implements Module.
|
||||
const char *getName() const override;
|
||||
|
||||
bool isAvailable(SensorType type) override;
|
||||
bool hasSensor(SensorType type) override;
|
||||
bool isEnabled(SensorType type) override;
|
||||
void setEnabled(SensorType type, bool enable) override;
|
||||
std::vector<float> getData(SensorType type) override;
|
||||
|
||||
@@ -40,11 +40,11 @@ inline Sensor::SensorType luax_checksensortype(lua_State *L, int i)
|
||||
return type;
|
||||
}
|
||||
|
||||
static int w_isAvailable(lua_State *L)
|
||||
static int w_hasSensor(lua_State *L)
|
||||
{
|
||||
Sensor::SensorType type = luax_checksensortype(L, 1);
|
||||
|
||||
lua_pushboolean(L, instance()->isAvailable(type));
|
||||
lua_pushboolean(L, instance()->hasSensor(type));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -90,8 +90,7 @@ static int w_getName(lua_State *L)
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "isAvailable", w_isAvailable },
|
||||
{ "hasSensor", w_isAvailable },
|
||||
{ "hasSensor", w_hasSensor },
|
||||
{ "isEnabled", w_isEnabled },
|
||||
{ "setEnabled", w_setEnabled },
|
||||
{ "getData", w_getData },
|
||||
|
||||
Reference in New Issue
Block a user