stringSize + STATIC

This commit is contained in:
nullifiedcat 2018-06-19 10:04:35 +03:00
parent 8e612b1c68
commit 1ae2981d57
6 changed files with 21 additions and 4 deletions

View File

@ -17,7 +17,11 @@ set(lib_dest "${export_dest}/${CMAKE_BUILD_TYPE}")
find_package(PNG REQUIRED)
find_package(GLEW REQUIRED)
add_library(${PROJECT_NAME} SHARED "")
add_library(${PROJECT_NAME} STATIC "")
target_compile_definitions(glez PRIVATE
_GLIBCXX_USE_CXX11_ABI=0)
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")

View File

@ -15,7 +15,7 @@ class font
{
public:
inline font(std::string path, float size)
: path(std::move(path)), size(size)
: path(std::move(path)), size(size), loaded(false)
{
}
~font();
@ -32,6 +32,7 @@ public:
void load();
void unload();
void stringSize(const std::string &string, float *width, float *height);
const std::string path;
const float size;

View File

@ -8,6 +8,7 @@
namespace glez
{
void preInit();
void init(int width, int height);
void shutdown();

View File

@ -38,7 +38,8 @@ void font::load(const std::string &path, float size)
void font::unload()
{
assert(init);
if (!init)
return;
texture_atlas_delete(atlas);
texture_font_delete(font);

View File

@ -28,4 +28,10 @@ void font::unload()
auto &font = detail::font::get(handle);
font.unload();
}
void font::stringSize(const std::string &string, float *width, float *height)
{
auto &font = detail::font::get(handle);
font.stringSize(string, width, height);
}
}

View File

@ -13,7 +13,6 @@ namespace glez
void init(int width, int height)
{
detail::font::init();
detail::program::init(width, height);
detail::texture::init();
}
@ -39,4 +38,9 @@ void end()
{
detail::render::end();
}
void preInit()
{
detail::font::init();
}
}