diff options
| author | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-09 00:53:36 +0100 |
|---|---|---|
| committer | Giuseppe Gadola <giusgadola@gmail.com> | 2023-02-10 16:05:59 +0100 |
| commit | 613af10a31666987440f0ad3f106211c3714de1e (patch) | |
| tree | d979def031491a4951ec076c875f8193990e7d6d /lua/pets/pet.lua | |
| parent | refactor: 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.lua | 3 |
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 |