mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 15:15:37 +00:00
Replaced the internal Vector3f and Vector4f data types and functions with the GLM library equivalents.
This commit is contained in:
parent
722468129e
commit
64a7b8e54a
|
@ -78,8 +78,8 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
|||
folderPath + Utils::FileSystem::getFileName(scraperParams.game->getPath()) + " [" +
|
||||
Utils::String::toUpper(scraperParams.system->getName()) + "]" +
|
||||
(scraperParams.game->getType() == FOLDER ? " " + ViewController::FOLDER_CHAR : ""),
|
||||
Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_CENTER, Vector3f(0.0f, 0.0f, 0.0f),
|
||||
Vector2f(0.0f, 0.0f), 0x00000000, 0.05f);
|
||||
Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_CENTER, glm::vec3 {}, Vector2f(0.0f, 0.0f),
|
||||
0x00000000, 0.05f);
|
||||
mHeaderGrid->setEntry(mTitle, Vector2i(0, 1), false, true);
|
||||
mHeaderGrid->setEntry(mSubtitle, Vector2i(0, 3), false, true);
|
||||
|
||||
|
|
|
@ -87,18 +87,14 @@ GuiScraperSearch::GuiScraperSearch(Window* window, SearchType type, unsigned int
|
|||
mMD_ReleaseDate = std::make_shared<DateTimeEditComponent>(mWindow);
|
||||
mMD_ReleaseDate->setColor(mdColor);
|
||||
mMD_ReleaseDate->setUppercase(true);
|
||||
mMD_Developer =
|
||||
std::make_shared<TextComponent>(mWindow, "", font, mdColor, ALIGN_LEFT, Vector3f::Zero(),
|
||||
Vector2f::Zero(), 0x00000000, 0.02f);
|
||||
mMD_Publisher =
|
||||
std::make_shared<TextComponent>(mWindow, "", font, mdColor, ALIGN_LEFT, Vector3f::Zero(),
|
||||
Vector2f::Zero(), 0x00000000, 0.02f);
|
||||
mMD_Genre =
|
||||
std::make_shared<TextComponent>(mWindow, "", font, mdColor, ALIGN_LEFT, Vector3f::Zero(),
|
||||
Vector2f::Zero(), 0x00000000, 0.02f);
|
||||
mMD_Players =
|
||||
std::make_shared<TextComponent>(mWindow, "", font, mdColor, ALIGN_LEFT, Vector3f::Zero(),
|
||||
Vector2f::Zero(), 0x00000000, 0.02f);
|
||||
mMD_Developer = std::make_shared<TextComponent>(
|
||||
mWindow, "", font, mdColor, ALIGN_LEFT, glm::vec3 {}, Vector2f::Zero(), 0x00000000, 0.02f);
|
||||
mMD_Publisher = std::make_shared<TextComponent>(
|
||||
mWindow, "", font, mdColor, ALIGN_LEFT, glm::vec3 {}, Vector2f::Zero(), 0x00000000, 0.02f);
|
||||
mMD_Genre = std::make_shared<TextComponent>(mWindow, "", font, mdColor, ALIGN_LEFT,
|
||||
glm::vec3 {}, Vector2f::Zero(), 0x00000000, 0.02f);
|
||||
mMD_Players = std::make_shared<TextComponent>(
|
||||
mWindow, "", font, mdColor, ALIGN_LEFT, glm::vec3 {}, Vector2f::Zero(), 0x00000000, 0.02f);
|
||||
mMD_Filler = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
|
||||
|
||||
if (Settings::getInstance()->getString("Scraper") != "thegamesdb")
|
||||
|
|
|
@ -450,20 +450,20 @@ void ThemeData::parseElement(const pugi::xml_node& root,
|
|||
|
||||
switch (typeIt->second) {
|
||||
case NORMALIZED_RECT: {
|
||||
Vector4f val;
|
||||
glm::vec4 val;
|
||||
|
||||
auto splits = Utils::String::delimitedStringToVector(str, " ");
|
||||
if (splits.size() == 2) {
|
||||
val = Vector4f(static_cast<float>(atof(splits.at(0).c_str())),
|
||||
static_cast<float>(atof(splits.at(1).c_str())),
|
||||
static_cast<float>(atof(splits.at(0).c_str())),
|
||||
static_cast<float>(atof(splits.at(1).c_str())));
|
||||
val = glm::vec4(static_cast<float>(atof(splits.at(0).c_str())),
|
||||
static_cast<float>(atof(splits.at(1).c_str())),
|
||||
static_cast<float>(atof(splits.at(0).c_str())),
|
||||
static_cast<float>(atof(splits.at(1).c_str())));
|
||||
}
|
||||
else if (splits.size() == 4) {
|
||||
val = Vector4f(static_cast<float>(atof(splits.at(0).c_str())),
|
||||
static_cast<float>(atof(splits.at(1).c_str())),
|
||||
static_cast<float>(atof(splits.at(2).c_str())),
|
||||
static_cast<float>(atof(splits.at(3).c_str())));
|
||||
val = glm::vec4(static_cast<float>(atof(splits.at(0).c_str())),
|
||||
static_cast<float>(atof(splits.at(1).c_str())),
|
||||
static_cast<float>(atof(splits.at(2).c_str())),
|
||||
static_cast<float>(atof(splits.at(3).c_str())));
|
||||
}
|
||||
|
||||
element.properties[node.name()] = val;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#define ES_CORE_THEME_DATA_H
|
||||
|
||||
#include "math/Vector2f.h"
|
||||
#include "math/Vector4f.h"
|
||||
#include "utils/FileSystemUtil.h"
|
||||
|
||||
#include <deque>
|
||||
|
@ -103,11 +102,11 @@ public:
|
|||
std::string type;
|
||||
|
||||
struct Property {
|
||||
void operator=(const Vector4f& value)
|
||||
void operator=(const glm::vec4& value)
|
||||
{
|
||||
r = value;
|
||||
const Vector4f initVector = value;
|
||||
v = Vector2f(initVector.x(), initVector.y());
|
||||
const glm::vec4 initVector = value;
|
||||
v = Vector2f(initVector.x, initVector.y);
|
||||
}
|
||||
void operator=(const Vector2f& value) { v = value; }
|
||||
void operator=(const std::string& value) { s = value; }
|
||||
|
@ -115,7 +114,7 @@ public:
|
|||
void operator=(const float& value) { f = value; }
|
||||
void operator=(const bool& value) { b = value; }
|
||||
|
||||
Vector4f r;
|
||||
glm::vec4 r;
|
||||
Vector2f v;
|
||||
std::string s;
|
||||
unsigned int i;
|
||||
|
@ -137,7 +136,7 @@ public:
|
|||
return *(const T*)&properties.at(prop).f;
|
||||
else if (std::is_same<T, bool>::value)
|
||||
return *(const T*)&properties.at(prop).b;
|
||||
else if (std::is_same<T, Vector4f>::value)
|
||||
else if (std::is_same<T, glm::vec4>::value)
|
||||
return *(const T*)&properties.at(prop).r;
|
||||
return T();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ DateTimeComponent::DateTimeComponent(Window* window,
|
|||
const std::shared_ptr<Font>& font,
|
||||
unsigned int color,
|
||||
Alignment align,
|
||||
Vector3f pos,
|
||||
glm::vec3 pos,
|
||||
Vector2f size,
|
||||
unsigned int bgcolor)
|
||||
: TextComponent(window, text, font, color, align, pos, size, bgcolor)
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
const std::shared_ptr<Font>& font,
|
||||
unsigned int color = 0x000000FF,
|
||||
Alignment align = ALIGN_LEFT,
|
||||
Vector3f pos = Vector3f::Zero(),
|
||||
glm::vec3 pos = {},
|
||||
Vector2f size = Vector2f::Zero(),
|
||||
unsigned int bgcolor = 0x00000000);
|
||||
|
||||
|
|
|
@ -303,19 +303,19 @@ void DateTimeEditComponent::updateTextCache()
|
|||
Vector2f start(0, 0);
|
||||
Vector2f end = font->sizeText(dispString.substr(0, 4));
|
||||
Vector2f diff = end - start;
|
||||
mCursorBoxes.push_back(Vector4f(start[0], start[1], diff[0], diff[1]));
|
||||
mCursorBoxes.push_back(glm::vec4(start[0], start[1], diff[0], diff[1]));
|
||||
|
||||
// Month.
|
||||
start[0] = font->sizeText(dispString.substr(0, 5)).x();
|
||||
end = font->sizeText(dispString.substr(0, 7));
|
||||
diff = end - start;
|
||||
mCursorBoxes.push_back(Vector4f(start[0], start[1], diff[0], diff[1]));
|
||||
mCursorBoxes.push_back(glm::vec4(start[0], start[1], diff[0], diff[1]));
|
||||
|
||||
// Day.
|
||||
start[0] = font->sizeText(dispString.substr(0, 8)).x();
|
||||
end = font->sizeText(dispString.substr(0, 10));
|
||||
diff = end - start;
|
||||
mCursorBoxes.push_back(Vector4f(start[0], start[1], diff[0], diff[1]));
|
||||
mCursorBoxes.push_back(glm::vec4(start[0], start[1], diff[0], diff[1]));
|
||||
|
||||
// The logic for handling time for 'mode = DISP_DATE_TIME' is missing, but
|
||||
// nobody will use it anyway so it's not worthwhile implementing.
|
||||
|
|
|
@ -82,7 +82,7 @@ private:
|
|||
int mRelativeUpdateAccumulator;
|
||||
|
||||
std::unique_ptr<TextCache> mTextCache;
|
||||
std::vector<Vector4f> mCursorBoxes;
|
||||
std::vector<glm::vec4> mCursorBoxes;
|
||||
|
||||
unsigned int mColor;
|
||||
Utils::Time::DateTime mOriginalValue;
|
||||
|
|
|
@ -184,15 +184,15 @@ void GridTileComponent::setSelected(bool selected,
|
|||
cancelAnimation(3);
|
||||
|
||||
this->setSelectedZoom(1);
|
||||
mAnimPosition = Vector3f(0, 0, 0);
|
||||
mAnimPosition = {};
|
||||
|
||||
resize();
|
||||
}
|
||||
else {
|
||||
mAnimPosition = Vector3f(pPosition->x, pPosition->y, pPosition->z);
|
||||
mAnimPosition = glm::vec3(pPosition->x, pPosition->y, pPosition->z);
|
||||
|
||||
auto func = [this](float t) {
|
||||
t -= 1; // Cubic ease out.
|
||||
t -= 1;
|
||||
float pct = Math::lerp(0, 1, t * t * t + 1);
|
||||
this->setSelectedZoom(pct);
|
||||
};
|
||||
|
@ -202,7 +202,7 @@ void GridTileComponent::setSelected(bool selected,
|
|||
new LambdaAnimation(func, 250), 0,
|
||||
[this] {
|
||||
this->setSelectedZoom(1);
|
||||
mAnimPosition = Vector3f(0, 0, 0);
|
||||
mAnimPosition = {};
|
||||
},
|
||||
false, 3);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ void GridTileComponent::setSelected(bool selected,
|
|||
this->setSelectedZoom(1);
|
||||
|
||||
auto func = [this](float t) {
|
||||
t -= 1.0f; // Cubic ease out.
|
||||
t -= 1.0f;
|
||||
float pct = Math::lerp(0, 1, t * t * t + 1.0f);
|
||||
this->setSelectedZoom(1.0f - pct);
|
||||
};
|
||||
|
|
|
@ -73,7 +73,7 @@ private:
|
|||
bool mSelected;
|
||||
bool mVisible;
|
||||
|
||||
Vector3f mAnimPosition;
|
||||
glm::vec3 mAnimPosition;
|
||||
};
|
||||
|
||||
#endif // ES_CORE_COMPONENTS_GRID_TILE_COMPONENT_H
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
Vector2f mAutoLayout;
|
||||
float mAutoLayoutZoom;
|
||||
|
||||
Vector4f mPadding;
|
||||
glm::vec4 mPadding;
|
||||
Vector2f mMargin;
|
||||
Vector2f mTileSize;
|
||||
Vector2i mGridDimension;
|
||||
|
@ -144,7 +144,7 @@ ImageGridComponent<T>::ImageGridComponent(Window* window)
|
|||
|
||||
mSize = screen * 0.80f;
|
||||
mMargin = screen * 0.07f;
|
||||
mPadding = Vector4f::Zero();
|
||||
mPadding = {};
|
||||
mTileSize = GridTileComponent::getDefaultTileSize();
|
||||
|
||||
mAnimate = true;
|
||||
|
@ -280,8 +280,8 @@ void ImageGridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mMargin = elem->get<Vector2f>("margin") * screen;
|
||||
|
||||
if (elem->has("padding"))
|
||||
mPadding = elem->get<Vector4f>("padding") *
|
||||
Vector4f(screen.x(), screen.y(), screen.x(), screen.y());
|
||||
mPadding = elem->get<glm::vec4>("padding") *
|
||||
glm::vec4(screen.x(), screen.y(), screen.x(), screen.y());
|
||||
|
||||
if (elem->has("autoLayout"))
|
||||
mAutoLayout = elem->get<Vector2f>("autoLayout");
|
||||
|
@ -506,7 +506,7 @@ template <typename T> void ImageGridComponent<T>::onCursorChanged(const CursorSt
|
|||
if (!moveCamera)
|
||||
return;
|
||||
|
||||
t -= 1.0f; // Cubic ease out.
|
||||
t -= 1.0f;
|
||||
float pct = Math::lerp(0, 1.0f, t * t * t + 1.0f);
|
||||
t = startPos * (1.0f - pct) + endPos * pct;
|
||||
mCamera = t;
|
||||
|
@ -538,12 +538,10 @@ template <typename T> void ImageGridComponent<T>::buildTiles()
|
|||
Vector2f tileDistance = mTileSize + mMargin;
|
||||
|
||||
if (mAutoLayout.x() != 0.0f && mAutoLayout.y() != 0.0f) {
|
||||
auto x =
|
||||
(mSize.x() - (mMargin.x() * (mAutoLayout.x() - 1.0f)) - mPadding.x() - mPadding.z()) /
|
||||
static_cast<int>(mAutoLayout.x());
|
||||
auto y =
|
||||
(mSize.y() - (mMargin.y() * (mAutoLayout.y() - 1.0f)) - mPadding.y() - mPadding.w()) /
|
||||
static_cast<int>(mAutoLayout.y());
|
||||
auto x = (mSize.x() - (mMargin.x() * (mAutoLayout.x() - 1.0f)) - mPadding.x - mPadding.z) /
|
||||
static_cast<int>(mAutoLayout.x());
|
||||
auto y = (mSize.y() - (mMargin.y() * (mAutoLayout.y() - 1.0f)) - mPadding.y - mPadding.w) /
|
||||
static_cast<int>(mAutoLayout.y());
|
||||
|
||||
mTileSize = Vector2f(x, y);
|
||||
tileDistance = mTileSize + mMargin;
|
||||
|
@ -551,7 +549,8 @@ template <typename T> void ImageGridComponent<T>::buildTiles()
|
|||
|
||||
bool vert = isVertical();
|
||||
Vector2f startPosition = mTileSize / 2.0f;
|
||||
startPosition += mPadding.v2();
|
||||
startPosition.x() += mPadding.x;
|
||||
startPosition.y() += mPadding.y;
|
||||
|
||||
int X;
|
||||
int Y;
|
||||
|
|
|
@ -33,7 +33,7 @@ TextComponent::TextComponent(Window* window,
|
|||
const std::shared_ptr<Font>& font,
|
||||
unsigned int color,
|
||||
Alignment align,
|
||||
Vector3f pos,
|
||||
glm::vec3 pos,
|
||||
Vector2f size,
|
||||
unsigned int bgcolor,
|
||||
float margin)
|
||||
|
@ -54,11 +54,7 @@ TextComponent::TextComponent(Window* window,
|
|||
setColor(color);
|
||||
setBackgroundColor(bgcolor);
|
||||
setText(text);
|
||||
|
||||
// TEMPORARY
|
||||
glm::vec3 tempvec = { pos.x(), pos.y(), pos.z() };
|
||||
|
||||
setPosition(tempvec);
|
||||
setPosition(pos);
|
||||
setSize(size);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
const std::shared_ptr<Font>& font,
|
||||
unsigned int color = 0x000000FF,
|
||||
Alignment align = ALIGN_LEFT,
|
||||
Vector3f pos = Vector3f::Zero(),
|
||||
glm::vec3 pos = {},
|
||||
Vector2f size = Vector2f::Zero(),
|
||||
unsigned int bgcolor = 0x00000000,
|
||||
float margin = 0.0f);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include "math/Misc.h"
|
||||
#include "math/Vector3f.h"
|
||||
|
||||
#if defined(_WIN64)
|
||||
#include <GL/glew.h>
|
||||
|
|
Loading…
Reference in a new issue