@@ -86,41 +86,110 @@ This library aims to offer support for multiple platforms through a single codeb
86
86
```
87
87
https://github.com/neogeek/rhythm-game-utilities.git?path=/UnityPackage
88
88
```
89
- 2 . Import the sample project (optional)
89
+ 1 . Import the sample project (optional)
90
90
- Check the materials to make sure they work in the version of Unity and render pipeline you selected.
91
91
92
92
### Unreal
93
93
94
94
1 . Clone this repo locally (using either a tagged release or the main development branch).
95
- 2 . Add the include path to your ` <project>.Build.cs ` file.
95
+ 1 . Add the include path to your ` <project>.Build.cs ` file.
96
96
``` csharp
97
97
PublicIncludePaths .AddRange (new string [] { " D:/git/github/rhythm-game-utilities/include" });
98
98
```
99
99
100
100
### Godot
101
101
102
- Coming soon.
102
+ #### C#
103
+
104
+ 1 . Clone this repo locally (using either a tagged release or the main development branch).
105
+ 1 . Update your ` .csproj ` file to include a reference to the project:
106
+
107
+ ``` xml
108
+ <ItemGroup >
109
+ <ProjectReference
110
+ Include =" ../../github/rhythm-game-utilities/RhythmGameUtilities/RhythmGameUtilities.csproj" />
111
+ </ItemGroup >
112
+ ```
113
+
114
+ 1 . Add config to your ` .csproj ` file to copy the library files before a build:
115
+
116
+ ``` xml
117
+ <ItemGroup Condition =" $([MSBuild]::IsOSPlatform('Windows'))" >
118
+ <None
119
+ Include =" ../../github/rhythm-game-utilities/RhythmGameUtilities/Libs/Windows/libRhythmGameUtilities.dll" >
120
+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
121
+ </None >
122
+ </ItemGroup >
123
+
124
+ <ItemGroup Condition =" $([MSBuild]::IsOSPlatform('OSX'))" >
125
+ <None
126
+ Include =" ../../github/rhythm-game-utilities/RhythmGameUtilities/Libs/macOS/libRhythmGameUtilities.dylib" >
127
+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
128
+ </None >
129
+ </ItemGroup >
130
+
131
+ <ItemGroup Condition =" $([MSBuild]::IsOSPlatform('Linux'))" >
132
+ <None
133
+ Include =" ../../github/rhythm-game-utilities/RhythmGameUtilities/Libs/Linux/libRhythmGameUtilities.so" >
134
+ <CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
135
+ </None >
136
+ </ItemGroup >
137
+ ```
138
+
139
+ 1 . Create a new script for telling Godot where the library files are located:
140
+
141
+ ``` csharp
142
+ using System ;
143
+ using System .IO ;
144
+ using System .Runtime .InteropServices ;
145
+ using Godot ;
146
+
147
+ public partial class AutoSetupRhythmGameUtilities : Node
148
+ {
149
+ public override void _Ready ()
150
+ {
151
+ NativeLibrary .SetDllImportResolver (typeof (RhythmGameUtilities .Common ).Assembly ,
152
+ (name , assembly , path ) =>
153
+ {
154
+ var libDir = Path .Combine (AppDomain .CurrentDomain .BaseDirectory , " Libs" );
155
+
156
+ return name switch
157
+ {
158
+ " libRhythmGameUtilities.dll" =>
159
+ NativeLibrary .Load (Path .Combine (libDir , " Windows" , name )),
160
+ " libRhythmGameUtilities.dylib" =>
161
+ NativeLibrary .Load (Path .Combine (libDir , " macOS" , name )),
162
+ " libRhythmGameUtilities.so" =>
163
+ NativeLibrary .Load (Path .Combine (libDir , " Linux" , name )),
164
+ _ => NativeLibrary .Load (name , assembly , path )
165
+ };
166
+ });
167
+ }
168
+ }
169
+ ```
170
+
171
+ 1 . Open ** Project** > ** Project Settings** >> ** Globals** and add the script from above to the top of the list.
103
172
104
173
### SDL
105
174
106
175
1 . Clone this repo locally (using either a tagged release or the main development branch).
107
- 2 . Add the include path to your project.
176
+ 1 . Add the include path to your project.
108
177
- VS Code: ` .vscode/c_cpp_properties.json `
109
178
``` json
110
179
"includePath" : [
111
180
" ${workspaceFolder}/**" ,
112
181
" ${HOME}/git/github/rhythm-game-utilities/include/**"
113
182
]
114
183
```
115
- 3 . Add the include path to your build command.
184
+ 1 . Add the include path to your build command.
116
185
- `g++`
117
186
```bash
118
187
g++ -std=c++17 -o build/output src/*.cpp -Isrc \
119
188
-I"${HOME}/git/github/rhythm-game-utilities/include/" \
120
189
-I/opt/homebrew/Cellar/sdl2/2.30.8/include/SDL2 -L/opt/homebrew/Cellar/sdl2/2.30.8/lib \
121
190
-lSDL2
122
191
```
123
- 4 . Add the include path to your CMAKE `CMakeLists.txt` file.
192
+ 1 . Add the include path to your CMAKE `CMakeLists.txt` file.
124
193
```cmake
125
194
include_directories($ENV{HOME}/git/github/rhythm-game-utilities/include/)
126
195
```
0 commit comments