@quenty/gamescalingutils 8.0.0-canary.367.e9fdcbc.0 → 8.0.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 +100 -1
- package/package.json +8 -6
- package/src/Client/GameScalingHelper.lua +77 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,106 @@
|
|
|
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
|
-
# [8.0.0
|
|
6
|
+
# [8.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.29.0...@quenty/gamescalingutils@8.0.0) (2023-10-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [7.29.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.28.0...@quenty/gamescalingutils@7.29.0) (2023-09-21)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Add GameScalingHelper to help with scaling ([95876ef](https://github.com/Quenty/NevermoreEngine/commit/95876efad772f83450aa7d6a8f65d3228fe0a71f))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [7.28.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.27.0...@quenty/gamescalingutils@7.28.0) (2023-09-04)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [7.27.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.26.0...@quenty/gamescalingutils@7.27.0) (2023-08-23)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# [7.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.25.0...@quenty/gamescalingutils@7.26.0) (2023-08-01)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# [7.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.24.0...@quenty/gamescalingutils@7.25.0) (2023-07-28)
|
|
50
|
+
|
|
51
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# [7.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.23.0...@quenty/gamescalingutils@7.24.0) (2023-07-25)
|
|
58
|
+
|
|
59
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# [7.23.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.22.0...@quenty/gamescalingutils@7.23.0) (2023-07-23)
|
|
66
|
+
|
|
67
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# [7.22.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.21.1...@quenty/gamescalingutils@7.22.0) (2023-07-15)
|
|
74
|
+
|
|
75
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## [7.21.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.21.0...@quenty/gamescalingutils@7.21.1) (2023-07-11)
|
|
82
|
+
|
|
83
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# [7.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.20.0...@quenty/gamescalingutils@7.21.0) (2023-07-10)
|
|
90
|
+
|
|
91
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# [7.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.19.0...@quenty/gamescalingutils@7.20.0) (2023-06-17)
|
|
98
|
+
|
|
99
|
+
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
# [7.19.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@7.18.0...@quenty/gamescalingutils@7.19.0) (2023-06-05)
|
|
7
106
|
|
|
8
107
|
**Note:** Version bump only for package @quenty/gamescalingutils
|
|
9
108
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/gamescalingutils",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Scale ratios for the UI on different devices",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,10 +28,12 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/
|
|
32
|
-
"@quenty/
|
|
33
|
-
"@quenty/
|
|
34
|
-
"@quenty/
|
|
31
|
+
"@quenty/baseobject": "^7.0.0",
|
|
32
|
+
"@quenty/blend": "^7.0.0",
|
|
33
|
+
"@quenty/instanceutils": "^8.0.0",
|
|
34
|
+
"@quenty/loader": "^7.0.0",
|
|
35
|
+
"@quenty/rx": "^8.0.0",
|
|
36
|
+
"@quenty/valueobject": "^8.0.0"
|
|
35
37
|
},
|
|
36
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "fdeae46099587019ec5fc15317dc673aed379400"
|
|
37
39
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class GameScalingHelper
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local BaseObject = require("BaseObject")
|
|
8
|
+
local Rx = require("Rx")
|
|
9
|
+
local RxInstanceUtils = require("RxInstanceUtils")
|
|
10
|
+
local ValueObject = require("ValueObject")
|
|
11
|
+
|
|
12
|
+
local GameScalingHelper = setmetatable({}, BaseObject)
|
|
13
|
+
GameScalingHelper.ClassName = "GameScalingHelper"
|
|
14
|
+
GameScalingHelper.__index = GameScalingHelper
|
|
15
|
+
|
|
16
|
+
function GameScalingHelper.new(screenGui)
|
|
17
|
+
local self = setmetatable(BaseObject.new(), GameScalingHelper)
|
|
18
|
+
|
|
19
|
+
self._absoluteSize = self._maid:Add(ValueObject.new(Vector2.zero, "Vector2"))
|
|
20
|
+
self._isVertical = self._maid:Add(ValueObject.new(false, "boolean"))
|
|
21
|
+
self._isSmall = self._maid:Add(ValueObject.new(false, "boolean"))
|
|
22
|
+
|
|
23
|
+
self._maid:GiveTask(self._absoluteSize:Observe():Pipe({
|
|
24
|
+
Rx.map(function(size)
|
|
25
|
+
if size.x <= 0 or size.y <= 0 then
|
|
26
|
+
return false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
return size.x/size.y <= 1
|
|
30
|
+
end);
|
|
31
|
+
Rx.distinct()
|
|
32
|
+
}):Subscribe(function(isVertical)
|
|
33
|
+
self._isVertical.Value = isVertical
|
|
34
|
+
end))
|
|
35
|
+
|
|
36
|
+
self._maid:GiveTask(self._absoluteSize:Observe():Pipe({
|
|
37
|
+
Rx.map(function(size)
|
|
38
|
+
if size.x > 0 and size.y > 0 and math.min(size.x, size.y) < 500 then
|
|
39
|
+
return true
|
|
40
|
+
else
|
|
41
|
+
return false
|
|
42
|
+
end
|
|
43
|
+
end);
|
|
44
|
+
}):Subscribe(function(isSmall)
|
|
45
|
+
self._isSmall.Value = isSmall
|
|
46
|
+
end))
|
|
47
|
+
|
|
48
|
+
if screenGui then
|
|
49
|
+
self:SetScreenGui(screenGui)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
return self
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
function GameScalingHelper:ObserveIsSmall()
|
|
56
|
+
return self._isSmall:Observe()
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
function GameScalingHelper:ObserveIsVertical()
|
|
60
|
+
return self._isVertical:Observe()
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
function GameScalingHelper:GetAbsoluteSizeSetter()
|
|
64
|
+
return function(absoluteSize)
|
|
65
|
+
self:SetAbsoluteSize(absoluteSize)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
function GameScalingHelper:SetAbsoluteSize(absoluteSize)
|
|
70
|
+
self._absoluteSize:Mount(absoluteSize)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
function GameScalingHelper:SetScreenGui(screenGui)
|
|
74
|
+
self:SetAbsoluteSize(RxInstanceUtils.observeProperty(screenGui, "AbsoluteSize"))
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
return GameScalingHelper
|