diff --git a/src/draw_commands.rs b/src/draw_commands.rs index f05f42b..3e7e9f6 100644 --- a/src/draw_commands.rs +++ b/src/draw_commands.rs @@ -69,6 +69,10 @@ impl DrawCommandRecorder { self.set_draw_layer(self.current_layer.0, sublayer); } + pub fn get_draw_layer(&self) -> (i32, i32) { + self.current_layer + } + pub fn set_draw_color(&mut self, color: Srgba) { self.current_draw_color = color; } diff --git a/src/pob/api/rendering.rs b/src/pob/api/rendering.rs index 3d0ddaf..556b4d3 100644 --- a/src/pob/api/rendering.rs +++ b/src/pob/api/rendering.rs @@ -255,8 +255,10 @@ pub unsafe extern "C-unwind" fn draw_image_quad(state: *mut ffi::lua_State) -> c 0 } -pub fn get_draw_layer(_: &Lua, _: ()) -> LuaResult<()> { - unimplemented!() +pub fn get_draw_layer(l: &Lua, _: ()) -> LuaResult { + let ctx = l.app_data_ref::().unwrap(); + // matching PoB's behavior where only the sublayer is returned + Ok(ctx.recorder.get_draw_layer().1) } pub fn set_blend_mode(_: &Lua, _: ()) -> LuaResult<()> {