Skip to content

Commit 84b9e51

Browse files
committed
Update to 1.7.1
1 parent b92fbf9 commit 84b9e51

29 files changed

+3172
-894
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# aeroTS
22
A port of [AeroGameFramework](https://sleitnick.github.io/AeroGameFramework/) to [roblox-ts](https://roblox-ts.github.io/)
33

4-
This was updated as of release [1.6.1 - 7edb161](https://github.com/Sleitnick/AeroGameFramework/tree/1.6.1)
4+
This was updated as of release [1.7.1 - b3cb92b](https://github.com/Sleitnick/AeroGameFramework/releases/tag/v1.7.1)
55

66
Features:
77
- IntelliSense for modules/service/controllers
@@ -15,6 +15,7 @@ It is easiest to clone this repository and copy relevant files across from there
1515
## Usage
1616
- AeroGameFramework comes with a lot of preinstalled files. These can be removed
1717
- The `Promise` library under Shared *must* exist - or the AeroClient will not be able to load.
18+
- The `Internal` folder under Shared *must* exist - or the AeroClient will not be able to load.
1819
- Create a file under your desired location, and add it to `src/GlobalRegistry.d.ts` in the defined format
1920
- For examples on how to do this, see [examples](https://github.com/OverHash/aeroTS/tree/master/examples)
2021

default.project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"AeroInternal": {
2424
"$path": "out/internal/Aero"
2525
}
26+
},
27+
"Internal": {
28+
"$path": "out/internal/shared"
2629
}
2730
}
2831
},

examples/exampleController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Aero from 'internal/Aero/Aero';
22

33
export = class exampleController extends Aero.Controller {
4-
static Start(): void {
4+
protected static Start(): void {
55
print('exampleController.ts started!');
66
}
77

8-
static Init(): void {
8+
protected static Init(): void {
99
print('Initiated from exampleController.ts!');
1010
}
1111

examples/exampleModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Aero from 'internal/Aero/Aero';
22

33
export = class exampleModule extends Aero.SharedModule {
4-
static Start(): void {
4+
protected static Start(): void {
55
print('exampleModule.ts started!');
66
}
77

8-
Init(): void {
8+
protected static Init(): void {
99
print('Initiated from exampleModule.ts!');
1010
}
1111

examples/exampleService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import Aero from 'internal/Aero/Aero';
22

33
export = class exampleService extends Aero.Service {
4-
static Start(): void {
4+
protected static Start(): void {
55
print('exampleService.ts started!');
66

77
// access exampleModule
88
this.Modules.exampleModule.foo('hello!');
99
}
1010

11-
static Init(): void {
11+
protected static Init(): void {
1212
print('Initiated from exampleService.ts!');
1313
}
1414
};

src/Client/Controllers/UserInput/Gamepad.lua

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ local userInput = game:GetService("UserInputService")
3636
local hapticService = game:GetService("HapticService")
3737
local abs = math.abs
3838

39+
local InverseLerp
40+
3941

4042
function Gamepad.new(gamepad)
4143

@@ -49,11 +51,11 @@ function Gamepad.new(gamepad)
4951
_isConnected = false;
5052
}, Gamepad)
5153

52-
self.ButtonDown = self.Shared.Event.new()
53-
self.ButtonUp = self.Shared.Event.new()
54-
self.Changed = self.Shared.Event.new()
55-
self.Connected = self.Shared.Event.new()
56-
self.Disconnected = self.Shared.Event.new()
54+
self.ButtonDown = self.Shared.Signal.new()
55+
self.ButtonUp = self.Shared.Signal.new()
56+
self.Changed = self.Shared.Signal.new()
57+
self.Connected = self.Shared.Signal.new()
58+
self.Disconnected = self.Shared.Signal.new()
5759

5860
self._listeners = self.Shared.ListenerList.new()
5961

@@ -81,7 +83,7 @@ function Gamepad.new(gamepad)
8183
end)
8284

8385
-- Map InputObject states to corresponding KeyCodes:
84-
for _,input in pairs(userInput:GetGamepadState(gamepad)) do
86+
for _,input in ipairs(userInput:GetGamepadState(gamepad)) do
8587
self._state[input.KeyCode] = input
8688
end
8789

@@ -103,14 +105,14 @@ function Gamepad:ConnectAll()
103105
end)
104106

105107
-- Input Ended:
106-
self._listeners:Connect(userInput.InputEnded, function(input, processed)
108+
self._listeners:Connect(userInput.InputEnded, function(input, _processed)
107109
if (input.UserInputType == self._gamepadInput) then
108110
self.ButtonUp:Fire(input.KeyCode)
109111
end
110112
end)
111113

112114
-- Input Changed:
113-
self._listeners:Connect(userInput.InputChanged, function(input, processed)
115+
self._listeners:Connect(userInput.InputChanged, function(input, _processed)
114116
if (input.UserInputType == self._gamepadInput) then
115117
self.Changed:Fire(input.KeyCode, input)
116118
end
@@ -165,7 +167,7 @@ end
165167

166168

167169
function Gamepad:StopAllMotors()
168-
for _,motor in pairs(Enum.VibrationMotor:GetEnumItems()) do
170+
for _,motor in ipairs(Enum.VibrationMotor:GetEnumItems()) do
169171
self:StopMotor(motor)
170172
end
171173
end
@@ -174,10 +176,8 @@ end
174176
function Gamepad:ApplyDeadzone(value, deadzoneThreshold)
175177
if (abs(value) < deadzoneThreshold) then
176178
return 0
177-
elseif (value > 0) then
178-
return ((value - deadzoneThreshold) / (1 - deadzoneThreshold))
179179
else
180-
return ((value + deadzoneThreshold) / (1 - deadzoneThreshold))
180+
return InverseLerp(deadzoneThreshold, 1, abs(value)) * (value > 0 and 1 or -1)
181181
end
182182
end
183183

@@ -188,7 +188,7 @@ end
188188

189189

190190
function Gamepad:Init()
191-
191+
InverseLerp = self.Shared.NumberUtil.InverseLerp
192192
end
193193

194194

src/Client/Controllers/UserInput/Keyboard.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ end
5252

5353
function Keyboard:Init()
5454

55-
self.KeyDown = self.Shared.Event.new()
56-
self.KeyUp = self.Shared.Event.new()
55+
self.KeyDown = self.Shared.Signal.new()
56+
self.KeyUp = self.Shared.Signal.new()
5757

5858
userInput.InputBegan:Connect(function(input, processed)
5959
if (processed) then return end
@@ -63,6 +63,7 @@ function Keyboard:Init()
6363
end)
6464

6565
userInput.InputEnded:Connect(function(input, processed)
66+
if (processed) then return end
6667
if (input.UserInputType == Enum.UserInputType.Keyboard) then
6768
self.KeyUp:Fire(input.KeyCode)
6869
end

src/Client/Controllers/UserInput/Mobile.lua

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,33 @@
33
-- December 28, 2017
44

55
--[[
6+
7+
Mobile:GetDeviceAcceleration()
8+
Mobile:GetDeviceGravity()
9+
Mobile:GetDeviceRotation()
610
711
Mobile.TouchStarted(position)
812
Mobile.TouchEnded(position)
913
Mobile.TouchMoved(position, delta)
1014
Mobile.TouchTapInWorld(position)
11-
Mobile.TouchPinch(scale, state)
15+
Mobile.TouchPinch(touchPositions, scale, velocity, state)
16+
Mobile.TouchLongPress(touchPositions, state)
17+
Mobile.TouchPan(touchPositions, totalTranslation, velocity, state)
18+
Mobile.TouchRotate(touchPositions, rotation, velocity, state)
19+
Mobile.TouchSwipe(swipeDirection, numberOfTouches)
20+
Mobile.TouchTap(touchPositions)
21+
Mobile.DeviceAccelerationChanged(acceleration)
22+
Mobile.DeviceGravityChanged(gravity)
23+
Mobile.DeviceRotationChanged(rotation, cframe)
1224
1325
--]]
1426

1527

1628

1729
local Mobile = {}
1830

19-
local RAY = Ray.new
31+
local RAY_DISTANCE = 1000
32+
2033
local workspace = workspace
2134

2235
local userInput = game:GetService("UserInputService")
@@ -25,44 +38,54 @@ local cam = workspace.CurrentCamera
2538

2639
function Mobile:GetRay(position)
2740
local viewportMouseRay = cam:ViewportPointToRay(position.X, position.Y)
28-
return RAY(viewportMouseRay.Origin, viewportMouseRay.Direction * 999)
41+
return Ray.new(viewportMouseRay.Origin, viewportMouseRay.Direction * RAY_DISTANCE)
2942
end
3043

3144

3245
function Mobile:Cast(position, ignoreDescendantsInstance, terrainCellsAreCubes, ignoreWater)
46+
warn("Mobile:Cast() is deprecated; please use Mouse:Raycast(raycastParams) instead")
3347
return workspace:FindPartOnRay(self:GetRay(position), ignoreDescendantsInstance, terrainCellsAreCubes, ignoreWater)
3448
end
3549

3650

3751
function Mobile:CastWithIgnoreList(position, ignoreDescendantsTable, terrainCellsAreCubes, ignoreWater)
52+
warn("Mobile:CastWithIgnoreList() is deprecated; please use Mouse:Raycast(raycastParams) instead")
3853
return workspace:FindPartOnRayWithIgnoreList(self:GetRay(position), ignoreDescendantsTable, terrainCellsAreCubes, ignoreWater)
3954
end
4055

4156

4257
function Mobile:CastWithWhitelist(position, whitelistDescendantsTable, ignoreWater)
58+
warn("Mobile:CastWithWhitelist() is deprecated; please use Mouse:Raycast(raycastParams) instead")
4359
return workspace:FindPartOnRayWithWhitelist(self:GetRay(position), whitelistDescendantsTable, ignoreWater)
4460
end
4561

4662

47-
function Mobile:Start()
48-
63+
function Mobile:Raycast(raycastParams, distance)
64+
local mousePos = userInput:GetMouseLocation()
65+
local viewportMouseRay = cam:ViewportPointToRay(mousePos.X, mousePos.Y)
66+
return workspace:Raycast(viewportMouseRay.Origin, viewportMouseRay.Direction * (distance or RAY_DISTANCE), raycastParams)
4967
end
5068

5169

5270
function Mobile:Init()
5371

54-
self.TouchStarted = self.Shared.Event.new()
55-
self.TouchEnded = self.Shared.Event.new()
56-
self.TouchMoved = self.Shared.Event.new()
57-
self.TouchTapInWorld = self.Shared.Event.new()
58-
self.TouchPinch = self.Shared.Event.new()
72+
self.TouchStarted = self.Shared.Signal.new()
73+
self.TouchEnded = self.Shared.Signal.new()
74+
self.TouchMoved = self.Shared.Signal.new()
75+
self.TouchTapInWorld = self.Shared.Signal.new()
76+
self.TouchPinch = self.Shared.Signal.new()
77+
self.TouchLongPress = self.Shared.Signal.new()
78+
self.TouchPan = self.Shared.Signal.new()
79+
self.TouchRotate = self.Shared.Signal.new()
80+
self.TouchSwipe = self.Shared.Signal.new()
81+
self.TouchTap = self.Shared.Signal.new()
5982

6083
userInput.TouchStarted:Connect(function(input, processed)
6184
if (processed) then return end
6285
self.TouchStarted:Fire(input.Position)
6386
end)
6487

65-
userInput.TouchEnded:Connect(function(input, processed)
88+
userInput.TouchEnded:Connect(function(input, _processed)
6689
self.TouchEnded:Fire(input.Position)
6790
end)
6891

@@ -78,10 +101,42 @@ function Mobile:Init()
78101

79102
userInput.TouchPinch:Connect(function(touchPositions, scale, velocity, state, processed)
80103
if (processed) then return end
81-
self.TouchPinch:Fire(scale, state)
104+
self.TouchPinch:Fire(touchPositions, scale, velocity, state)
105+
end)
106+
107+
userInput.TouchLongPress:Connect(function(touchPositions, state, processed)
108+
if (processed) then return end
109+
self.TouchLongPress:Fire(touchPositions, state)
82110
end)
111+
112+
userInput.TouchPan:Connect(function(touchPositions, totalTranslation, velocity, state, processed)
113+
if (processed) then return end
114+
self.TouchPan:Fire(touchPositions, totalTranslation, velocity, state)
115+
end)
116+
117+
userInput.TouchRotate:Connect(function(touchPositions, rotation, velocity, state, processed)
118+
if (processed) then return end
119+
self.TouchRotate:Fire(touchPositions, rotation, velocity, state)
120+
end)
121+
122+
userInput.TouchSwipe:Connect(function(swipeDirection, numberOfTouches, processed)
123+
if (processed) then return end
124+
self.TouchSwipe:Fire(swipeDirection, numberOfTouches)
125+
end)
126+
127+
userInput.TouchTap:Connect(function(touchPositions, processed)
128+
if (processed) then return end
129+
self.TouchTap:Fire(touchPositions)
130+
end)
131+
132+
self.GetDeviceAcceleration = userInput.GetDeviceAcceleration
133+
self.GetDeviceGravity = userInput.GetDeviceGravity
134+
self.GetDeviceRotation = userInput.GetDeviceRotation
135+
self.DeviceAccelerationChanged = userInput.DeviceAccelerationChanged
136+
self.DeviceGravityChanged = userInput.DeviceGravityChanged
137+
self.DeviceRotationChanged = userInput.DeviceRotationChanged
83138

84139
end
85140

86141

87-
return Mobile
142+
return Mobile

0 commit comments

Comments
 (0)