|
dl
|
资源工厂,加载、管理、创建各种资源 更多...
#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 | SetReleaseMode () |
| 设置发布模式,使用binary资源 | |
| void | RegisterImagePath (std::string_view path, std::string_view name) |
| 注册图像加载路径 | |
| void | LoadModel (std::string_view path_name, std::string_view name="") |
| 加载模型文件 | |
| std::string | GetPathImage () |
| 返回图像目录 | |
| std::string | GetPathVoice () |
| 返回音效目录 | |
| 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) |
| 创建一个精灵 | |
| bool | RegisterSprite (std::string_view name, Image *img, const Position &anchor={}) |
| 注册一个精灵(动态) | |
| bool | HasSprite (std::string_view name) |
| 检测精灵是否存在 | |
| 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) |
| std::vector< std::string > | GetFolderAllSpriteName (std::string_view folder_name) |
| 返回一个文件夹下的所有精灵 | |
| size_t | GetSpriteSheetNum (std::string_view name) |
| 返回精灵的sheet有多少张 | |
| SpriteID | GetSpriteId (std::string_view name, size_t index) |
| 返回精灵的id | |
| Size | GetSpriteTexSize (const SpriteID &spr_id) |
| 返回精灵的纹理大小 | |
| Size | GetSpriteTexSize (gcSprite &spr) |
| std::string | GetSpriteName (const SpriteID &spr_id) |
| 返回精灵的名字 | |
| std::string | GetSpriteName (gcSprite &spr) |
| Position | GetSpriteAnchor (const SpriteID &spr_id) |
| 返回精灵的默认锚点 | |
| Position | GetSpriteAnchor (gcSprite &spr) |
| Color | GetSpriteColor (const SpriteID &spr_id) |
| 返回精灵的默认颜色 | |
| Color | GetSpriteColor (gcSprite &spr) |
| gcAnimation | CreateAnimation (std::string_view name, unsigned dir=0) |
| 创建精灵动画 | |
| gcSprite | RenderSprite (std::string_view name, size_t index=0) |
| gcText | RenderText () |
| gcAnimation | RenderAnimation (std::string_view name, unsigned dir=0) |
| 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=true) |
| 复制一个文本 | |
| Coor * | GetRootCoor (size_t i) |
| 返回根坐标系 | |
| 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 | SetOrderPickup (float order) |
| 设置拾取ui的当前order | |
| float | GetOrderPickup () |
| void | SetOrderPickupShow (bool show) |
| bool | GetOrderPickupShow () |
| void | DeleteBinary (bool b_all, bool b_2d, bool b_3d) |
| 删除输出目录内容 | |
| void | ExportTexture2D () |
| 导出所有2d纹理 | |
| FactoryImp * | GetImp () |
| void | _render_sprite (Sprite *spr) |
| void | _add_pickup_sprite (Sprite *spr) |
| void | _add_pickup_text (Text *txt) |
| void | _clear_pickup () |
| void | _render_pickup () |
友元 | |
| class | System |
| class | Engine |
资源工厂,加载、管理、创建各种资源
在文件 dl_factory.h 第 39 行定义.
|
inline |
在文件 dl_factory.h 第 397 行定义.
|
inline |
在文件 dl_factory.h 第 401 行定义.
|
inline |
在文件 dl_factory.h 第 405 行定义.
| void dl::Factory::_render_pickup | ( | ) |
| 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 第 215 行定义.
复制一个文本
在文件 dl_factory.h 第 323 行定义.
| gcActor dl::Factory::CreateActor | ( | std::string_view | name | ) |
创建一个演员,通过指定模型文件
| [in] | name | 名字 |
| 失败返回默认演员,错误写入日志。 |
| gcAnimation dl::Factory::CreateAnimation | ( | std::string_view | name, |
| unsigned | dir = 0 ) |
创建精灵动画
| [in] | name | 资源名称 |
| [in] | dir | 方向 |
| gcSprite dl::Factory::CreateSprite | ( | std::string_view | name, |
| std::size_t | index = 0 ) |
创建一个精灵
| [in] | name | 名字,例如“ui.btn0” |
| [in] | index | 下标 |
| 失败返回默认精灵,错误产生日志。 |
在文件 dl_factory.h 第 292 行定义.
| float dl::Factory::CreateSpriteChar | ( | const CharInfo & | info, |
| gcSprite & | spr, | ||
| gcSprite & | spr_outline ) |
创建一个字符精灵
| [in] | info | 字符信息 |
| [out] | spr | 返回的精灵 |
| [out] | spr_outline | 返回的精灵(描边),如果描边大小为0,则不会返回 |
| 横向偏移距离 |
|
nodiscard |
创建默认精灵
| 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 第 314 行定义.
| 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 | ) |
返回一个颜色,会检查
| std::vector< std::string > dl::Factory::GetFolderAllSpriteName | ( | std::string_view | folder_name | ) |
返回一个文件夹下的所有精灵
| size_t dl::Factory::GetFontSize | ( | ) |
返回加载的字体数量
|
inline |
在文件 dl_factory.h 第 393 行定义.
|
inline |
在文件 dl_factory.h 第 380 行定义.
|
inline |
在文件 dl_factory.h 第 383 行定义.
|
inline |
返回资源缓存目录,例如"binary/"
在文件 dl_factory.h 第 117 行定义.
|
inline |
返回2d资源缓存目录,例如"binary/2d/"
在文件 dl_factory.h 第 131 行定义.
|
inline |
返回3d资源缓存目录,例如"binary/3d/"
在文件 dl_factory.h 第 124 行定义.
|
inline |
返回图像目录
在文件 dl_factory.h 第 102 行定义.
|
inline |
|
inline |
返回临时文件路径,例如"temp/"
在文件 dl_factory.h 第 138 行定义.
|
inline |
返回音效目录
在文件 dl_factory.h 第 109 行定义.
| Coor * dl::Factory::GetRootCoor | ( | size_t | i | ) |
返回根坐标系
| [in] | i | 下标 0作为2d全局使用 |
| 不需要用户手动释放,失败返回空 |
在文件 dl_factory.h 第 245 行定义.
在文件 dl_factory.h 第 250 行定义.
| SpriteID dl::Factory::GetSpriteId | ( | std::string_view | name, |
| size_t | index ) |
返回精灵的id
| std::string dl::Factory::GetSpriteName | ( | const SpriteID & | spr_id | ) |
返回精灵的名字
|
inline |
在文件 dl_factory.h 第 240 行定义.
| size_t dl::Factory::GetSpriteSheetNum | ( | std::string_view | name | ) |
返回精灵的sheet有多少张
在文件 dl_factory.h 第 235 行定义.
| bool dl::Factory::HasSprite | ( | std::string_view | name | ) |
检测精灵是否存在
| 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 |
| bool dl::Factory::RegisterSprite | ( | std::string_view | name, |
| Image * | img, | ||
| const Position & | anchor = {} ) |
注册一个精灵(动态)
| [in] | name | 命名 |
| [in] | img | 图像 |
| [in] | anchor | 锚点 |
| gcAnimation dl::Factory::RenderAnimation | ( | std::string_view | name, |
| unsigned | dir = 0 ) |
| gcSprite dl::Factory::RenderSprite | ( | std::string_view | name, |
| size_t | index = 0 ) |
| gcText dl::Factory::RenderText | ( | ) |
| void dl::Factory::SetOrderPickup | ( | float | order | ) |
设置拾取ui的当前order
|
inline |
在文件 dl_factory.h 第 382 行定义.
|
inline |
|
inline |
设置发布模式,使用binary资源
在文件 dl_factory.h 第 68 行定义.
|
friend |
在文件 dl_factory.h 第 42 行定义.
|
friend |
在文件 dl_factory.h 第 41 行定义.