Updated some docs, prepping for font.

This commit is contained in:
2022-10-23 01:27:20 -07:00
parent bc74e6782b
commit f2c2bd4071
5 changed files with 144 additions and 7 deletions

View File

@ -0,0 +1,10 @@
# Copyright (c) 2022 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
# Sources
target_sources(${DAWN_TARGET_NAME}
PRIVATE
Font.cpp
)

View File

@ -0,0 +1,8 @@
// Copyright (c) 2022 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "Font.hpp"
using namespace Dawn;

View File

@ -0,0 +1,44 @@
/**
* Copyright (c) 2022 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "display/mesh/Mesh.hpp"
#include "display/Texture.hpp"
namespace Dawn {
class FontMeasure {
public:
virtual float_t getWidth() = 0;
virtual float_t getHeight() = 0;
virtual int32_t getQuadsOnLine(int32_t line);
virtual int32_t getQuadIndexOnLine(int32_t line);
virtual int32_t getLineCount();
virtual int32_t getQuadCount();
};
class Font {
public:
Font();
virtual void init() = 0;
virtual void buffer(
std::string text,
float_t fontSize,
float_t maxWidth,
Mesh &mesh,
FontMeasure &measure
) = 0;
virtual Texture & getTexture() = 0;
virtual void draw(Mesh &mesh, int32_t startCharacter, int32_t length) = 0;
virtual float_t getLineHeight(float_t fontSize) = 0;
virtual float_t getDefaultFontSize() = 0;
virtual ~Font();
};
}