Updated some docs, prepping for font.
This commit is contained in:
10
src/dawn/display/font/CMakeLists.txt
Normal file
10
src/dawn/display/font/CMakeLists.txt
Normal 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
|
||||
)
|
8
src/dawn/display/font/Font.cpp
Normal file
8
src/dawn/display/font/Font.cpp
Normal 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;
|
44
src/dawn/display/font/Font.hpp
Normal file
44
src/dawn/display/font/Font.hpp
Normal 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();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user