mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-12 01:36:57 +00:00
feat!: rewrote program in a data oriented style.
This is because the source code is objected oriented which is not cpu cache friendly, making the program slower than it has to be. Yuzu's entire codebase is written in a objected oriented way and I wonder how much faster it could if they had use DoD principles from the very beginning. That's why I want to instill DoD fundamentals early on so this won't be a problem going forward. Signed-off-by: Ronald Caesar <github43132@proton.me>
This commit is contained in:
parent
653b84c264
commit
ba45834583
26 changed files with 1179 additions and 1162 deletions
34
gui/color.cpp
Executable file
34
gui/color.cpp
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#include "color.h"
|
||||
|
||||
ImVec4 gui::color::with_alpha(const ImVec4& color, float alpha)
|
||||
{
|
||||
auto vec = ImVec4(color.x, color.y, color.z, alpha);
|
||||
return vec;
|
||||
}
|
||||
|
||||
ImVec4 gui::color::lighten(const ImVec4& color, float amount)
|
||||
{
|
||||
float x = std::min(1.0F, color.x + amount);
|
||||
float y = std::min(1.0F, color.y + amount);
|
||||
float z = std::min(1.0F, color.z + amount);
|
||||
auto vec = ImVec4(x, y, z, color.w);
|
||||
return vec;
|
||||
}
|
||||
|
||||
ImVec4 gui::color::darken(const ImVec4& color, float amount)
|
||||
{
|
||||
float x = std::max(0.0F, color.x - amount);
|
||||
float y = std::max(0.0F, color.y - amount);
|
||||
float z = std::max(0.0F, color.z - amount);
|
||||
auto vec = ImVec4(x, y, z, color.w);
|
||||
return vec;
|
||||
}
|
||||
|
||||
ImVec4 gui::color::from_hex(uint32_t hex, float alpha)
|
||||
{
|
||||
float r = static_cast<float>(((hex >> 16) & 0xFF)) / 255.0f;
|
||||
float g = static_cast<float>(((hex >> 8) & 0xFF)) / 255.0f;
|
||||
float b = static_cast<float>((hex & 0xFF)) / 255.0f;
|
||||
auto vec = ImVec4(r, g, b, alpha);
|
||||
return vec;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue