Skip to content

Commit 198d8a9

Browse files
authored
v1.1.0
v1.1.0
2 parents d810032 + 9c08867 commit 198d8a9

File tree

287 files changed

+9535
-2347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+9535
-2347
lines changed

.github/workflows/autorelease.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,17 @@ jobs:
6262
shell: sh
6363

6464

65+
- name: Get commit message
66+
id: get_commit_message
67+
run: |
68+
commit_message=$(curl --location --request GET 'https://api.github.com/repos/$GITHUB_REPOSITORY/commits/${{ github.sha }}' \
69+
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq -r ".commit.message")
70+
echo "::set-output name=commit_message::$commit_message"
71+
6572
- name: Release pushed tag
6673
env:
6774
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68-
tag: ${{ github.ref_name }}
75+
tag: ${{ steps.get_commit_message.outputs.commit_message }}
6976
run: |
7077
gh release create "$tag" \
7178
--repo="$GITHUB_REPOSITORY" \

.github/workflows/linter.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,23 @@ name: ClangFormat Linter
22

33
on:
44
push:
5-
branches:
5+
branches-ignore:
66
- dev
77
- client
88
- server
99
- game-engine
10-
- fix/CICD
11-
pull_request:
12-
branches:
13-
- dev
14-
- client
15-
- server
16-
- game-engine
17-
- fix/CICD
10+
- main
1811

1912
jobs:
2013
build:
2114
runs-on: ubuntu-latest
2215
steps:
16+
- name: "Check if on a branch"
17+
run: |
18+
if [[ "${{ github.ref }}" != refs/heads/* ]]; then
19+
echo "Not on a branch, skipping job."
20+
exit 78
21+
fi
2322
- uses: actions/checkout@v2
2423
- name: "Install clang-format"
2524
run: sudo apt-get install -y clang-format

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ bin*
4141
ExodiaProfile-*.json
4242

4343
# Binaries for programs and plugins
44-
r-type_client
45-
r-type_server
44+
r-type_*
4645
exodia
4746

4847
# ImGui
@@ -55,6 +54,9 @@ vgcore.*
5554
.idea/
5655
.vscode/
5756

58-
#Windows
57+
# Windows
5958
Release/
60-
Debug/Assets/
59+
Debug/Assets/
60+
61+
# R-Type
62+
.rtype

3rd-party/Vcpkg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 72010900b7cee36cea77aebb97695095c9358eaf

Assets/AssetRegistry.asset

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,21 @@ AssetRegistry:
137137
- Handle: 124013371145915
138138
Path: Sound/Music/BattleTheme.wav
139139
Type: AssetType::Sound2D
140+
- Handle: 45121874124124
141+
Path: Font/R-Type/Classic.png
142+
Type: AssetType::Font
143+
- Handle: 4521854574125
144+
Path: Font/R-Type/ClassicColored.png
145+
Type: AssetType::Font
140146
- Handle: 18375016605620543235
141147
Path: test.exodia
142148
Type: AssetType::Scene
143149
- Handle: 18375012605620
144150
Path: Textures/Missile.png
151+
Type: AssetType::Texture2D
152+
- Handle: 183750131800543235
153+
Path: Textures/Simple_Explosion.png
154+
Type: AssetType::Texture2D
155+
- Handle: 1837501318005432356
156+
Path: Textures/Explosion.png
145157
Type: AssetType::Texture2D

Assets/Font/R-Type/Classic.png

47.8 KB
Loading

Assets/Font/R-Type/ClassicColored.png

61.2 KB
Loading

CMake/Dependencies.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ find_package(glad CONFIG REQUIRED) # glad::glad
1414
# -- Audio Library ---------------------------------------------------------
1515
find_package(OpenAL CONFIG REQUIRED) # OpenAL::OpenAL
1616
find_package(FreeALUT CONFIG REQUIRED) # FreeALUT::alut
17+
find_package(Vorbis CONFIG REQUIRED) # Vorbis::vorbisfile
1718

1819
# -- Serialization Library -------------------------------------------------
1920
find_package(yaml-cpp CONFIG REQUIRED) # yaml-cpp::yaml-cpp

Client/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ target_link_libraries(r-type_client PRIVATE
6666
yaml-cpp::yaml-cpp
6767
imguizmo::imguizmo
6868
FreeALUT::alut
69+
Vorbis::vorbisfile
6970
)
7071

7172
target_include_directories(r-type_client PRIVATE ${Stb_INCLUDE_DIR})

Client/src/Layer/RTypeLayer.cpp

Lines changed: 83 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
#include <imgui.h>
1010
#include <glm/gtc/matrix_transform.hpp>
1111
#include <glm/gtc/type_ptr.hpp>
12+
#include <sstream>
1213

13-
namespace Exodia {
14+
using namespace Exodia;
15+
16+
namespace RType {
1417

1518
//////////////////////////////
1619
// Constructor & Destructor //
@@ -22,35 +25,49 @@ namespace Exodia {
2225
// Methods //
2326
/////////////
2427

25-
void RTypeLayer::OnAttach() {
26-
EXODIA_PROFILE_FUNCTION();
28+
int RTypeLayer::GetPort() {
2729

28-
auto commandLine = Application::Get().GetSpecification().CommandLineArgs;
30+
ApplicationCommandLineArgs commandLine = Application::Get().GetSpecification().CommandLineArgs;
2931

30-
// TODO: Temp port ./r-type_client -p {port}
32+
// TODO: Temp port ./r-type_client {port}
3133
int port = 8083; // Default port
3234
if (commandLine.Count > 1) {
3335
port = std::stoi(commandLine[1]);
3436

3537
if (port < 1024 || port > 65535) {
3638
Application::Get().Close();
37-
return;
39+
return -1;
3840
}
3941
}
42+
return port;
43+
}
4044

45+
void RTypeLayer::ConnectToServer(int port) {
4146
_Network = CreateScope<Network::Network>(_WorldNetwork, _IOContextManager, port);
4247

4348
_Network->Loop();
44-
_Network->SendAskConnect("127.0.0.1",
45-
8082); // TODO: change ip and port when the server is on a different machine
49+
_Network->SendAskConnect("127.0.0.1", 8082);
50+
// TODO: change ip and port when the server is on a different machine
51+
}
52+
53+
void RTypeLayer::OnAttach() {
54+
EXODIA_PROFILE_FUNCTION();
55+
56+
int port = GetPort();
57+
58+
if (port == -1)
59+
return;
60+
61+
ConnectToServer(port);
62+
4663
// Create world
4764
CurrentScene = GAME;
4865

49-
Scenes[MENU] = CreateRef<Scene>();
50-
Scenes[MENU]->RegisterSystem(new AnimationSystem());
51-
Scenes[MENU]->RegisterSystem(new MovingSystem(1.5f));
52-
Scenes[MENU]->OnViewportResize(Application::Get().GetWindow().GetWidth(),
53-
Application::Get().GetWindow().GetHeight());
66+
// Scenes[MENU] = CreateRef<Scene>();
67+
// Scenes[MENU]->RegisterSystem(new AnimationSystem());
68+
// Scenes[MENU]->RegisterSystem(new MovingSystem(1.5f));
69+
// Scenes[MENU]->OnViewportResize(Application::Get().GetWindow().GetWidth(),
70+
// Application::Get().GetWindow().GetHeight());
5471

5572
// RType::EntityEventSubscriber *subscribe = new RType::EntityEventSubscriber(_Network);
5673
CollisionSystem *collisionSystem = new CollisionSystem();
@@ -61,13 +78,27 @@ namespace Exodia {
6178
Scenes[GAME]->RegisterSystem(collisionSystem);
6279
// Scenes[GAME]->Subscribe<Events::OnEntityCreated>(subscribe);
6380
// Scenes[GAME]->Subscribe<Events::OnEntityDestroyed>(subscribe);
64-
Scenes[GAME]->Subscribe<Events::OnCollisionEntered>(collisionSystem);
81+
Scenes[GAME]->Subscribe<Exodia::Events::OnCollisionEntered>(collisionSystem);
6582
Scenes[GAME]->OnViewportResize(Application::Get().GetWindow().GetWidth(),
6683
Application::Get().GetWindow().GetHeight());
6784

68-
Entity *music = Scenes[GAME]->CreateEntity("Background");
85+
// Entity *music = Scenes[GAME]->CreateEntity("Background");
86+
87+
// music->AddComponent<MusicComponent>(124013371145915, 0.5f, true);
6988

70-
music->AddComponent<MusicComponent>(124013371145915, 0.5f, true);
89+
// Entity *text = Scenes[GAME]->CreateEntity("Text");
90+
91+
// auto txt = text->AddComponent<TextRendererComponent>("\"From the dark regions of space they\n came...Waging
92+
// war upon us.\n One saviour stood his ground while all\n others were crushed under the alien\n assaul t...\n\n
93+
// The Prototype Markl .\"");
94+
95+
// txt.Get().Font = UUID(4521854574125);
96+
// txt.Get().Font = UUID(45121874124124);
97+
98+
// auto transform = text->GetComponent<TransformComponent>();
99+
100+
// transform.Get().Translation = {-10.0f, 3.0f, 0.0f};
101+
// transform.Get().Scale = {0.50f, 0.50f, 1.0f};
71102

72103
_Network->SetWorld(Scenes[CurrentScene]->GetWorldPtr());
73104

@@ -76,12 +107,17 @@ namespace Exodia {
76107
// Create the camera entity
77108
Entity *cameraEntity = Scenes[GAME]->CreateEntity("Camera");
78109

79-
auto &camera = cameraEntity->AddComponent<CameraComponent>().Get();
110+
CameraComponent &camera = cameraEntity->AddComponent<CameraComponent>().Get();
80111
cameraEntity->GetComponent<TransformComponent>().Get().Translation = {0.0f, 0.0f, 15.0f};
81112
camera.Camera.SetProjectionType(SceneCamera::ProjectionType::Perspective);
82113
camera.Camera.SetViewportSize(Application::Get().GetWindow().GetWidth(),
83114
Application::Get().GetWindow().GetHeight());
84115

116+
/*RType::EntityEventSubscriber *subscribe = new RType::EntityEventSubscriber(*_Network);
117+
118+
Scenes[GAME]->Subscribe<Events::OnEntityCreated>(subscribe);
119+
Scenes[GAME]->Subscribe<Events::OnEntityDestroyed>(subscribe);*/
120+
85121
/* Removing rigid body for static camera
86122
auto body_camera = cameraEntity->AddComponent<RigidBody2DComponent>();
87123
body_camera.Get().Type = RigidBody2DComponent::BodyType::Dynamic;
@@ -91,21 +127,21 @@ namespace Exodia {
91127
*/
92128

93129
// Create the entities
94-
// CreatePlayer(Scenes, 0);
130+
// TODO: Ask server for playerID
131+
// int playerID = 0;
132+
// Entity *entity = Scenes[GAME]->CreateEntity("Player_" + std::to_string(playerID));
133+
// entity->AddComponent<ScriptComponent>().Get().Bind("Player");
95134

96135
// Create pata-pata
97-
// CreatePataPata(Scenes);
98-
99-
Entity *cameraMenu = Scenes[MENU]->CreateEntity("Camera");
100-
101-
auto &camera_ = cameraMenu->AddComponent<CameraComponent>().Get();
102-
cameraMenu->GetComponent<TransformComponent>().Get().Translation = {0.0f, 0.0f, 15.0f};
103-
camera_.Camera.SetProjectionType(SceneCamera::ProjectionType::Perspective);
104-
camera_.Camera.SetViewportSize(1600, 900);
105-
cameraMenu->AddComponent<RigidBody2DComponent>().Get().Type = RigidBody2DComponent::BodyType::Static;
136+
// Entity *patata = Scenes[GAME]->CreateEntity("Pata-pata");
137+
// patata->AddComponent<ScriptComponent>().Get().Bind("PataPata");
106138

107139
// Create stars
108140
// CreateStars(Scenes);
141+
for (int i = 0; i < 60; i++) {
142+
Entity *star = Scenes[GAME]->CreateEntity("Star" + std::to_string(i));
143+
star->AddComponent<ScriptComponent>().Get().Bind("Star");
144+
}
109145

110146
// Create the camera
111147
Scenes[CurrentScene]->OnRuntimeStart();
@@ -147,16 +183,19 @@ namespace Exodia {
147183

148184
Scenes[CurrentScene]->GetWorld().LockMutex();
149185
Scenes[CurrentScene]->GetWorld().ForEach<ScriptComponent, TagComponent>(
150-
[&](Entity *entity, auto script, auto tag) {
151-
auto &sc = script.Get();
152-
auto &tc = tag.Get();
186+
[&](Entity *entity, ComponentHandle<ScriptComponent> script, ComponentHandle<TagComponent> tag) {
187+
ScriptComponent &sc = script.Get();
188+
TagComponent &tc = tag.Get();
153189

154-
if ((tc.Tag.compare("Player_" + _Network->id) == 0) && sc.Instance != nullptr) {
155-
sc.Instance->OnKeyPressed(key);
190+
std::ostringstream oss;
191+
oss << _Network->GetId();
192+
std::string player = "Player_" + oss.str();
156193

157-
_Network->SendEvent(key, true);
158-
}
194+
if ((tc.Tag.compare(player) == 0) && sc.Instance != nullptr) {
195+
// sc.Instance->OnKeyPressed(key);
159196

197+
_Network->SendEvent(false, key, true);
198+
}
160199
(void)entity;
161200
});
162201
Scenes[CurrentScene]->GetWorld().UnlockMutex();
@@ -165,19 +204,21 @@ namespace Exodia {
165204
};
166205

167206
bool RTypeLayer::OnKeyReleasedEvent(KeyReleasedEvent &event) {
168-
169207
int key = event.GetKeyCode();
170208

171209
Scenes[CurrentScene]->GetWorld().LockMutex();
172210
Scenes[CurrentScene]->GetWorld().ForEach<ScriptComponent, TagComponent>(
173-
[&](Entity *entity, auto script, auto tag) {
174-
auto &sc = script.Get();
175-
auto &tc = tag.Get();
211+
[&](Entity *entity, ComponentHandle<ScriptComponent> script, ComponentHandle<TagComponent> tag) {
212+
ScriptComponent &sc = script.Get();
213+
TagComponent &tc = tag.Get();
176214

177-
if ((tc.Tag.compare("Player_" + _Network->id) == 0) && sc.Instance != nullptr) {
178-
sc.Instance->OnKeyReleased(key);
215+
std::ostringstream oss;
216+
oss << _Network->GetId();
217+
std::string player = "Player_" + oss.str();
179218

180-
_Network->SendEvent(key, false);
219+
if ((tc.Tag.compare(player) == 0) && sc.Instance != nullptr) {
220+
sc.Instance->OnKeyReleased(key);
221+
_Network->SendEvent(false, key, false);
181222
}
182223

183224
(void)entity;
@@ -193,4 +234,4 @@ namespace Exodia {
193234

194235
return true;
195236
}
196-
}; // namespace Exodia
237+
}; // namespace RType

Client/src/Layer/RTypeLayer.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include "Exodia.hpp"
1212
#include "R-Type.hpp"
1313

14-
namespace Exodia {
14+
using namespace Exodia;
15+
16+
namespace RType {
1517

1618
class RTypeLayer : public Exodia::Layer {
1719

@@ -37,6 +39,10 @@ namespace Exodia {
3739
bool OnKeyPressedEvent(KeyPressedEvent &event);
3840
bool OnWindowResizeEvent(WindowResizeEvent &event);
3941

42+
private:
43+
int GetPort();
44+
void ConnectToServer(int port);
45+
4046
////////////////
4147
// Attributes //
4248
////////////////
@@ -51,6 +57,6 @@ namespace Exodia {
5157
Network::IOContextManager _IOContextManager;
5258
Scope<Network::Network> _Network;
5359
};
54-
}; // namespace Exodia
60+
}; // namespace RType
5561

5662
#endif /* !RTYPELAYER_HPP_ */

Client/src/RType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Exodia {
1717
// Constructor & Destructor //
1818
//////////////////////////////
1919
public:
20-
RTypeClient(const ApplicationSpecification &spec) : Application(spec) { PushLayer(new RTypeLayer()); }
20+
RTypeClient(const ApplicationSpecification &spec) : Application(spec) { PushLayer(new RType::RTypeLayer()); }
2121

2222
~RTypeClient() = default;
2323
};

Examples/Network/ComponentSend/Server/src/Server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ namespace Exodia {
137137
sprite.Get().Texture =
138138
SubTexture2D::CreateFromCoords(90123456789012678, {0.0f, 0.0f}, {33.3125f, 36.0f}, {1.0f, 1.0f});
139139

140-
_network.SendComponentOf(patata, "SpriteRendererComponent");
140+
_network.SendComponentOf(false, patata, "SpriteRendererComponent");
141141
}
142142
_World->OnUpdateRuntime(timestep);
143143
} catch (std::exception &e) {

0 commit comments

Comments
 (0)