This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
436 additions
and
47 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
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,9 @@ | ||
#pragma once | ||
|
||
#include <hydra/core.h> | ||
|
||
namespace hydra::common | ||
{ | ||
HcArchitecture architecture(); | ||
HcOperatingSystem operatingSystem(); | ||
} // namespace hydra::common |
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,23 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <string_view> | ||
|
||
namespace hydra::common | ||
{ | ||
|
||
// Function for hashing a string in compile time in order to be used in a switch statement | ||
// https://stackoverflow.com/a/46711735 | ||
// If there's a collision between two strings, we will know | ||
// at compile time since the cases can't use the same number twice | ||
constexpr uint32_t str_hash(std::string_view data) noexcept | ||
{ | ||
uint32_t hash = 5381; | ||
const size_t size = data.size(); | ||
for (size_t i = 0; i < size; i++) | ||
hash = ((hash << 5) + hash) + (unsigned char)data[i]; | ||
|
||
return hash; | ||
} | ||
|
||
} // namespace hydra::common |
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,13 @@ | ||
#pragma once | ||
|
||
#include <hydra/core.h> | ||
#include <hydra/core/wrapper.hxx> | ||
#include <memory> | ||
|
||
namespace hydra::core::thread | ||
{ | ||
void start(std::shared_ptr<Wrapper> wrapper); | ||
void stop(); | ||
void reset(HcResetType type); | ||
bool running(); | ||
} // namespace hydra::core::thread |
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,7 @@ | ||
#pragma once | ||
|
||
namespace hydra::imgui | ||
{ | ||
void init(); | ||
void shutdown(); | ||
} // namespace hydra::imgui |
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,46 @@ | ||
#include <hydra/common/system.hxx> | ||
#include <hydra/core.h> | ||
|
||
namespace hydra::common | ||
{ | ||
|
||
HcArchitecture architecture() | ||
{ | ||
#if defined(__x86_64__) || defined(__x86_64) || defined(__amd64) || defined(_M_X64) | ||
return HC_ARCHITECTURE_X86_64; | ||
#elif defined(__i386__) || defined(__i386) || defined(_M_IX86) | ||
return HC_ARCHITECTURE_X86; | ||
#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) | ||
return HC_ARCHITECTURE_AARCH64; | ||
#elif defined(__arm__) | ||
return HC_ARCHITECTURE_AARCH32; | ||
#elif defined(__EMSCRIPTEN__) | ||
return HC_ARCHITECTURE_WASM; | ||
#else | ||
#pragma message("Unknown architecture") | ||
return HC_ARCHITECTURE_UNKNOWN; | ||
#endif | ||
} | ||
|
||
HcOperatingSystem operatingSystem() | ||
{ | ||
#if defined(HYDRA_WINDOWS) | ||
return HC_OPERATING_SYSTEM_WINDOWS; | ||
#elif defined(HYDRA_LINUX) | ||
return HC_OPERATING_SYSTEM_LINUX; | ||
#elif defined(HYDRA_MACOS) | ||
return HC_OPERATING_SYSTEM_MACOS; | ||
#elif defined(HYDRA_FREEBSD) | ||
return HC_OPERATING_SYSTEM_FREEBSD; | ||
#elif defined(HYDRA_WEB) | ||
return HC_OPERATING_SYSTEM_WEB; | ||
#elif defined(HYDRA_IOS) | ||
return HC_OPERATING_SYSTEM_IOS; | ||
#elif defined(HYDRA_ANDROID) | ||
return HC_OPERATING_SYSTEM_ANDROID; | ||
#else | ||
return HC_OPERATING_SYSTEM_UNKNOWN; | ||
#endif | ||
} | ||
|
||
} // namespace hydra::common |
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
Oops, something went wrong.