Oxygine
1
2g game engine
oxygine
src
res
ResFontBM.h
1
#pragma once
2
#include "oxygine-include.h"
3
#include "ResFont.h"
4
#include "core/Texture.h"
5
#include <vector>
6
7
namespace
oxygine
8
{
9
class
ResFontBM
:
public
ResFont
10
{
11
public
:
12
static
Resource
* create(
CreateResourceContext
& context);
13
static
Resource
* createBM(
CreateResourceContext
& context);
14
static
Resource
* createSD(
CreateResourceContext
& context);
15
16
ResFontBM
();
17
~
ResFontBM
();
18
20
void
init
(
const
char
* fntPath,
bool
premultipliedAlpha =
false
);
21
void
initSD(
const
char
* fntPath,
int
downsample);
22
23
void
cleanup();
24
25
const
Font
* getFont(
const
char
* name = 0,
int
size = 0)
const override
;
26
27
bool
isSDF(
int
& size)
const override
;
28
29
const
Font
* getClosestFont(
float
worldScale,
int
styleFontSize,
float
& resScale)
const override
;
30
31
private
:
32
struct
page
33
{
34
std::string file;
35
spNativeTexture texture;
36
};
37
38
void
addPage(
int
tw,
int
th,
const
char
* head,
const
char
* file);
39
40
void
_loadPage(
const
page& p,
LoadResourcesContext
*);
41
void
_load(
LoadResourcesContext
*)
override
;
42
void
_unload()
override
;
43
void
_restore(
Restorable
*,
void
*);
44
void
_createFont(
CreateResourceContext
* context,
bool
sd,
bool
bmc,
int
downsample);
45
void
_createFontFromTxt(
CreateResourceContext
* context,
char
* fontData,
const
std::string& fontPath,
int
downsample);
46
void
_finalize();
47
48
typedef
std::vector<page> pages;
49
pages _pages;
50
Font
* _font;
51
bool
_sdf;
52
53
TextureFormat _format;
54
55
std::string _file;
56
bool
_premultipliedAlpha;
57
};
58
}
oxygine::LoadResourcesContext
Definition:
CreateResourceContext.h:94
oxygine::ResFont
Definition:
ResFont.h:8
oxygine
–oxgl-end–!
Definition:
Actor.h:14
oxygine::ResFontBM::init
void init(const char *fntPath, bool premultipliedAlpha=false)
oxygine::Font
Definition:
Font.h:46
oxygine::ResFontBM
Definition:
ResFontBM.h:9
oxygine::Resource
Definition:
Resource.h:10
oxygine::CreateResourceContext
Definition:
CreateResourceContext.h:60
oxygine::Restorable
Definition:
Restorable.h:8
Generated on Tue Feb 13 2018 05:01:17 for Oxygine by
1.8.14