dl
Public 成员函数 | 友元 | 所有成员列表
dl::Factory类 参考

资源工厂 @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 行定义.

成员函数说明

◆ _render_sprite()

void dl::Factory::_render_sprite ( Sprite *  spr)

◆ AddColor()

void dl::Factory::AddColor ( std::string_view  name,
const Color &  col 
)

添加一个颜色

参数
[in]name名字
[in]col颜色值
注解
例如 (bg, 0xff123456),在Text格式化中就可以使用标签{c_bg}修改颜色

◆ CloneSprite() [1/2]

gcSprite dl::Factory::CloneSprite ( const gcSprite &  spr)
inline

在文件 dl_factory.h 第 163 行定义.

◆ CloneSprite() [2/2]

gcSprite dl::Factory::CloneSprite ( gcSprite &  spr)

复制一个精灵

◆ CloneText()

gcText dl::Factory::CloneText ( gcText  txt,
bool  copy_str = false 
)
inline

复制一个文本

在文件 dl_factory.h 第 231 行定义.

◆ CreateActor()

gcActor dl::Factory::CreateActor ( std::string_view  name)

创建一个演员,通过指定模型文件

参数
[in]name名字
返回值
失败返回默认演员,错误写入日志。

◆ CreateSprite() [1/2]

gcSprite dl::Factory::CreateSprite ( const SpriteID &  spr_id)

创建一个精灵

参数
[in]spr_id精灵id

◆ CreateSprite() [2/2]

gcSprite dl::Factory::CreateSprite ( std::string_view  name,
std::size_t  index = 0 
)

创建一个精灵

参数
[in]name名字,例如“ui.btn0”
[in]index下标
返回值
失败返回默认精灵,错误写入日志。

◆ CreateSpriteChar() [1/2]

float dl::Factory::CreateSpriteChar ( const CharInfo &  info,
gcSprite &  spr 
)
inline

在文件 dl_factory.h 第 200 行定义.

◆ CreateSpriteChar() [2/2]

float dl::Factory::CreateSpriteChar ( const CharInfo &  info,
gcSprite &  spr,
gcSprite &  spr_outline 
)

创建一个字符精灵

参数
[in]info字符信息
[out]spr返回的精灵
[out]spr_outline返回的精灵(描边),如果描边大小为0,则不会返回
返回值
横向偏移距离
注解
在横向排列文字时,使用返回值进行偏移

◆ CreateSpriteDefault()

gcSprite dl::Factory::CreateSpriteDefault ( const Color &  col = ColorDef::WHITE)

创建默认精灵

◆ CreateSpriteMulti()

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下标起始

◆ CreateText()

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

◆ CreateTextDefault()

gcText dl::Factory::CreateTextDefault ( )
inline

在文件 dl_factory.h 第 222 行定义.

◆ DeleteBinary()

void dl::Factory::DeleteBinary ( bool  b_all,
bool  b_2d,
bool  b_3d 
)

删除输出目录内容

◆ ExportTexture2D()

void dl::Factory::ExportTexture2D ( )

导出所有2d纹理

◆ GetCamera()

Camera * dl::Factory::GetCamera ( )

返回相机(3d)

注解
未设置前就有一个默认的

◆ GetChar()

CharImage * dl::Factory::GetChar ( const CharInfo &  info)

获得字符图像

参数
[in]info字符信息

◆ GetColor()

Color dl::Factory::GetColor ( std::string_view  name)

返回一个颜色

参数
[in]name通过AddColor添加的颜色,如果是开头为0x,则返回对应十六进制颜色
返回值
失败返回白色,并发出警告
注解
如果传入16进制颜色,必须是完整的,比如0x00ff00ff

◆ GetColorCheck()

std::optional< Color > dl::Factory::GetColorCheck ( std::string_view  name)

返回一个颜色,会检查

◆ GetFontSize()

size_t dl::Factory::GetFontSize ( )

返回加载的字体数量

◆ GetImp()

FactoryImp * dl::Factory::GetImp ( )
inline

在文件 dl_factory.h 第 286 行定义.

◆ GetPathBinary()

std::string dl::Factory::GetPathBinary ( )
inline

返回资源缓存目录,例如"binary/"

在文件 dl_factory.h 第 76 行定义.

◆ GetPathBinary2D()

std::string dl::Factory::GetPathBinary2D ( )
inline

返回2d资源缓存目录,例如"binary/2d/"

在文件 dl_factory.h 第 90 行定义.

◆ GetPathBinary3D()

std::string dl::Factory::GetPathBinary3D ( )
inline

返回3d资源缓存目录,例如"binary/3d/"

在文件 dl_factory.h 第 83 行定义.

◆ GetPathNameTemp()

std::string dl::Factory::GetPathNameTemp ( std::string_view  str_fmt = "")
inline

返回临时文件名,例如"temp/1"

参数
[in]str_fmt存在时添加后缀(额外添加.)

在文件 dl_factory.h 第 105 行定义.

◆ GetPathTemp()

std::string dl::Factory::GetPathTemp ( )
inline

返回临时文件路径,例如"temp/"

在文件 dl_factory.h 第 97 行定义.

◆ GetSpriteTexSize()

Size dl::Factory::GetSpriteTexSize ( gcSprite &  spr)

返回精灵的纹理大小

◆ LoadColorCsv()

void dl::Factory::LoadColorCsv ( std::string_view  name)

从文件加载颜色标签

注解
序列化的csv文件

◆ LoadFont()

size_t dl::Factory::LoadFont ( std::string_view  path_name)

加载字体

参数
[in]path_name路径名称
注解
0号为默认字体已被占用

◆ LoadModel()

void dl::Factory::LoadModel ( std::string_view  path_name,
std::string_view  name = "" 
)

加载模型文件

参数
[in]path_name绝对路径 或 资源路径
[in]name自定义名称

◆ SetPath()

void dl::Factory::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/" 
)
inline

设置 各种路径

注解
请在System::Start之前设置。如果不调用,会使用默认值

在文件 dl_factory.h 第 49 行定义.

友元及相关函数文档

◆ Engine

friend class Engine
friend

在文件 dl_factory.h 第 43 行定义.

◆ System

friend class System
friend

在文件 dl_factory.h 第 42 行定义.


该类的文档由以下文件生成: