Skip to content

Commit fe96654

Browse files
committed
Add physics
1 parent 037cd3e commit fe96654

29 files changed

+3539
-331
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Package.resolved
1111
#Xcode
1212
*.xcuserdatad
1313
*.xcworkspace
14+
*.xcscheme
1415

1516
#Visual Studio
1617
.vs

.swiftpm/xcode/xcshareddata/xcschemes/GameMath.xcscheme

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1420"
4-
version = "1.3">
3+
LastUpgradeVersion = "1430"
4+
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
@@ -27,6 +27,12 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<TestPlans>
31+
<TestPlanReference
32+
reference = "container:.swiftpm/xcode/GameMath.xctestplan"
33+
default = "YES">
34+
</TestPlanReference>
35+
</TestPlans>
3036
<Testables>
3137
<TestableReference
3238
skipped = "NO">

Package.swift

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var settings: [SwiftSetting]? {
1717
array.append(.define("GameMathUseFastInverseSquareRoot"))
1818
#endif
1919

20-
//These settings are faster only with optimization.
20+
// These settings are faster only with optimization.
2121
#if true
2222
array.append(.define("GameMathUseSIMD", .when(configuration: .release)))
2323
array.append(.define("GameMathUseLoopVectorization", .when(configuration: .release)))
@@ -33,7 +33,14 @@ let package = Package(
3333
],
3434
targets: [
3535
.target(name: "GameMath", swiftSettings: settings),
36-
.testTarget(name: "GameMathTests", dependencies: ["GameMath"]),
36+
.testTarget(name: "GameMathTests",
37+
dependencies: ["GameMath"]),
38+
.testTarget(name: "GameMathSIMDTests",
39+
dependencies: ["GameMath"],
40+
swiftSettings: [
41+
.define("GameMathUseSIMD"),
42+
.define("GameMathUseLoopVectorization")
43+
]),
3744
],
3845
swiftLanguageVersions: [.v5]
3946
)

README.md

+15-39
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22
[![Windows](https://github.com/STREGAsGate/GameMath/actions/workflows/Windows.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/Windows.yml)
33
[![macOS](https://github.com/STREGAsGate/GameMath/actions/workflows/macOS.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/macOS.yml)
44
[![Linux](https://github.com/STREGAsGate/GameMath/actions/workflows/Linux.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/Linux.yml)
5-
[![WebAssembly](https://github.com/STREGAsGate/GameMath/actions/workflows/SwiftWasm.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/SwiftWasm.yml)
6-
7-
[![Twitter](https://img.shields.io/twitter/follow/stregasgate?style=social)](https://twitter.com/stregasgate)
8-
[![YouTube](https://img.shields.io/youtube/channel/subscribers/UCBXFkK2B4w9856wBJfCGufg?label=Subscribe&style=social)](https://youtube.com/stregasgate)
9-
[![Reddit](https://img.shields.io/reddit/subreddit-subscribers/stregasgate?style=social)](https://www.reddit.com/r/stregasgate/)
10-
[![Discord](https://img.shields.io/discord/641809158051725322?label=Hang%20Out&logo=Discord&style=social)](https://discord.gg/5JdRJhD)
5+
[![HTML5](https://github.com/STREGAsGate/GameMath/actions/workflows/SwiftWasm.yml/badge.svg)](https://github.com/STREGAsGate/GameMath/actions/workflows/SwiftWasm.yml)
116

127
GameMath provides common types, related functions, and operators commonly used for interactive realtime simulations (games).
13-
You can use this library to create simple games, or use it as a cornerstone for a more complex engine.
8+
You can use this library to create simple games, or use it as a cornerstone for a more complex engine like [GateEngine](https://github.com/STREGAsGate/GateEngine).
149

15-
## <img style="vertical-align:middle" src=https://aws1.discourse-cdn.com/swift/original/1X/0a90dde98a223f5841eeca49d89dc9f57592e8d6.png width="35"> Swift 100%
10+
## Swift 100%
1611
GameMath uses protocols and generics to promote clear type intention. Vector types as an example have many variations including `Position3`, `Direction3`, and `Size3` that all conform to`Vector3`, a protocol that provides common functionality to these types.
1712

1813
Operators such as multiplication, division, addition, and subtraction, can be used across types so long as they use the same generic constraint. The type returned will be the logical result of the operation, usually the left side.
@@ -40,36 +35,17 @@ GameMath uses a *Y Up*, *-Z forward*, coordinate system for 3D and *Y Up*, *X Ri
4035
Matrix types are assumed to always be *"left handed"*. Use the `transposedArray` and `transposedSIMD` properties when sending data to Metal, Vulkan, OpenGL, and the `array` and `simd` properties when sending data to DirectX.
4136

4237
# Cross Platform
43-
GameMath is tested to work on Windows 10, macOS, Ubuntu, iOS, and tvOS; all of which work with Swift's minimum deployment target for each platform.
44-
45-
Other platforms should also work. Issues that may appear are likely to be loacted in `math.swift` where the availability of Float80 and Float16 could result in build errors on a platform not listed above.
46-
47-
# Actively In Use
48-
Check out my [YouTube channel](https://www.youtube.com/STREGAsGate) for video devlogs about the games I make using this package.
49-
50-
[![Strega's Gate: Espionage](https://i.ytimg.com/vi/c6XgXY5eM-Y/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLAy8Oua6SfAmSn2uwiv6mkFfii-ZQ)](https://www.youtube.com/STREGAsGate)
51-
[![Strega's Gate: Shifter](https://i.ytimg.com/vi/NhO0EPCIciU/hqdefault.jpg?sqp=-oaymwEiCKgBEF5IWvKriqkDFQgBFQAAAAAYASUAAMhCPQCAokN4AQ==&rs=AOn4CLB-DJuYCPzkHrGUuc1NgsFuSm21kA)](https://www.youtube.com/STREGAsGate)
52-
53-
# ToDo
54-
- **2D**
55-
GameMath has not been used to create a 2D game and may be missing some necessary functionality.
56-
57-
- **Remove Foundation**
58-
Foundation is currently imported in a few places because of math functions like `sin`, `cos`, and `tan` which will be part of the standard library at some point. It is a goal for GameMath to not require any dependencies, so I'd like to remove Foundation as soon as the math proposal gets merged into Swift.
38+
GameMath is tested to work on Windows 10, macOS, Ubuntu, iOS, tvOS, and HTML5.
39+
Other platforms should also work.
5940

60-
# Usage Notes
61-
GameMath is under development and the API surface is not locked-in.
41+
# Support Gate Engine!
42+
This package is seperated for you to enjoy, but it's built for and used by [GateEngine](https://github.com/STREGAsGate/GateEngine).
43+
If you appreciate this project, and want it to continue, then please consider putting some dollars into it.
44+
</br>
45+
Every little bit helps! Support With: [GitHub](https://github.com/sponsors/STREGAsGate), [Ko-fi](https://ko-fi.com/STREGAsGate), [Pateron](https://www.patreon.com/STREGAsGate)
6246

63-
As such please use an explicit commit when adding GameMath to your packages. You may do so like this, while replacing the revision hash with the latests commit's.
64-
```swift
65-
.package(url: "https://github.com/STREGAsGate/GameMath.git", .revision("82d2817f2cf1eca44890d8173145d934bda55517"))
66-
```
67-
Doing this will prevent changes made to GameMath from halting development of your own package. When you are ready to update, use a newer hash and fix any API changes.
68-
69-
API changes are mostly final so changes should not be too much of a hassle, however please be aware they can and will happen.
70-
71-
A tag will be created at some point to mark version 1.0, at which point the `main` branch will become the stable release branch. This will happen once unit tests and a first pass of optimization is done. ETA unknown.
72-
73-
# Game Package Family
74-
This package works great by itself, but it's also included as part of higher level packages that I'm working on.
75-
You can check the availability of these packages on my GitHub profile [@STREGAsGate](https://github.com/STREGAsGate).
47+
## Community & Followables
48+
[![Discord](https://img.shields.io/discord/641809158051725322?label=Hang%20Out&logo=Discord&style=social)](https://discord.gg/5JdRJhD)
49+
[![Twitter](https://img.shields.io/twitter/follow/stregasgate?style=social)](https://twitter.com/stregasgate)
50+
[![YouTube](https://img.shields.io/youtube/channel/subscribers/UCBXFkK2B4w9856wBJfCGufg?label=Subscribe&style=social)](https://youtube.com/stregasgate)
51+
[![Reddit](https://img.shields.io/reddit/subreddit-subscribers/stregasgate?style=social)](https://www.reddit.com/r/stregasgate/)

0 commit comments

Comments
 (0)