Road to 0.6.0

- readd the c++ linear allocator for 3ds
- start switching from PD::Vec to std::vector
- Add Color::Hex as constexpr for compiletime color converts
- Add FNV Hasing functions
- Make UI7 ids be able to be generated at compile time
- Added a Throw Function (for whatever)
- Added HexCHar2Int (replaces the lookup table)
- Made u128 fully constexpr
This commit is contained in:
2025-12-10 19:02:54 +01:00
parent 91754558f7
commit f19c947fc3
23 changed files with 262 additions and 120 deletions

View File

@@ -45,8 +45,8 @@ class ID {
* used when directly placing a string istead of using ID("")
* @param text Input String
*/
ID(const char* text) {
pID = PD::Strings::FastHash(text);
constexpr ID(const char* text) {
pID = PD::FNV1A32(text);
pName = text;
}
/**
@@ -56,16 +56,17 @@ class ID {
~ID() = default;
/** Get The ID Initial Name */
const std::string& GetName() const { return pName; }
constexpr const std::string_view& GetNameView() const { return pName; }
const std::string GetName() const { return std::string(pName); }
/** Getter for the raw 32bit int id */
const u32& RawID() const { return pID; }
constexpr const u32& RawID() const { return pID; }
/** Return the ID when casting to u32 */
operator u32() const { return pID; }
constexpr operator u32() const { return pID; }
u32 pID; ///< Hash of the name
std::string pName; ///< Name
u32 pID; ///< Hash of the name
std::string_view pName; ///< Name
};
} // namespace UI7
} // namespace PD

View File

@@ -52,7 +52,7 @@ class PD_UI7_API Layout {
PD_SHARED(Layout);
const std::string& GetName() const { return ID.GetName(); }
const std::string GetName() const { return ID.GetName(); }
const UI7::ID& GetID() const { return this->ID; }
const fvec2& GetPosition() const { return Pos; }

View File

@@ -37,7 +37,7 @@ SOFTWARE.
* Major Minor Patch Build
* 0x01010000 -> 1.1.0-0
*/
#define UI7_VERSION 0x00050100
#define UI7_VERSION 0x00060000
namespace PD {
namespace UI7 {
@@ -55,18 +55,18 @@ class PD_UI7_API Context {
PD_SHARED(Context);
void AddViewPort(const ID &id, const ivec4 &vp);
void UseViewPort(const ID &id);
void AddViewPort(const ID& id, const ivec4& vp);
void UseViewPort(const ID& id);
void Update();
bool BeginMenu(const ID &id, UI7MenuFlags flags = 0, bool *pShow = nullptr);
bool BeginMenu(const ID& id, UI7MenuFlags flags = 0, bool* pShow = nullptr);
void EndMenu();
void AboutMenu(bool *show = nullptr);
void MetricsMenu(bool *show = nullptr);
void StyleEditor(bool *show = nullptr);
void AboutMenu(bool* show = nullptr);
void MetricsMenu(bool* show = nullptr);
void StyleEditor(bool* show = nullptr);
Li::DrawList::Ref GetDrawData() { return pIO->FDL; }
Menu::Ref pGetOrCreateMenu(const ID &id) {
Menu::Ref pGetOrCreateMenu(const ID& id) {
auto menu = pMenus.find(id);
if (menu == pMenus.end()) {
pMenus[id] = Menu::New(id, pIO);