~npisanti/raylyeh

4ff6ed4cf81cf51170b6d3013bdf324bd51ee02a — Nicola Pisanti 2 months ago 90d3871
little changes to layer namespace
1 files changed, 8 insertions(+), 6 deletions(-)

M src/layer.c
M src/layer.c => src/layer.c +8 -6
@@ 209,10 209,12 @@ static int layer_select(lua_State * L)
	return 0;
}

static int layer_pipe(lua_State * L)
static int layer_draw(lua_State * L)
{
	const char * name = luaL_checkstring(L, 1);
	int mult = luaL_optint(L, 2, 0);
	float x = (float)luaL_checknumber(L, 2);
	float y = (float)luaL_checknumber(L, 3);
	int mult = luaL_optint(L, 4, 0);

	for (unsigned i = 0; i < rl__layers_size; ++i) {
		if (strcmp(name, layers[i].name) == 0) {


@@ 226,7 228,7 @@ static int layer_pipe(lua_State * L)
			float h = (float)-layers[i].fbos[fi].texture.height;
			DrawTextureRec(layers[i].fbos[fi].texture,
			               (Rectangle){0, 0, w, h},
			               (Vector2){layers[i].off_x, layers[i].off_y}, WHITE);
			               (Vector2){x, y}, WHITE);
			if (mult) {
				rlPopMatrix();
			}


@@ 237,7 239,7 @@ static int layer_pipe(lua_State * L)
	return 0;
}

static int layer_move(lua_State * L)
static int layer_position(lua_State * L)
{
	layers[rl__li].off_x = (float)luaL_checknumber(L, 1);
	layers[rl__li].off_y = (float)luaL_checknumber(L, 2);


@@ 287,8 289,8 @@ static int layer_save(lua_State * L)
static const luaL_Reg layer_namespace[] = {
    {"create", layer_create},
    {"select", layer_select},
    {"pipe", layer_pipe},
    {"move", layer_move},
    {"draw", layer_draw},
    {"position", layer_position},
    {"hide", layer_hide},
    {"show", layer_show},
    {"open", layer_open},