support bitmap

This commit is contained in:
lixianjing 2019-07-09 17:31:29 +08:00
parent cc7e37533c
commit 9b7710d48b
4 changed files with 16 additions and 0 deletions

View File

@ -2,6 +2,7 @@
* 2019/07/09
* 完整弹出窗口动画,支持在不同位置弹出。
* 支持bmp(感谢俊杰提供补丁)。
* 2019/07/08
* 表达式支持条件运算。

View File

@ -169,6 +169,7 @@ def gen_res_png_jpg():
inc = joinPath(OUTPUT_DIR, 'images/'+basename)
inc = inc.replace('.png', '.data')
inc = inc.replace('.jpg', '.data')
inc = inc.replace('.bmp', '.data')
inc = inc.replace('.gif', '.data')
inc = fix_output_file_name(inc)
imagegen(raw, inc)

View File

@ -141,6 +141,10 @@ static asset_info_t* try_load_image(assets_manager_t* am, const char* name,
extname = ".gif";
break;
}
case ASSET_TYPE_IMAGE_BMP: {
extname = ".bmp";
break;
}
case ASSET_TYPE_IMAGE_BSVG: {
extname = ".bsvg";
subpath = "assets/raw/images/svg";
@ -285,6 +289,10 @@ asset_info_t* assets_manager_load_asset(assets_manager_t* am, asset_type_t type,
return info;
}
if ((info = try_load_image(am, name, ASSET_TYPE_IMAGE_BMP, TRUE)) != NULL) {
return info;
}
if ((info = try_load_image(am, name, ASSET_TYPE_IMAGE_JPG, TRUE)) != NULL) {
return info;
}
@ -298,6 +306,10 @@ asset_info_t* assets_manager_load_asset(assets_manager_t* am, asset_type_t type,
return info;
}
if ((info = try_load_image(am, name, ASSET_TYPE_IMAGE_BMP, FALSE)) != NULL) {
return info;
}
if ((info = try_load_image(am, name, ASSET_TYPE_IMAGE_JPG, FALSE)) != NULL) {
return info;
}

View File

@ -47,6 +47,8 @@ int main(int argc, char** argv) {
output_res_c_source(out_filename, ASSET_TYPE_FONT, ASSET_TYPE_FONT_TTF, input_buff, size);
} else if (end_with(in_filename, ".png")) {
output_res_c_source(out_filename, ASSET_TYPE_IMAGE, ASSET_TYPE_IMAGE_PNG, input_buff, size);
} else if (end_with(in_filename, ".bmp")) {
output_res_c_source(out_filename, ASSET_TYPE_IMAGE, ASSET_TYPE_IMAGE_BMP, input_buff, size);
} else if (end_with(in_filename, ".jpg")) {
output_res_c_source(out_filename, ASSET_TYPE_IMAGE, ASSET_TYPE_IMAGE_JPG, input_buff, size);
} else if (end_with(in_filename, ".gif")) {