int ApplicationBinder::canOpenUrl(lua_State* L)
{
    Binder binder(L);
    (void)binder.getInstance("Application", 1);

    const char* url = luaL_checkstring(L, 2);
    lua_pushboolean(L, ::canOpenUrl(url));
    return 1;
}
int ApplicationBinder::openUrl(lua_State* L)
{
	Binder binder(L);
	(void)binder.getInstance("Application", 1);

	const char* url = luaL_checkstring(L, 2);
	::openUrl(url);
	return 0;
}
int ApplicationBinder::setKeepAwake(lua_State* L)
{
	Binder binder(L);
	(void)binder.getInstance("Application", 1);

	::setKeepAwake(lua_toboolean(L, 2) != 0);

	return 0;
}
int ApplicationBinder::getLanguage(lua_State* L)
{
	Binder binder(L);
	(void)binder.getInstance("Application", 1);

	lua_pushstring(L, ::getLanguage().c_str());

	return 1;
}
int ApplicationBinder::vibrate(lua_State* L)
{
	Binder binder(L);
	(void)binder.getInstance("Application", 1);

	::vibrate();

	return 0;
}
Exemple #6
0
void tab_enter(table_t tab, void *key, void *value)
{
    int index;

    assert(tab && key);
    index = ((intptr_t) key) % HT_SIZE;
    tab->table[index] = list(binder(key, value, tab->top), tab->table[index]);
    tab->top = tab->table[index]->data;
}
	virtual void visit(MouseEvent* v)
	{
		StackChecker checker(L, "visit(MouseEvent* v)", 0);

		Binder binder(L);

		// get closure
		luaL_rawgetptr(L, LUA_REGISTRYINDEX, &key_eventClosures);
		lua_pushlightuserdata(L, bridge_);
		lua_rawget(L, -2);
		lua_remove(L, -2);		// remove env["eventClosures"]

		luaL_rawgetptr(L, LUA_REGISTRYINDEX, &key_MouseEvent);

		lua_getfield(L, -1, "__uniqueid");

		if (lua_isnil(L, -1) || lua_tointeger(L, -1) != v->uniqueid())
		{
			lua_pop(L, 1);

			lua_pushinteger(L, v->uniqueid());
			lua_setfield(L, -2, "__uniqueid");

			binder.setInstance(-1, v);

			lua_pushstring(L, v->type()); // TODO: buna artik ihtiyac yok. direk Event'te getType() fonksiyonu var
			lua_setfield(L, -2, "type");

            float rx = (v->x - v->tx) / v->sx;
            float ry = (v->y - v->ty) / v->sy;

            lua_pushinteger(L, floor(rx));
			lua_setfield(L, -2, "x");

            lua_pushinteger(L, floor(ry));
			lua_setfield(L, -2, "y");

            lua_pushnumber(L, rx);
            lua_setfield(L, -2, "rx");

            lua_pushnumber(L, ry);
            lua_setfield(L, -2, "ry");

            lua_pushnumber(L, v->wheel);
            lua_setfield(L, -2, "wheel");

            lua_pushnumber(L, v->button);
            lua_setfield(L, -2, "button");
		}
		else
		{
			lua_pop(L, 1);
		}

		lua_call(L, 1, 0);
	}
Exemple #8
0
int AudioBinder::SoundChannel_isLooping(lua_State *L)
{
    Binder binder(L);

    GGSoundChannel *soundChannel = static_cast<GGSoundChannel*>(binder.getInstance("SoundChannel", 1));

    lua_pushboolean(L, soundChannel->isLooping());

    return 1;
}
Exemple #9
0
int AudioBinder::SoundChannel_setLooping(lua_State *L)
{
    Binder binder(L);

    GGSoundChannel *soundChannel = static_cast<GGSoundChannel*>(binder.getInstance("SoundChannel", 1));

    soundChannel->setLooping(lua_toboolean2(L, 2));

    return 0;
}
Exemple #10
0
int AudioBinder::SoundChannel_getVolume(lua_State *L)
{
    Binder binder(L);

    GGSoundChannel *soundChannel = static_cast<GGSoundChannel*>(binder.getInstance("SoundChannel", 1));

    lua_pushnumber(L, soundChannel->getVolume());

    return 1;
}
Exemple #11
0
int AudioBinder::SoundChannel_setVolume(lua_State *L)
{
    Binder binder(L);

    GGSoundChannel *soundChannel = static_cast<GGSoundChannel*>(binder.getInstance("SoundChannel", 1));

    soundChannel->setVolume(luaL_checknumber(L, 2));

    return 0;
}
Exemple #12
0
int AudioBinder::SoundChannel_getPosition(lua_State *L)
{
    Binder binder(L);

    GGSoundChannel *soundChannel = static_cast<GGSoundChannel*>(binder.getInstance("SoundChannel", 1));

    lua_pushinteger(L, soundChannel->getPosition());

    return 1;
}
Exemple #13
0
int MeshBinder::setPrimitiveType(lua_State *L)
{
    Binder binder(L);
    GMesh *mesh = static_cast<GMesh*>(binder.getInstance("Mesh", 1));
    ShaderProgram::ShapeType prim=(ShaderProgram::ShapeType) luaL_checkinteger(L,2);

    mesh->setPrimitiveType(prim);

    return 0;
}
Exemple #14
0
int LuaCamera::lua_Rotate(lua_State* L){
	LuaBinder binder(L);

	Camera* e = (Camera*)binder.checkusertype(1, "Camera");
	if (e != nullptr) {
		e->rotate(glm::vec3(binder.checknumber(2), binder.checknumber(3), binder.checknumber(4)), (float) binder.checknumber(5), false);
	}

	return 0;
}
FontBinder::FontBinder(lua_State* L)
{
	Binder binder(L);

	static const luaL_Reg functionList[] = {
		{NULL, NULL},
	};

	binder.createClass("Font", "FontBase", create, destruct, functionList);
}
Exemple #16
0
int LuaCamera::lua_SetTransform(lua_State* L)
{
	LuaBinder binder(L);

	Camera* entity = (Camera*)binder.checkusertype(1, "Camera");
	CTransform* component = (CTransform*)binder.checkusertype(2, "Component");

	entity->SetTransform(component);
	return 0;
}
Exemple #17
0
void InvertEffect::paintEffectFrame(KWin::EffectFrame* frame, QRegion region, double opacity, double frameOpacity)
{
    if (m_valid && m_allWindows) {
        frame->setShader(m_shader);
        ShaderBinder binder(m_shader);
        effects->paintEffectFrame(frame, region, opacity, frameOpacity);
    } else {
        effects->paintEffectFrame(frame, region, opacity, frameOpacity);
    }
}
Exemple #18
0
int MeshBinder::setTexture(lua_State *L)
{
    Binder binder(L);
    GMesh *mesh = static_cast<GMesh*>(binder.getInstance("Mesh", 1));
    TextureBase* textureBase = static_cast<TextureBase*>(binder.getInstance("TextureBase", 2));

    mesh->setTexture(textureBase);

    return 0;
}
Exemple #19
0
int SpriteBinder::clearBlendFunc(lua_State* L)
{
	StackChecker checker(L, "SpriteBinder::clearBlendFunc", 0);

	Binder binder(L);
	Sprite* sprite = static_cast<Sprite*>(binder.getInstance("Sprite", 1));
	sprite->clearBlendFunc();

	return 0;
}
Exemple #20
0
int SpriteBinder::getAlpha(lua_State* L)
{
	StackChecker checker(L, "getAlpha", 1);

	Binder binder(L);
	Sprite* sprite = static_cast<Sprite*>(binder.getInstance("Sprite"));

	lua_pushnumber(L, sprite->alpha());

	return 1;
}
Exemple #21
0
int SpriteBinder::isVisible(lua_State* L)
{
	StackChecker checker(L, "isVisible", 1);
	
	Binder binder(L);
	Sprite* sprite = static_cast<Sprite*>(binder.getInstance("Sprite"));

	lua_pushboolean(L, sprite->visible());

	return 1;
}
Exemple #22
0
int SpriteBinder::getParent(lua_State* L)
{
	StackChecker checker(L, "getParent", 1);

	Binder binder(L);
	Sprite* sprite = static_cast<Sprite*>(binder.getInstance("Sprite"));

	lua_getfield(L, 1, "__parent");

	return 1;
}
Exemple #23
0
int SpriteBinder::numChildren(lua_State* L)
{
	StackChecker checker(L, "numChildren", 1);

	Binder binder(L);
	Sprite* sprite = static_cast<Sprite*>(binder.getInstance("Sprite"));

	lua_pushinteger(L, sprite->childCount());
	
	return 1;
}
Exemple #24
0
int LuaCamera::lua_SetActive(lua_State* L){
	LuaBinder binder(L);

	Scene* state = SceneManager::getActiveState();
	Camera* e = state->getCamera(binder.checkstring(1));
	if (e != nullptr) {
		state->setCurrentCamera(e);
	}

	return 0;
}
Exemple #25
0
int SpriteBinder::setShader(lua_State* L)
{
	StackChecker checker(L, "SpriteBinder::setShader", 0);

	Binder binder(L);
	Sprite* sprite = static_cast<Sprite*>(binder.getInstance("Sprite", 1));
	ShaderProgram* shader = static_cast<ShaderProgram*>(binder.getInstance("Shader", 2));
	sprite->setShader(shader);

	return 0;
}
Exemple #26
0
DibBinder::DibBinder(lua_State* L)
{
	Binder binder(L);

	static const luaL_Reg functionList[] = {
		{"getPixel", getPixel},
		{NULL, NULL},
	};

	binder.createClass("Dib", NULL, create, destruct, functionList);
}
int ApplicationBinder::getTextureMemoryUsage(lua_State* L)
{
    Binder binder(L);
    (void)binder.getInstance("Application", 1);

    LuaApplication* application = static_cast<LuaApplication*>(luaL_getdata(L));

    lua_pushnumber(L, gtexture_getMemoryUsage() / 1024.0);

    return 1;
}
int ApplicationBinder::setWindowSize(lua_State* L){
    Binder binder(L);
    (void)binder.getInstance("Application", 1);

    int width = luaL_checkinteger(L, 2);
    int height = luaL_checkinteger(L, 3);

    ::setWindowSize(width, height);

    return 0;
}
int RenderTargetBinder::draw(lua_State *L)
{
    Binder binder(L);

    GRenderTarget *renderTarget = static_cast<GRenderTarget*>(binder.getInstance("RenderTarget", 1));
    Sprite *sprite = static_cast<Sprite*>(binder.getInstance("Sprite", 2));

    renderTarget->draw(sprite);

    return 0;
}
Exemple #30
0
int MeshBinder::setTextureSlot(lua_State *L)
{
    Binder binder(L);
    GMesh *mesh = static_cast<GMesh*>(binder.getInstance("Mesh", 1));
    int slot=luaL_checkinteger(L,2);
    TextureBase* textureBase = static_cast<TextureBase*>(binder.getInstance("TextureBase", 3));

    mesh->setTextureSlot(slot,textureBase);

    return 0;
}