mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
assets_manager_set_custom_build_asset_dir support ctx
This commit is contained in:
parent
97051e8ebc
commit
697ce454d6
@ -7,6 +7,7 @@
|
||||
* 修改软键盘弹出时出现屏保的问题。
|
||||
* 完善new.cpp/new.hpp (感谢陈谭提供补丁)。
|
||||
* 修改windows中文件名的问题(感谢大恒提供补丁)
|
||||
* assets\_manager\_set\_custom\_build\_dir增加回调函数上下文。
|
||||
|
||||
* 2019/10/23
|
||||
* 修改clone出来的edit的显示问题。
|
||||
|
@ -167,7 +167,7 @@ static ret_t build_asset_filename_custom(assets_manager_t* am, char* path, uint3
|
||||
const char* name, const char* extname) {
|
||||
if (am->custom_build_asset_dir != NULL) {
|
||||
char sep[2] = {TK_PATH_SEP, 0};
|
||||
return_value_if_fail(am->custom_build_asset_dir(path, size, theme, ratio, subpath) == RET_OK,
|
||||
return_value_if_fail(am->custom_build_asset_dir(am->custom_build_asset_dir_ctx, path, size, theme, ratio, subpath) == RET_OK,
|
||||
RET_FAIL);
|
||||
return_value_if_fail(tk_str_append(path, size, sep) == RET_OK, RET_FAIL);
|
||||
return_value_if_fail(tk_str_append(path, size, name) == RET_OK, RET_FAIL);
|
||||
@ -694,8 +694,9 @@ ret_t assets_manager_deinit(assets_manager_t* am) {
|
||||
}
|
||||
|
||||
ret_t assets_manager_set_custom_build_asset_dir(
|
||||
assets_manager_t* am, assets_manager_build_asset_dir_t custom_build_asset_dir) {
|
||||
assets_manager_t* am, assets_manager_build_asset_dir_t custom_build_asset_dir, void* ctx) {
|
||||
return_value_if_fail(am != NULL, RET_BAD_PARAMS);
|
||||
am->custom_build_asset_dir_ctx = ctx;
|
||||
am->custom_build_asset_dir = custom_build_asset_dir;
|
||||
|
||||
return RET_OK;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
typedef ret_t (*assets_manager_build_asset_dir_t)(char* path, uint32_t size, const char* theme,
|
||||
typedef ret_t (*assets_manager_build_asset_dir_t)(void* ctx, char* path, uint32_t size, const char* theme,
|
||||
const char* ratio, const char* subpath);
|
||||
|
||||
/**
|
||||
@ -73,6 +73,7 @@ struct _assets_manager_t {
|
||||
char* res_root;
|
||||
locale_info_t* locale_info;
|
||||
system_info_t* system_info;
|
||||
void* custom_build_asset_dir_ctx;
|
||||
assets_manager_build_asset_dir_t custom_build_asset_dir;
|
||||
};
|
||||
|
||||
@ -231,12 +232,13 @@ ret_t assets_manager_preload(assets_manager_t* am, asset_type_t type, const char
|
||||
* 有时我们需要优先加载用户自定义的资源,加载失败才加载系统缺省的,可用设置一个函数去实现这类功能。
|
||||
*
|
||||
* @param {assets_manager_t*} am asset manager对象。
|
||||
* @param {assets_manager_build_asset_dir_t} custom_build_asset_dir
|
||||
* @param {assets_manager_build_asset_dir_t} custom_build_asset_dir 回调函数。
|
||||
* @param {void*} ctx 回调函数的上下文。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t assets_manager_set_custom_build_asset_dir(
|
||||
assets_manager_t* am, assets_manager_build_asset_dir_t custom_build_asset_dir);
|
||||
assets_manager_t* am, assets_manager_build_asset_dir_t custom_build_asset_dir, void* ctx);
|
||||
|
||||
/**
|
||||
* @method assets_manager_clear_cache
|
||||
|
Loading…
Reference in New Issue
Block a user