mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[sdl] Formatting pass.
This commit is contained in:
parent
2b69bb2af5
commit
f3e03467b5
@ -53,7 +53,8 @@ int main() {
|
||||
spAnimationStateData *animationStateData = spAnimationStateData_create(skeletonData);
|
||||
spSkeletonDrawable *drawable = spSkeletonDrawable_create(skeletonData, animationStateData);
|
||||
|
||||
drawable->skeleton->x = 400; drawable->skeleton->y = 500;
|
||||
drawable->skeleton->x = 400;
|
||||
drawable->skeleton->y = 500;
|
||||
spSkeleton_setToSetupPose(drawable->skeleton);
|
||||
spSkeletonDrawable_update(drawable, 0);
|
||||
spAnimationState_setAnimationByName(drawable->animationState, 0, "run", -1);
|
||||
|
||||
@ -67,7 +67,7 @@ void spSkeletonDrawable_update(spSkeletonDrawable *self, float delta) {
|
||||
}
|
||||
|
||||
void spSkeletonDrawable_draw(spSkeletonDrawable *self, struct SDL_Renderer *renderer) {
|
||||
static unsigned short quadIndices[] = { 0, 1, 2, 2, 3, 0 };
|
||||
static unsigned short quadIndices[] = {0, 1, 2, 2, 3, 0};
|
||||
spSkeleton *skeleton = self->skeleton;
|
||||
spSkeletonClipping *clipper = self->clipper;
|
||||
SDL_Texture *texture;
|
||||
@ -106,7 +106,7 @@ void spSkeletonDrawable_draw(spSkeletonDrawable *self, struct SDL_Renderer *rend
|
||||
uvs = region->uvs;
|
||||
indices = quadIndices;
|
||||
indicesCount = 6;
|
||||
texture = (SDL_Texture *) ((spAtlasRegion*)region->rendererObject)->page->rendererObject;
|
||||
texture = (SDL_Texture *) ((spAtlasRegion *) region->rendererObject)->page->rendererObject;
|
||||
} else if (attachment->type == SP_ATTACHMENT_MESH) {
|
||||
spMeshAttachment *mesh = (spMeshAttachment *) attachment;
|
||||
attachmentColor = &mesh->color;
|
||||
@ -123,7 +123,7 @@ void spSkeletonDrawable_draw(spSkeletonDrawable *self, struct SDL_Renderer *rend
|
||||
uvs = mesh->uvs;
|
||||
indices = mesh->triangles;
|
||||
indicesCount = mesh->trianglesCount;
|
||||
texture = (SDL_Texture *) ((spAtlasRegion*)mesh->rendererObject)->page->rendererObject;
|
||||
texture = (SDL_Texture *) ((spAtlasRegion *) mesh->rendererObject)->page->rendererObject;
|
||||
} else if (attachment->type == SP_ATTACHMENT_CLIPPING) {
|
||||
spClippingAttachment *clip = (spClippingAttachment *) slot->attachment;
|
||||
spSkeletonClipping_clipStart(clipper, slot, clip);
|
||||
@ -131,10 +131,10 @@ void spSkeletonDrawable_draw(spSkeletonDrawable *self, struct SDL_Renderer *rend
|
||||
} else
|
||||
continue;
|
||||
|
||||
Uint8 r = (Uint8)(skeleton->color.r * slot->color.r * attachmentColor->r * 255);
|
||||
Uint8 g = (Uint8)(skeleton->color.g * slot->color.g * attachmentColor->g * 255);
|
||||
Uint8 b = (Uint8)(skeleton->color.b * slot->color.b * attachmentColor->b * 255);
|
||||
Uint8 a = (Uint8)(skeleton->color.a * slot->color.a * attachmentColor->a * 255);
|
||||
Uint8 r = (Uint8) (skeleton->color.r * slot->color.r * attachmentColor->r * 255);
|
||||
Uint8 g = (Uint8) (skeleton->color.g * slot->color.g * attachmentColor->g * 255);
|
||||
Uint8 b = (Uint8) (skeleton->color.b * slot->color.b * attachmentColor->b * 255);
|
||||
Uint8 a = (Uint8) (skeleton->color.a * slot->color.a * attachmentColor->a * 255);
|
||||
sdlVertex.color.r = r;
|
||||
sdlVertex.color.g = g;
|
||||
sdlVertex.color.b = b;
|
||||
@ -187,7 +187,7 @@ void _spAtlasPage_createTexture(spAtlasPage *self, const char *path) {
|
||||
int width, height, components;
|
||||
stbi_uc *imageData = stbi_load(path, &width, &height, &components, 4);
|
||||
if (!imageData) return;
|
||||
SDL_Texture *texture = SDL_CreateTexture((SDL_Renderer*)self->atlas->rendererObject, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, width,
|
||||
SDL_Texture *texture = SDL_CreateTexture((SDL_Renderer *) self->atlas->rendererObject, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, width,
|
||||
height);
|
||||
if (!texture) {
|
||||
stbi_image_free(imageData);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user