mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Formatting
This commit is contained in:
parent
e55c467d64
commit
350faf2153
@ -211,7 +211,7 @@ class CallbackTextureLoad : public TextureLoader {
|
||||
spine_texture_loader_unload_func unloadCb;
|
||||
|
||||
public:
|
||||
CallbackTextureLoad(): loadCb(nullptr), unloadCb(nullptr) {}
|
||||
CallbackTextureLoad() : loadCb(nullptr), unloadCb(nullptr) {}
|
||||
|
||||
void setCallbacks(spine_texture_loader_load_func load, spine_texture_loader_unload_func unload) {
|
||||
loadCb = load;
|
||||
@ -233,7 +233,7 @@ spine_atlas spine_atlas_load_callback(const utf8 *atlasData, const utf8 *atlasDi
|
||||
if (!atlasData) return nullptr;
|
||||
int32_t length = (int32_t) strlen(atlasData);
|
||||
callbackLoader.setCallbacks(load, unload);
|
||||
auto atlas = new (__FILE__, __LINE__) Atlas(atlasData, length, (const char *)atlasDir, &callbackLoader, true);
|
||||
auto atlas = new (__FILE__, __LINE__) Atlas(atlasData, length, (const char *) atlasDir, &callbackLoader, true);
|
||||
_spine_atlas *result = SpineExtension::calloc<_spine_atlas>(1, __FILE__, __LINE__);
|
||||
result->atlas = atlas;
|
||||
result->numImagePaths = (int32_t) atlas->getPages().size();
|
||||
|
||||
@ -36,7 +36,7 @@ uint8_t *read_file(const char *path, int *length) {
|
||||
*length = (int) ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
uint8_t *data = (uint8_t*)malloc(*length);
|
||||
uint8_t *data = (uint8_t *) malloc(*length);
|
||||
fread(data, 1, *length, file);
|
||||
fclose(file);
|
||||
|
||||
@ -44,11 +44,11 @@ uint8_t *read_file(const char *path, int *length) {
|
||||
}
|
||||
|
||||
void *load_texture(const char *path) {
|
||||
return (void *) (uintptr_t)texture_load(path);
|
||||
return (void *) (uintptr_t) texture_load(path);
|
||||
}
|
||||
|
||||
void unload_texture(void *texture) {
|
||||
texture_dispose((texture_t)(uintptr_t)texture);
|
||||
texture_dispose((texture_t) (uintptr_t) texture);
|
||||
}
|
||||
|
||||
int main() {
|
||||
@ -62,7 +62,7 @@ int main() {
|
||||
// Load the atlas and the skeleton data
|
||||
int atlas_length = 0;
|
||||
uint8_t *atlas_bytes = read_file("data/spineboy-pma.atlas", &atlas_length);
|
||||
spine_atlas atlas = spine_atlas_load_callback((utf8 *)atlas_bytes, "data/", load_texture, unload_texture);
|
||||
spine_atlas atlas = spine_atlas_load_callback((utf8 *) atlas_bytes, "data/", load_texture, unload_texture);
|
||||
int skeleton_length = 0;
|
||||
uint8_t *skeleton_bytes = read_file("data/spineboy-pro.skel", &skeleton_length);
|
||||
spine_skeleton_data_result result = spine_skeleton_data_load_binary(atlas, skeleton_bytes, skeleton_length);
|
||||
|
||||
@ -286,7 +286,7 @@ void renderer_set_viewport_size(renderer_t *renderer, int width, int height) {
|
||||
}
|
||||
|
||||
void renderer_draw_lite(renderer_t *renderer, spine_skeleton skeleton, bool premultipliedAlpha) {
|
||||
renderer_draw(renderer, (Skeleton*)skeleton, premultipliedAlpha);
|
||||
renderer_draw(renderer, (Skeleton *) skeleton, premultipliedAlpha);
|
||||
}
|
||||
|
||||
void renderer_draw(renderer_t *renderer, Skeleton *skeleton, bool premultipliedAlpha) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user