40 lines
843 B
C++
40 lines
843 B
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
struct ImFont;
|
|
|
|
namespace OpenVulkano::Scene::UI
|
|
{
|
|
class UiFont final
|
|
{
|
|
ImFont* m_font = nullptr;
|
|
std::string m_name;
|
|
float m_pixelSize;
|
|
|
|
void MakeFont();
|
|
|
|
public:
|
|
UiFont() : m_pixelSize(0) {}
|
|
|
|
UiFont(const std::string& font, float pixelSize = 16)
|
|
: m_name(font), m_pixelSize(pixelSize)
|
|
{}
|
|
|
|
void Push() { SetActive(); }
|
|
void SetActive();
|
|
|
|
[[nodiscard]] const std::string& GetFontName() const { return m_name; }
|
|
|
|
[[nodiscard]] float GetPixelSize() const { return m_pixelSize; }
|
|
|
|
[[nodiscard]] static UiFont* GetFont(const std::string& font, int pixelSize = 16);
|
|
};
|
|
};
|