Skip to content

Commit 6c4a177

Browse files
committed
Added Godot instructions to README.md
1 parent 5b1d053 commit 6c4a177

File tree

3 files changed

+225
-18
lines changed

3 files changed

+225
-18
lines changed

Documentation/Install.md

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,110 @@
66
```
77
https://github.com/neogeek/rhythm-game-utilities.git?path=/UnityPackage
88
```
9-
2. Import the sample project (optional)
9+
1. Import the sample project (optional)
1010
- Check the materials to make sure they work in the version of Unity and render pipeline you selected.
1111

1212
### Unreal
1313

1414
1. Clone this repo locally (using either a tagged release or the main development branch).
15-
2. Add the include path to your `<project>.Build.cs` file.
15+
1. Add the include path to your `<project>.Build.cs` file.
1616
```csharp
1717
PublicIncludePaths.AddRange(new string[] { "D:/git/github/rhythm-game-utilities/include" });
1818
```
1919

2020
### Godot
2121

22-
Coming soon.
22+
#### C#
23+
24+
1. Clone this repo locally (using either a tagged release or the main development branch).
25+
1. Update your `.csproj` file to include a reference to the project:
26+
27+
```xml
28+
<ItemGroup>
29+
<ProjectReference
30+
Include="../../github/rhythm-game-utilities/RhythmGameUtilities/RhythmGameUtilities.csproj" />
31+
</ItemGroup>
32+
```
33+
34+
1. Add config to your `.csproj` file to copy the library files before a build:
35+
36+
```xml
37+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
38+
<None
39+
Include="../../github/rhythm-game-utilities/RhythmGameUtilities/Libs/Windows/libRhythmGameUtilities.dll">
40+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
41+
</None>
42+
</ItemGroup>
43+
44+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
45+
<None
46+
Include="../../github/rhythm-game-utilities/RhythmGameUtilities/Libs/macOS/libRhythmGameUtilities.dylib">
47+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
48+
</None>
49+
</ItemGroup>
50+
51+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
52+
<None
53+
Include="../../github/rhythm-game-utilities/RhythmGameUtilities/Libs/Linux/libRhythmGameUtilities.so">
54+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
55+
</None>
56+
</ItemGroup>
57+
```
58+
59+
1. Create a new script for telling Godot where the library files are located:
60+
61+
```csharp
62+
using System;
63+
using System.IO;
64+
using System.Runtime.InteropServices;
65+
using Godot;
66+
67+
public partial class AutoSetupRhythmGameUtilities : Node
68+
{
69+
public override void _Ready()
70+
{
71+
NativeLibrary.SetDllImportResolver(typeof(RhythmGameUtilities.Common).Assembly,
72+
(name, assembly, path) =>
73+
{
74+
var libDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Libs");
75+
76+
return name switch
77+
{
78+
"libRhythmGameUtilities.dll" =>
79+
NativeLibrary.Load(Path.Combine(libDir, "Windows", name)),
80+
"libRhythmGameUtilities.dylib" =>
81+
NativeLibrary.Load(Path.Combine(libDir, "macOS", name)),
82+
"libRhythmGameUtilities.so" =>
83+
NativeLibrary.Load(Path.Combine(libDir, "Linux", name)),
84+
_ => NativeLibrary.Load(name, assembly, path)
85+
};
86+
});
87+
}
88+
}
89+
```
90+
91+
1. Open **Project** > **Project Settings** >> **Globals** and add the script from above to the top of the list.
2392

2493
### SDL
2594

2695
1. Clone this repo locally (using either a tagged release or the main development branch).
27-
2. Add the include path to your project.
96+
1. Add the include path to your project.
2897
- VS Code: `.vscode/c_cpp_properties.json`
2998
```json
3099
"includePath": [
31100
"${workspaceFolder}/**",
32101
"${HOME}/git/github/rhythm-game-utilities/include/**"
33102
]
34103
```
35-
3. Add the include path to your build command.
104+
1. Add the include path to your build command.
36105
- `g++`
37106
```bash
38107
g++ -std=c++17 -o build/output src/*.cpp -Isrc \
39108
-I"${HOME}/git/github/rhythm-game-utilities/include/" \
40109
-I/opt/homebrew/Cellar/sdl2/2.30.8/include/SDL2 -L/opt/homebrew/Cellar/sdl2/2.30.8/lib \
41110
-lSDL2
42111
```
43-
4. Add the include path to your CMAKE `CMakeLists.txt` file.
112+
1. Add the include path to your CMAKE `CMakeLists.txt` file.
44113
```cmake
45114
include_directories($ENV{HOME}/git/github/rhythm-game-utilities/include/)
46115
```

README.md

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,41 +86,110 @@ This library aims to offer support for multiple platforms through a single codeb
8686
```
8787
https://github.com/neogeek/rhythm-game-utilities.git?path=/UnityPackage
8888
```
89-
2. Import the sample project (optional)
89+
1. Import the sample project (optional)
9090
- Check the materials to make sure they work in the version of Unity and render pipeline you selected.
9191

9292
### Unreal
9393

9494
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.
9696
```csharp
9797
PublicIncludePaths.AddRange(new string[] { "D:/git/github/rhythm-game-utilities/include" });
9898
```
9999

100100
### Godot
101101

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.
103172

104173
### SDL
105174

106175
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.
108177
- VS Code: `.vscode/c_cpp_properties.json`
109178
```json
110179
"includePath": [
111180
"${workspaceFolder}/**",
112181
"${HOME}/git/github/rhythm-game-utilities/include/**"
113182
]
114183
```
115-
3. Add the include path to your build command.
184+
1. Add the include path to your build command.
116185
- `g++`
117186
```bash
118187
g++ -std=c++17 -o build/output src/*.cpp -Isrc \
119188
-I"${HOME}/git/github/rhythm-game-utilities/include/" \
120189
-I/opt/homebrew/Cellar/sdl2/2.30.8/include/SDL2 -L/opt/homebrew/Cellar/sdl2/2.30.8/lib \
121190
-lSDL2
122191
```
123-
4. Add the include path to your CMAKE `CMakeLists.txt` file.
192+
1. Add the include path to your CMAKE `CMakeLists.txt` file.
124193
```cmake
125194
include_directories($ENV{HOME}/git/github/rhythm-game-utilities/include/)
126195
```

UnityPackage/README.md

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,41 +86,110 @@ This library aims to offer support for multiple platforms through a single codeb
8686
```
8787
https://github.com/neogeek/rhythm-game-utilities.git?path=/UnityPackage
8888
```
89-
2. Import the sample project (optional)
89+
1. Import the sample project (optional)
9090
- Check the materials to make sure they work in the version of Unity and render pipeline you selected.
9191

9292
### Unreal
9393

9494
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.
9696
```csharp
9797
PublicIncludePaths.AddRange(new string[] { "D:/git/github/rhythm-game-utilities/include" });
9898
```
9999

100100
### Godot
101101

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.
103172

104173
### SDL
105174

106175
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.
108177
- VS Code: `.vscode/c_cpp_properties.json`
109178
```json
110179
"includePath": [
111180
"${workspaceFolder}/**",
112181
"${HOME}/git/github/rhythm-game-utilities/include/**"
113182
]
114183
```
115-
3. Add the include path to your build command.
184+
1. Add the include path to your build command.
116185
- `g++`
117186
```bash
118187
g++ -std=c++17 -o build/output src/*.cpp -Isrc \
119188
-I"${HOME}/git/github/rhythm-game-utilities/include/" \
120189
-I/opt/homebrew/Cellar/sdl2/2.30.8/include/SDL2 -L/opt/homebrew/Cellar/sdl2/2.30.8/lib \
121190
-lSDL2
122191
```
123-
4. Add the include path to your CMAKE `CMakeLists.txt` file.
192+
1. Add the include path to your CMAKE `CMakeLists.txt` file.
124193
```cmake
125194
include_directories($ENV{HOME}/git/github/rhythm-game-utilities/include/)
126195
```

0 commit comments

Comments
 (0)