@quenty/sprites 3.4.1-canary.238.2c4d310.0 → 3.4.2-canary.241.f6a9a6a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [3.4.1-canary.238.2c4d310.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sprites@3.4.0...@quenty/sprites@3.4.1-canary.238.2c4d310.0) (2021-12-29)
6
+ ## [3.4.2-canary.241.f6a9a6a.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sprites@3.4.1...@quenty/sprites@3.4.2-canary.241.f6a9a6a.0) (2022-01-03)
7
+
8
+ **Note:** Version bump only for package @quenty/sprites
9
+
10
+
11
+
12
+
13
+
14
+ ## [3.4.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/sprites@3.4.0...@quenty/sprites@3.4.1) (2021-12-30)
7
15
 
8
16
  **Note:** Version bump only for package @quenty/sprites
9
17
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ## Sprites
2
2
  <div align="center">
3
3
  <a href="http://quenty.github.io/NevermoreEngine/">
4
- <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
4
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
5
5
  </a>
6
6
  <a href="https://discord.gg/mhtGUS8">
7
7
  <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
@@ -10,8 +10,11 @@
10
10
  <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
11
11
  </a>
12
12
  </div>
13
+
13
14
  Spritesheet utility for Roblox including a built-in InputImageLibrary
14
15
 
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/InputImageLibrary">View docs →</a></div>
17
+
15
18
  ## Installation
16
19
  ```
17
20
  npm install @quenty/sprites --save
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/sprites",
3
- "version": "3.4.1-canary.238.2c4d310.0",
3
+ "version": "3.4.2-canary.241.f6a9a6a.0",
4
4
  "description": "Spritesheet utility for Roblox including a built-in InputImageLibrary",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -26,16 +26,16 @@
26
26
  "Quenty"
27
27
  ],
28
28
  "dependencies": {
29
- "@quenty/baseobject": "3.2.1-canary.238.2c4d310.0",
30
- "@quenty/loader": "3.1.2-canary.238.2c4d310.0",
31
- "@quenty/maid": "2.0.2-canary.238.2c4d310.0",
32
- "@quenty/uiobjectutils": "2.0.1-canary.238.2c4d310.0"
29
+ "@quenty/baseobject": "3.2.2-canary.241.f6a9a6a.0",
30
+ "@quenty/loader": "3.1.3-canary.241.f6a9a6a.0",
31
+ "@quenty/maid": "2.0.2",
32
+ "@quenty/uiobjectutils": "2.0.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@quenty/string": "2.2.1-canary.238.2c4d310.0"
35
+ "@quenty/string": "2.2.1"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "2c4d310b84afd0570d89667dc5d4aa69a0ef304a"
40
+ "gitHead": "f6a9a6aa7c5f61f5a686faf305359828d8912fc0"
41
41
  }
@@ -1,6 +1,6 @@
1
- --[=[
2
- @class DialogSlider.story
3
- ]=]
1
+ --[[
2
+ @class InputImageLibrary.story
3
+ ]]
4
4
 
5
5
  local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
6
6
 
@@ -1,7 +1,7 @@
1
- --[=[
1
+ --[[
2
2
  Generated Gestures with Python
3
3
  @class Gestures
4
- ]=]
4
+ ]]
5
5
 
6
6
  local parent = script:FindFirstAncestorWhichIsA("ModuleScript")
7
7
  local require = require(parent.Parent.loader).load(parent)
@@ -1,7 +1,7 @@
1
- --[=[
1
+ --[[
2
2
  Generated KeyboardDark with Python
3
3
  @class KeyboardDark
4
- ]=]
4
+ ]]
5
5
 
6
6
  local parent = script:FindFirstAncestorWhichIsA("ModuleScript")
7
7
  local require = require(parent.Parent.loader).load(parent)
@@ -1,7 +1,7 @@
1
- --[=[
1
+ --[[
2
2
  Generated KeyboardLight with Python
3
3
  @class KeyboardLight
4
- ]=]
4
+ ]]
5
5
 
6
6
  local parent = script:FindFirstAncestorWhichIsA("ModuleScript")
7
7
  local require = require(parent.Parent.loader).load(parent)
@@ -1,7 +1,7 @@
1
- --[=[
1
+ --[[
2
2
  Generated XboxOneDark with Python
3
3
  @class XboxOneDark
4
- ]=]
4
+ ]]
5
5
 
6
6
  local parent = script:FindFirstAncestorWhichIsA("ModuleScript")
7
7
  local require = require(parent.Parent.loader).load(parent)
@@ -1,7 +1,7 @@
1
- --[=[
1
+ --[[
2
2
  Generated XboxOneLight with Python
3
3
  @class XboxOneLight
4
- ]=]
4
+ ]]
5
5
 
6
6
  local parent = script:FindFirstAncestorWhichIsA("ModuleScript")
7
7
  local require = require(parent.Parent.loader).load(parent)
@@ -1,5 +1,7 @@
1
1
  --[=[
2
- Input image library
2
+ InputImageLibrary with a variety of dark and light themed icons for inputs on keyboard, xbox, touched events,
3
+ mouse, and more.
4
+
3
5
  @class InputImageLibrary
4
6
  ]=]
5
7
 
@@ -1,4 +1,5 @@
1
1
  --[=[
2
+ A spritesheet that is animated. See [AnimatedSpritesheetPlayer] for playback.
2
3
  @class AnimatedSpritesheet
3
4
  ]=]
4
5
 
@@ -10,6 +11,21 @@ local AnimatedSpritesheet = setmetatable({}, Spritesheet)
10
11
  AnimatedSpritesheet.ClassName = "AnimatedSpritesheet"
11
12
  AnimatedSpritesheet.__index = AnimatedSpritesheet
12
13
 
14
+ --[=[
15
+ @interface AnimatedSpritesheetOptions
16
+ .texture string
17
+ .frames number
18
+ .spritesPerRow number
19
+ .spriteSize Vector2
20
+ .framesPerSecond number
21
+ @within AnimatedSpritesheet
22
+ ]=]
23
+
24
+ --[=[
25
+ Constructs a new AnimatedSpritesheet
26
+ @param options AnimatedSpritesheetOptions
27
+ @return AnimatedSpritesheet
28
+ ]=]
13
29
  function AnimatedSpritesheet.new(options)
14
30
  local self = setmetatable(Spritesheet.new(options.texture), AnimatedSpritesheet)
15
31
 
@@ -31,19 +47,34 @@ function AnimatedSpritesheet.new(options)
31
47
  return self
32
48
  end
33
49
 
34
-
50
+ --[=[
51
+ Gets the sprite size
52
+ @return Vector2
53
+ ]=]
35
54
  function AnimatedSpritesheet:GetSpriteSize()
36
55
  return self._options.spriteSize
37
56
  end
38
57
 
58
+ --[=[
59
+ Gets the frames per a second
60
+ @return number
61
+ ]=]
39
62
  function AnimatedSpritesheet:GetFramesPerSecond()
40
63
  return self._options.framesPerSecond
41
64
  end
42
65
 
43
- function AnimatedSpritesheet:GetPlayTime(framesPerSecond)
44
- return self._options.frames/framesPerSecond
66
+ --[=[
67
+ Gets the play time for the animated sheet
68
+ @return number
69
+ ]=]
70
+ function AnimatedSpritesheet:GetPlayTime()
71
+ return self._options.frames/self._options.framesPerSecond
45
72
  end
46
73
 
74
+ --[=[
75
+ Retrieves the frames for the sprite sheet.
76
+ @return frames
77
+ ]=]
47
78
  function AnimatedSpritesheet:GetFrames()
48
79
  return self._options.frames
49
80
  end
@@ -1,6 +1,6 @@
1
- --[=[
2
- @class DialogSlider.story
3
- ]=]
1
+ --[[
2
+ @class AnimatedSpritesheet.story
3
+ ]]
4
4
 
5
5
  local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
6
6
 
@@ -1,4 +1,5 @@
1
1
  --[=[
2
+ Plays an [AnimatedSpritesheet] for an given image label.
2
3
  @class AnimatedSpritesheetPlayer
3
4
  ]=]
4
5
 
@@ -13,6 +14,12 @@ local AnimatedSpritesheetPlayer = setmetatable({}, BaseObject)
13
14
  AnimatedSpritesheetPlayer.ClassName = "AnimatedSpritesheetPlayer"
14
15
  AnimatedSpritesheetPlayer.__index = AnimatedSpritesheetPlayer
15
16
 
17
+ --[=[
18
+ Constructs a new AnimatedSpritesheetPlayer
19
+ @param imageLabel ImageLabel
20
+ @param spritesheet AnimatedSpritesheet?
21
+ @return AnimatedSpritesheetPlayer
22
+ ]=]
16
23
  function AnimatedSpritesheetPlayer.new(imageLabel, spritesheet)
17
24
  local self = setmetatable(BaseObject.new(spritesheet), AnimatedSpritesheetPlayer)
18
25
 
@@ -25,6 +32,10 @@ function AnimatedSpritesheetPlayer.new(imageLabel, spritesheet)
25
32
  return self
26
33
  end
27
34
 
35
+ --[=[
36
+ Sets the current sheet and starts play if needed
37
+ @param spritesheet AnimatedSpritesheet
38
+ ]=]
28
39
  function AnimatedSpritesheetPlayer:SetSheet(spritesheet)
29
40
  assert(spritesheet, "Bad spritesheet")
30
41
 
@@ -1,4 +1,5 @@
1
1
  --[=[
2
+ A single image on a spritesheet.
2
3
  @class Sprite
3
4
  ]=]
4
5
 
@@ -6,6 +7,21 @@ local Sprite = {}
6
7
  Sprite.ClassName = "Sprite"
7
8
  Sprite.__index = Sprite
8
9
 
10
+ --[=[
11
+ Data used to construct a sprite.
12
+ @interface SpriteData
13
+ .Texture string
14
+ .Size Vector2
15
+ .Position Vector2
16
+ .Name string
17
+ @within Sprite
18
+ ]=]
19
+
20
+ --[=[
21
+ Constructs a new sprite
22
+ @param data SpriteData
23
+ @return Sprite
24
+ ]=]
9
25
  function Sprite.new(data)
10
26
  assert(data.Texture, "Bad data")
11
27
  assert(data.Size, "Bad data")
@@ -17,6 +33,11 @@ function Sprite.new(data)
17
33
  return self
18
34
  end
19
35
 
36
+ --[=[
37
+ Applies the styling to the gui
38
+ @param gui ImageLabel | ImageButton
39
+ @return Instance
40
+ ]=]
20
41
  function Sprite:Style(gui)
21
42
  gui.Image = self.Texture
22
43
  gui.ImageRectOffset = self.Position
@@ -25,6 +46,11 @@ function Sprite:Style(gui)
25
46
  return gui
26
47
  end
27
48
 
49
+ --[=[
50
+ Returns a new sprite with the specified `instanceType`
51
+ @param instanceType "ImageLabel" | "ImageButton"
52
+ @return ImageLabel | ImageButton
53
+ ]=]
28
54
  function Sprite:Get(instanceType)
29
55
  local gui = Instance.new(instanceType)
30
56
  gui.Size = UDim2.new(0, self.Size.X, 0, self.Size.Y)
@@ -11,6 +11,11 @@ local Spritesheet = {}
11
11
  Spritesheet.ClassName = "Spritesheet"
12
12
  Spritesheet.__index = Spritesheet
13
13
 
14
+ --[=[
15
+ Constructs a new Spritesheet
16
+ @param texture string
17
+ @return Spritesheet
18
+ ]=]
14
19
  function Spritesheet.new(texture)
15
20
  local self = setmetatable({}, Spritesheet)
16
21
 
@@ -20,10 +25,21 @@ function Spritesheet.new(texture)
20
25
  return self
21
26
  end
22
27
 
28
+ --[=[
29
+ Retrieves the preload asset ids to use
30
+ @return string
31
+ ]=]
23
32
  function Spritesheet:GetPreloadAssetId()
24
33
  return self._texture
25
34
  end
26
35
 
36
+ --[=[
37
+ @param index any
38
+ @param position Vector2
39
+ @param size Vector2
40
+
41
+ Adds a named sprite at the given index
42
+ ]=]
27
43
  function Spritesheet:AddSprite(index, position, size)
28
44
  assert(not self._sprites[index], "Already exists")
29
45
 
@@ -37,6 +53,11 @@ function Spritesheet:AddSprite(index, position, size)
37
53
  self._sprites[index] = sprite
38
54
  end
39
55
 
56
+ --[=[
57
+ Retrieves the sprite for the given index
58
+ @param index any | EnumItem
59
+ @return Sprite?
60
+ ]=]
40
61
  function Spritesheet:GetSprite(index)
41
62
  if not index then
42
63
  warn("[Spritesheet.GetSprite] - Image name cannot be nil")
@@ -55,6 +76,11 @@ function Spritesheet:GetSprite(index)
55
76
  return sprite
56
77
  end
57
78
 
79
+ --[=[
80
+ Returns true if the sprite exists
81
+ @param index any | EnumItem
82
+ @return boolean
83
+ ]=]
58
84
  function Spritesheet:HasSprite(index)
59
85
  return self:GetSprite(index) ~= nil
60
86
  end