|
dl
|
资源工厂 @info 加载、管理、创建各种资源 更多...
#include <dl_factory.h>
Public 成员函数 | |
| void | SetPath (std::string_view path_image="image/", std::string_view path_model="model/", std::string_view path_binary="binary/", std::string_view path_temp="temp/") |
| 设置 各种路径 更多... | |
| void | LoadModel (std::string_view path_name, std::string_view name="") |
| 加载模型文件 更多... | |
| std::string | GetPathBinary () |
| 返回资源缓存目录,例如"binary/" 更多... | |
| std::string | GetPathBinary3D () |
| 返回3d资源缓存目录,例如"binary/3d/" 更多... | |
| std::string | GetPathBinary2D () |
| 返回2d资源缓存目录,例如"binary/2d/" 更多... | |
| std::string | GetPathTemp () |
| 返回临时文件路径,例如"temp/" 更多... | |
| std::string | GetPathNameTemp (std::string_view str_fmt="") |
| 返回临时文件名,例如"temp/1" 更多... | |
| gcActor | CreateActor (std::string_view name) |
| 创建一个演员,通过指定模型文件 更多... | |
| Camera * | GetCamera () |
| 返回相机(3d) 更多... | |
| gcSprite | CreateSpriteDefault (const Color &col=ColorDef::WHITE) |
| 创建默认精灵 更多... | |
| gcSprite | CreateSprite (const SpriteID &spr_id) |
| 创建一个精灵 更多... | |
| gcSprite | CreateSprite (std::string_view name, std::size_t index=0) |
| 创建一个精灵 更多... | |
| std::vector< gcSprite > | CreateSpriteMulti (std::string_view name, std::size_t num=0, std::size_t index=0) |
| 创建多个精灵,从已加载的精灵表复制 更多... | |
| gcSprite | CloneSprite (gcSprite &spr) |
| 复制一个精灵 更多... | |
| gcSprite | CloneSprite (const gcSprite &spr) |
| Size | GetSpriteTexSize (gcSprite &spr) |
| 返回精灵的纹理大小 更多... | |
| size_t | LoadFont (std::string_view path_name) |
| 加载字体 更多... | |
| size_t | GetFontSize () |
| 返回加载的字体数量 更多... | |
| CharImage * | GetChar (const CharInfo &info) |
| 获得字符图像 更多... | |
| float | CreateSpriteChar (const CharInfo &info, gcSprite &spr, gcSprite &spr_outline) |
| 创建一个字符精灵 更多... | |
| float | CreateSpriteChar (const CharInfo &info, gcSprite &spr) |
| gcText | CreateText (size_t font_id=0, unsigned font_size=16, const Color &col=ColorDef::WHITE, unsigned font_outline=0, const Color &col_outline=ColorDef::BLACK, unsigned font_shadow=0, const Color &col_shadow=ColorDef::BLACK) |
| 创建一个文本 更多... | |
| gcText | CreateTextDefault () |
| gcText | CloneText (gcText txt, bool copy_str=false) |
| 复制一个文本 更多... | |
| void | AddColor (std::string_view name, const Color &col) |
| 添加一个颜色 更多... | |
| Color | GetColor (std::string_view name) |
| 返回一个颜色 更多... | |
| std::optional< Color > | GetColorCheck (std::string_view name) |
| 返回一个颜色,会检查 更多... | |
| void | LoadColorCsv (std::string_view name) |
| 从文件加载颜色标签 更多... | |
| void | DeleteBinary (bool b_all, bool b_2d, bool b_3d) |
| 删除输出目录内容 更多... | |
| void | ExportTexture2D () |
| 导出所有2d纹理 更多... | |
| FactoryImp * | GetImp () |
| void | _render_sprite (Sprite *spr) |
友元 | |
| class | System |
| class | Engine |
资源工厂 @info 加载、管理、创建各种资源
在文件 dl_factory.h 第 40 行定义.
| void dl::Factory::_render_sprite | ( | Sprite * | spr | ) |
| void dl::Factory::AddColor | ( | std::string_view | name, |
| const Color & | col | ||
| ) |
添加一个颜色
| [in] | name | 名字 |
| [in] | col | 颜色值 |
在文件 dl_factory.h 第 163 行定义.
复制一个文本
在文件 dl_factory.h 第 231 行定义.
| gcActor dl::Factory::CreateActor | ( | std::string_view | name | ) |
创建一个演员,通过指定模型文件
| [in] | name | 名字 |
| 失败返回默认演员,错误写入日志。 |
| gcSprite dl::Factory::CreateSprite | ( | std::string_view | name, |
| std::size_t | index = 0 |
||
| ) |
创建一个精灵
| [in] | name | 名字,例如“ui.btn0” |
| [in] | index | 下标 |
| 失败返回默认精灵,错误写入日志。 |
在文件 dl_factory.h 第 200 行定义.
| float dl::Factory::CreateSpriteChar | ( | const CharInfo & | info, |
| gcSprite & | spr, | ||
| gcSprite & | spr_outline | ||
| ) |
创建一个字符精灵
| [in] | info | 字符信息 |
| [out] | spr | 返回的精灵 |
| [out] | spr_outline | 返回的精灵(描边),如果描边大小为0,则不会返回 |
| 横向偏移距离 |
| gcSprite dl::Factory::CreateSpriteDefault | ( | const Color & | col = ColorDef::WHITE | ) |
创建默认精灵
| std::vector< gcSprite > dl::Factory::CreateSpriteMulti | ( | std::string_view | name, |
| std::size_t | num = 0, |
||
| std::size_t | index = 0 |
||
| ) |
创建多个精灵,从已加载的精灵表复制
| [in] | name | 名字,例如“ui.btn0” |
| [in] | num | 数量,为0时表示全部 |
| [in] | index | 下标起始 |
| gcText dl::Factory::CreateText | ( | size_t | font_id = 0, |
| unsigned | font_size = 16, |
||
| const Color & | col = ColorDef::WHITE, |
||
| unsigned | font_outline = 0, |
||
| const Color & | col_outline = ColorDef::BLACK, |
||
| unsigned | font_shadow = 0, |
||
| const Color & | col_shadow = ColorDef::BLACK |
||
| ) |
创建一个文本
| [in] | font_id | 字体编号 |
| [in] | font_size | 字体大小(单位为像素,英文字母大约为一半大小) |
| [in] | col | 颜色 |
| [in] | font_outline | 描边大小 |
| [in] | col_outline | 描边颜色 |
| [in] | font_shadow | 阴影偏移 |
| [in] | col_shadow | 阴影颜色 |
| 失败返回nullptr |
|
inline |
在文件 dl_factory.h 第 222 行定义.
| void dl::Factory::DeleteBinary | ( | bool | b_all, |
| bool | b_2d, | ||
| bool | b_3d | ||
| ) |
删除输出目录内容
| void dl::Factory::ExportTexture2D | ( | ) |
导出所有2d纹理
| Camera * dl::Factory::GetCamera | ( | ) |
返回相机(3d)
| Color dl::Factory::GetColor | ( | std::string_view | name | ) |
返回一个颜色
| [in] | name | 通过AddColor添加的颜色,如果是开头为0x,则返回对应十六进制颜色 |
| 失败返回白色,并发出警告 |
| std::optional< Color > dl::Factory::GetColorCheck | ( | std::string_view | name | ) |
返回一个颜色,会检查
| size_t dl::Factory::GetFontSize | ( | ) |
返回加载的字体数量
|
inline |
在文件 dl_factory.h 第 286 行定义.
|
inline |
返回资源缓存目录,例如"binary/"
在文件 dl_factory.h 第 76 行定义.
|
inline |
返回2d资源缓存目录,例如"binary/2d/"
在文件 dl_factory.h 第 90 行定义.
|
inline |
返回3d资源缓存目录,例如"binary/3d/"
在文件 dl_factory.h 第 83 行定义.
|
inline |
|
inline |
返回临时文件路径,例如"temp/"
在文件 dl_factory.h 第 97 行定义.
| void dl::Factory::LoadColorCsv | ( | std::string_view | name | ) |
从文件加载颜色标签
| size_t dl::Factory::LoadFont | ( | std::string_view | path_name | ) |
加载字体
| [in] | path_name | 路径名称 |
| void dl::Factory::LoadModel | ( | std::string_view | path_name, |
| std::string_view | name = "" |
||
| ) |
加载模型文件
| [in] | path_name | 绝对路径 或 资源路径 |
| [in] | name | 自定义名称 |
|
inline |
|
friend |
在文件 dl_factory.h 第 43 行定义.
|
friend |
在文件 dl_factory.h 第 42 行定义.