Exemplo n.º 1
0
int w_Body_applyForce(lua_State *L)
{
	Body *t = luax_checkbody(L, 1);
	float fx = (float)luaL_checknumber(L, 2);
	float fy = (float)luaL_checknumber(L, 3);

	int nargs = lua_gettop(L);

	if (nargs <= 3 || (nargs == 4 && lua_type(L, 4) == LUA_TBOOLEAN))
	{
		bool awake = luax_optboolean(L, 4, true);
		t->applyForce(fx, fy, awake);
	}
	else if (lua_gettop(L) >= 5)
	{
		float rx = (float)luaL_checknumber(L, 4);
		float ry = (float)luaL_checknumber(L, 5);
		bool awake = luax_optboolean(L, 6, true);
		t->applyForce(fx, fy, rx, ry, awake);
	}
	else
	{
		return luaL_error(L, "Wrong number of parameters.");
	}

	return 0;
}
Exemplo n.º 2
0
	int w_setMode(lua_State * L)
	{
		int w = luaL_checkint(L, 1);
		int h = luaL_checkint(L, 2);
		bool fs = luax_optboolean(L, 3, false);
		bool vsync = luax_optboolean(L, 4, true);
		int fsaa = luaL_optint(L, 5, 0);
		luax_pushboolean(L, instance->setMode(w, h, fs, vsync, fsaa));
		return 1;
	}
Exemplo n.º 3
0
int w_Body_applyTorque(lua_State *L)
{
	Body *t = luax_checkbody(L, 1);
	float arg = (float)luaL_checknumber(L, 2);
	bool awake = luax_optboolean(L, 3, true);
	t->applyTorque(arg, awake);
	return 0;
}
Exemplo n.º 4
0
int w_Body_applyAngularImpulse(lua_State *L)
{
	Body *t = luax_checkbody(L, 1);
	float i = (float)luaL_checknumber(L, 2);
	bool awake = luax_optboolean(L, 3, true);
	t->applyAngularImpulse(i, awake);
	return 0;
}
Exemplo n.º 5
0
int w_mount(lua_State *L)
{
	const char *archive = luaL_checkstring(L, 1);
	const char *mountpoint = luaL_checkstring(L, 2);
	bool append = luax_optboolean(L, 3, false);

	luax_pushboolean(L, instance()->mount(archive, mountpoint, append));
	return 1;
}
Exemplo n.º 6
0
int w_setIdentity(lua_State *L)
{
	const char *arg = luaL_checkstring(L, 1);
	bool append = luax_optboolean(L, 2, false);

	if (!instance()->setIdentity(arg, append))
		return luaL_error(L, "Could not set write directory.");

	return 0;
}
Exemplo n.º 7
0
	int w_stopRecording(lua_State * L)
	{
		if (luax_optboolean(L, 1, true)) {
			love::sound::SoundData * sd = instance->stopRecording(true);
			if (!sd) lua_pushnil(L);
			else luax_newtype(L, "SoundData", SOUND_SOUND_DATA_T, (void*)sd);
			return 1;
		}
		instance->stopRecording(false);
		return 0;
	}
Exemplo n.º 8
0
int w_stopRecording(lua_State *L)
{
	if (luax_optboolean(L, 1, true))
	{
		love::sound::SoundData *sd = instance()->stopRecording(true);
		if (!sd)
			lua_pushnil(L);
		else
		{
			luax_pushtype(L, SOUND_SOUND_DATA_ID, sd);
			sd->release();
		}
		return 1;
	}
	instance()->stopRecording(false);
	return 0;
}
Exemplo n.º 9
0
int w_setAndroidSaveExternal(lua_State *L)
{
	bool useExternal = luax_optboolean(L, 1, false);
	instance()->setAndroidSaveExternal(useExternal);
	return 0;
}