awtk/demos/assets.c

21 lines
549 B
C
Raw Normal View History

2019-10-18 18:18:12 +08:00
#include "awtk.h"
#include "base/assets_manager.h"
2020-03-16 21:19:20 +08:00
extern ret_t assets_init_default(void);
extern ret_t assets_init_dark(void);
ret_t assets_init(const char* theme) {
2019-10-18 18:18:12 +08:00
assets_manager_t* am = assets_manager();
2020-03-16 21:19:20 +08:00
return_value_if_fail(theme != NULL && am != NULL, RET_BAD_PARAMS);
2019-10-18 18:18:12 +08:00
2020-03-16 21:19:20 +08:00
assets_manager_set_theme(am, theme);
2019-10-18 18:18:12 +08:00
2020-03-16 21:19:20 +08:00
if (tk_str_eq(theme, "default")) {
return assets_init_default();
} else if (tk_str_eq(theme, "dark")) {
return assets_init_dark();
2020-03-17 12:35:12 +08:00
} else {
2020-03-16 21:19:20 +08:00
log_debug("%s not support.\n", theme);
return RET_NOT_IMPL;
}
}