-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(wip): rebuild project with structure
- Loading branch information
Showing
24 changed files
with
620 additions
and
1,379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <discord-game-sdk/discord_game_sdk.h> | ||
#include <discord-game-sdk/discord.h> | ||
|
||
#include <memory> | ||
|
||
namespace Carbon { | ||
class DiscordManager { | ||
public: | ||
DiscordManager(); | ||
~DiscordManager(); | ||
|
||
void UpdateActivity() const; | ||
discord::Activity& GetActivity(); | ||
|
||
void Update(); | ||
|
||
discord::User currentUser = discord::User{}; | ||
discord::Activity currentActivity = discord::Activity{}; | ||
|
||
std::unique_ptr<discord::Core> core = nullptr; | ||
}; | ||
}; // namespace Carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#define GLFW_INCLUDE_NONE | ||
|
||
#include <thread> | ||
#include <mutex> | ||
|
||
namespace Carbon { | ||
class GameManager { | ||
public: | ||
GameManager(); | ||
~GameManager(); | ||
|
||
bool IsGameRunning(); | ||
|
||
void StartGame(); | ||
void KillGame(); | ||
|
||
// TODO: Send a message to the | ||
// supervisor to kill the game | ||
// void KillGame(); | ||
|
||
private: | ||
// Checks every 1s if the game is running | ||
std::thread gameStatusThread; | ||
std::mutex gameStatusMutex; | ||
|
||
bool gameRunning = false; | ||
}; | ||
}; // namespace Carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#define GLFW_INCLUDE_NONE | ||
|
||
#include <Windows.h> | ||
|
||
#include <functional> | ||
|
||
#include <GLFW/glfw3.h> | ||
|
||
namespace Carbon { | ||
class GUIManager { | ||
public: | ||
GUIManager(HINSTANCE hInstance); | ||
~GUIManager(); | ||
|
||
void RenderCallback(std::function<void()> callback) { | ||
this->renderCallback = callback; | ||
} | ||
|
||
void Run(); | ||
|
||
GLFWwindow* window; | ||
std::function<void()> renderCallback; | ||
}; | ||
}; // namespace Carbon | ||
|
||
void _GUI(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#pragma once | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#include <Windows.h> | ||
|
||
#include <optional> | ||
#include <vector> | ||
#include <string> | ||
#include <thread> | ||
#include <mutex> | ||
#include <queue> | ||
|
||
namespace Carbon { | ||
enum class PacketType { | ||
LOADED, // Sent when the game is loaded | ||
STATECHANGE, // Sent when the game state changes (e.g. menu -> game) | ||
LOG, // (e.g.game log [will be implemented later]) | ||
UNKNOWNTYPE // Unknown packet type | ||
}; | ||
|
||
class Packet { | ||
public: | ||
PacketType type = PacketType::UNKNOWNTYPE; | ||
std::optional<std::string> data; | ||
}; | ||
|
||
class PipeManager { | ||
public: | ||
PipeManager(); | ||
~PipeManager(); | ||
|
||
bool pipeInitialized = false; | ||
|
||
std::mutex pipeMutex; | ||
std::queue<Packet> packets = {}; | ||
|
||
std::queue<Packet>& GetPackets() { | ||
std::lock_guard<std::mutex> lock(this->pipeMutex); | ||
return this->packets; | ||
} | ||
|
||
private: | ||
std::thread pipeReader; | ||
}; | ||
}; // namespace Carbon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "guimanager.h" | ||
#include "discordmanager.h" | ||
#include "gamemanager.h" | ||
#include "pipemanager.h" | ||
|
||
namespace Carbon { | ||
class CarbonState_t { | ||
public: | ||
Carbon::GUIManager* guiManager; | ||
Carbon::DiscordManager* discordManager; | ||
Carbon::GameManager* gameManager; | ||
Carbon::PipeManager* pipeManager; | ||
}; | ||
}; // namespace Carbon | ||
|
||
extern Carbon::CarbonState_t C; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.