aboutsummaryrefslogtreecommitdiff
path: root/lua/pets/pet.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/pets/pet.lua')
-rw-r--r--lua/pets/pet.lua30
1 files changed, 29 insertions, 1 deletions
diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua
index e13d9e0..2442eec 100644
--- a/lua/pets/pet.lua
+++ b/lua/pets/pet.lua
@@ -43,7 +43,7 @@ end
-- start the animation of the pet
function M.Pet:animate()
self.popup:mount()
- self.animation:start(self.popup.bufnr)
+ self.animation:start()
end
-- delete the pet :(
@@ -56,4 +56,32 @@ function M.Pet:kill()
end
end
+function M.Pet:toggle_pause()
+ if not self.paused then
+ self.animation:stop_timer()
+ self.paused = true
+ else
+ if self.animation.current_image then
+ self.animation.current_image:delete(0, { free = false })
+ end
+ self.animation:start_timer()
+ self.paused = false
+ end
+end
+
+function M.Pet:toggle_hide()
+ if not self.paused then
+ self.animation:stop_timer()
+ if self.animation.current_image then
+ self.animation.current_image:delete(0, { free = false })
+ end
+ self.popup:unmount()
+ self.paused = true
+ else
+ self.popup:mount()
+ self.animation:start()
+ self.paused = false
+ end
+end
+
return M