API Almost finished

This commit is contained in:
2023-06-11 09:05:25 -07:00
parent 86bca79768
commit 0c84689245
6 changed files with 211 additions and 92 deletions

View File

@ -34,7 +34,6 @@ namespace Dawn {
FT_Library fontLibrary;
enum NewTrueTypeAssetState state = NEW_TRUE_TYPE_ASSET_STATE_INITIAL;
std::vector<struct NewTrueTypeAssetStyle> assetStyles;
std::vector<NewTrueTypeFaceTexture*> textures;
std::map<usagelockid_t, NewTrueTypeFaceTexture*> textureByLock;
std::map<struct NewTrueTypeFaceTextureStyle, NewTrueTypeFaceTexture*> textureByStyle;
@ -44,8 +43,28 @@ namespace Dawn {
void updateSync() override;
void updateAsync() override;
/**
* Create a lock for a specific style. Locks will ensure that the font is
* held loaded until it is no longer required.
*
* @param style Style to lock.
* @return A unique lock ID for this style.
*/
usagelockid_t lock(struct NewTrueTypeFaceTextureStyle style);
/**
* Get a texture by a previous lock ID.
*
* @param lock Lock to get the texture of.
* @return Matching texture by this ID.
*/
NewTrueTypeFaceTexture * getTexture(usagelockid_t lock);
/**
* Releases a previously held font lock.
*
* @param lock Lock to release/unlock.
*/
void unlock(usagelockid_t lock);
~NewTrueTypeAsset();