mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-12 01:36:57 +00:00
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>
34 lines
997 B
C++
Executable file
34 lines
997 B
C++
Executable file
#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;
|
|
}
|