idk why but my GDB just stopped working
This commit is contained in:
@ -12,7 +12,9 @@ TrueTypeLoader::TrueTypeLoader(const std::string name) :
|
||||
AssetLoader(name),
|
||||
loader(name + ".ttf")
|
||||
{
|
||||
|
||||
// Init the font.
|
||||
auto ret = FT_Init_FreeType(&fontLibrary);
|
||||
assertTrue(ret == 0, "Failed to initialize FreeType library.");
|
||||
}
|
||||
|
||||
void TrueTypeLoader::updateSync() {
|
||||
@ -31,10 +33,7 @@ void TrueTypeLoader::updateAsync() {
|
||||
assertTrue(readSize == size, "Failed to read all data from TrueTypeLoader.");
|
||||
|
||||
// Init the font.
|
||||
auto ret = FT_Init_FreeType(&fontLibrary);
|
||||
assertTrue(ret == 0, "Failed to initialize FreeType library.");
|
||||
|
||||
ret = FT_New_Memory_Face(fontLibrary, buffer, size, 0, &face);
|
||||
auto ret = FT_New_Memory_Face(fontLibrary, buffer, size, 0, &face);
|
||||
assertTrue(ret == 0, "Failed to load font face.");
|
||||
|
||||
// Now close the asset loader
|
||||
@ -64,4 +63,6 @@ TrueTypeLoader::~TrueTypeLoader() {
|
||||
delete[] buffer;
|
||||
buffer = nullptr;
|
||||
}
|
||||
|
||||
FT_Done_FreeType(fontLibrary);
|
||||
}
|
@ -15,21 +15,10 @@
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
FT_Library fontLibrary;
|
||||
FT_Face face;
|
||||
std::shared_ptr<TrueTypeTexture> texture;
|
||||
|
||||
void Dawn::helloWorldScene(Scene &s) {
|
||||
int32_t ret = FT_Init_FreeType(&fontLibrary);
|
||||
assertTrue(ret == 0, "Failed to initialize FreeType library");
|
||||
ret = FT_New_Face(fontLibrary,
|
||||
// "/usr/share/fonts/TTF/arial.ttf",
|
||||
"/home/yourwishes/Downloads/Noto_Sans_JP/static/NotoSansJP-Regular.ttf",
|
||||
0,
|
||||
&face
|
||||
);
|
||||
assertTrue(ret == 0, "Failed to load font face");
|
||||
texture = std::make_shared<TrueTypeTexture>(face, 128);
|
||||
texture = s.getGame()->assetManager.get<TrueTypeTexture>("ysabeau_regular", 12);
|
||||
|
||||
auto cameraItem = s.createSceneItem();
|
||||
auto camera = cameraItem->addComponent<Camera>();
|
||||
|
@ -17,4 +17,6 @@ set(
|
||||
|
||||
# Tools
|
||||
add_subdirectory(assetstool)
|
||||
add_subdirectory(texturetool)
|
||||
add_subdirectory(copytool)
|
||||
add_subdirectory(texturetool)
|
||||
add_subdirectory(truetypetool)
|
11
tools/copytool/CMakeLists.txt
Normal file
11
tools/copytool/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2023 Dominic Msters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
function(tool_copy target input output)
|
||||
add_custom_target(${target}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${input} ${output}
|
||||
)
|
||||
add_dependencies(dawnassets ${target})
|
||||
endfunction()
|
8
tools/truetypetool/CMakeLists.txt
Normal file
8
tools/truetypetool/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2023 Dominic Msters
|
||||
#
|
||||
# This software is released under the MIT License.
|
||||
# https://opensource.org/licenses/MIT
|
||||
|
||||
function(tool_truetype target ttf)
|
||||
tool_copy(${target} ${ttf} ${DAWN_ASSETS_BUILD_DIR}/${target}.ttf)
|
||||
endfunction()
|
Reference in New Issue
Block a user