aboutsummaryrefslogtreecommitdiff
path: root/lua/pets/pet.lua
diff options
context:
space:
mode:
authorGiuseppe Gadola <giusgadola@gmail.com>2023-02-09 00:53:36 +0100
committerGiuseppe Gadola <giusgadola@gmail.com>2023-02-10 16:05:59 +0100
commit613af10a31666987440f0ad3f106211c3714de1e (patch)
treed979def031491a4951ec076c875f8193990e7d6d /lua/pets/pet.lua
parentrefactor: going with OOP approach (diff)
refactor(animations): animations are now object oriented
Animations are refactored to be Object Oriented, so it is possible to have multiple pets independent from one anohter. An Animations instance is now an attribute of the Pet class.
Diffstat (limited to 'lua/pets/pet.lua')
-rw-r--r--lua/pets/pet.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua
index 4179b38..30e3461 100644
--- a/lua/pets/pet.lua
+++ b/lua/pets/pet.lua
@@ -9,11 +9,12 @@ function M.Pet.new(name, type, style)
instance.style = style
local wd = "/mnt/shared/coding/lua/plugins/pets.nvim/media/" -- TODO: adapt to use the correct path when plugin is installed
instance.sourcedir = wd .. type .. "/" .. style .. "/"
+ instance.animation = require("pets.animations").Animation.new(instance.sourcedir, type, style)
return instance
end
function M.Pet:animate(bufnr)
- require("pets.animations").animate(bufnr, self.sourcedir)
+ self.animation:start(bufnr)
end
return M