mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'lioncash-find'
This commit is contained in:
commit
eab08cbe2d
|
@ -1,5 +1,7 @@
|
||||||
#include "Runtime/GuiSys/CRasterFont.hpp"
|
#include "Runtime/GuiSys/CRasterFont.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "Runtime/CSimplePool.hpp"
|
#include "Runtime/CSimplePool.hpp"
|
||||||
#include "Runtime/Graphics/CTexture.hpp"
|
#include "Runtime/Graphics/CTexture.hpp"
|
||||||
#include "Runtime/GuiSys/CDrawStringOptions.hpp"
|
#include "Runtime/GuiSys/CDrawStringOptions.hpp"
|
||||||
|
@ -84,6 +86,17 @@ CRasterFont::CRasterFont(urde::CInputStream& in, urde::IObjectStore& store) {
|
||||||
x0_initialized = true;
|
x0_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CGlyph* CRasterFont::InternalGetGlyph(char16_t chr) const {
|
||||||
|
const auto iter =
|
||||||
|
std::find_if(xc_glyphs.cbegin(), xc_glyphs.cend(), [chr](const auto& entry) { return entry.first == chr; });
|
||||||
|
|
||||||
|
if (iter == xc_glyphs.cend()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return &iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
void CRasterFont::SinglePassDrawString(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout,
|
void CRasterFont::SinglePassDrawString(const CDrawStringOptions& opts, int x, int y, int& xout, int& yout,
|
||||||
CTextRenderBuffer* renderBuf, const char16_t* str, s32 length) const {
|
CTextRenderBuffer* renderBuf, const char16_t* str, s32 length) const {
|
||||||
if (!x0_initialized)
|
if (!x0_initialized)
|
||||||
|
|
|
@ -109,16 +109,7 @@ class CRasterFont {
|
||||||
s32 x8c_baseline;
|
s32 x8c_baseline;
|
||||||
s32 x90_lineMargin = 0;
|
s32 x90_lineMargin = 0;
|
||||||
|
|
||||||
const CGlyph* InternalGetGlyph(char16_t chr) const {
|
const CGlyph* InternalGetGlyph(char16_t chr) const;
|
||||||
u32 i = 0;
|
|
||||||
for (; i < xc_glyphs.size(); ++i)
|
|
||||||
if (chr == xc_glyphs[i].first)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (i == xc_glyphs.size())
|
|
||||||
return nullptr;
|
|
||||||
return &xc_glyphs[i].second;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRasterFont(CInputStream& in, IObjectStore& store);
|
CRasterFont(CInputStream& in, IObjectStore& store);
|
||||||
|
|
Loading…
Reference in New Issue