mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-09-10 16:03:21 -04:00
Implement Font constructor from TTF_Font*
This commit is contained in:
parent
1e5c17c95a
commit
feabe1497e
@ -1,6 +1,6 @@
|
||||
/*
|
||||
libSDL2pp - C++11 bindings/wrapper for SDL2
|
||||
Copyright (C) 2014 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
||||
Copyright (C) 2014-2015 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -27,6 +27,10 @@
|
||||
|
||||
namespace SDL2pp {
|
||||
|
||||
Font::Font(TTF_Font* font) {
|
||||
font_ = font;
|
||||
}
|
||||
|
||||
Font::Font(const std::string& file, int ptsize, long index) {
|
||||
if ((font_ = TTF_OpenFontIndex(file.c_str(), ptsize, index)) == nullptr)
|
||||
throw Exception("TTF_OpenFontIndex failed");
|
||||
|
@ -49,6 +49,14 @@ private:
|
||||
TTF_Font* font_; ///< Managed TTF_Font object
|
||||
|
||||
public:
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct from existing TTF_Font structure
|
||||
///
|
||||
/// \param font Existing TTF_Font to manage
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Font(TTF_Font* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Loads font from .ttf or .fon file
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user