diff options
| -rw-r--r-- | AnimationMove.c | 8 | ||||
| -rw-r--r-- | AnimationMove.h | 8 | ||||
| -rw-r--r-- | graphics.c | 34 |
3 files changed, 25 insertions, 25 deletions
diff --git a/AnimationMove.c b/AnimationMove.c index 487d220..3881bf1 100644 --- a/AnimationMove.c +++ b/AnimationMove.c @@ -2,8 +2,8 @@ #include <math.h> ARGB -AM_MoveLinear(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { - struct AM_MoveLinear ml = *(struct AM_MoveLinear*)priv; +AM_Linear(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { + struct AM_Linear ml = *(struct AM_Linear*)priv; r = (r - ml.startRow - (i32)(frameIndex * ml.dRow)); c = (c - ml.startCol - (i32)(frameIndex * ml.dCol)); @@ -17,8 +17,8 @@ AM_MoveLinear(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, v } ARGB -AM_MoveSpin(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { - struct AM_MoveSpin ms = *(struct AM_MoveSpin*)priv; +AM_Spin(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv) { + struct AM_Spin ms = *(struct AM_Spin*)priv; double radius = sqrt(r * r + c * c); double phi = atan2(c, r); diff --git a/AnimationMove.h b/AnimationMove.h index 4516934..bdb5b21 100644 --- a/AnimationMove.h +++ b/AnimationMove.h @@ -3,7 +3,7 @@ #include "Animation.h" -struct AM_MoveLinear { +struct AM_Linear { PixelRenderer callback; void* priv; @@ -14,9 +14,9 @@ struct AM_MoveLinear { bool wrapCoordinates; }; -ARGB AM_MoveLinear(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv); +ARGB AM_Linear(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv); -struct AM_MoveSpin { +struct AM_Spin { PixelRenderer callback; void* priv; @@ -25,6 +25,6 @@ struct AM_MoveSpin { i32 centerCol; }; -ARGB AM_MoveSpin(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv); +ARGB AM_Spin(const Animation* anim, u32 frameIndex, ARGB pixel, i32 r, i32 c, void* priv); #endif /* _ANIMATION_MOVE */ @@ -17,30 +17,30 @@ main() { .squareSize = 32, .colorA = 0xFF000000, .colorB = 0xFFFF00FF, }; - struct AM_MoveLinear ml1 = { + struct AM_Linear ml1 = { .startRow = 0, .startCol = 0, .dRow = -1, .dCol = -1, .callback = AO_CheckerPattern, .priv = &chp1, }; - Animation_pushEvent(&anim, 0, 120, AM_MoveLinear, &ml1); + Animation_pushEvent(&anim, 0, 120, AM_Linear, &ml1); // Image FILE* fbclc = fopen("bclc.ppm", "r"); struct AO_Image bclc; - struct AM_MoveLinear ml10; + struct AM_Linear ml10; if (fbclc != NULL) { bclc.img = ppm_read(fbclc); bclc.noRepeat = true; bclc.zoom = 0.4; - ml10 = (struct AM_MoveLinear){ + ml10 = (struct AM_Linear){ .startRow = 0, .startCol = 0, .dRow = 0.5, .dCol = 0.5, .callback = AO_Image, .priv = &bclc, }; - Animation_pushEvent(&anim, 0, 100, AM_MoveLinear, &ml10); + Animation_pushEvent(&anim, 0, 100, AM_Linear, &ml10); } // Line @@ -69,62 +69,62 @@ main() { struct AO_Square s1 = { .width = 20, .height = 20, .color = 0xFFFFFF00, }; - struct AM_MoveSpin ms1 = { + struct AM_Spin ms1 = { .theta = 3.14159 / 15, .centerCol = 10, .centerRow = 10, .callback = AO_Square, .priv = &s1, }; - struct AM_MoveLinear ml3 = { + struct AM_Linear ml3 = { .startRow = 100, .startCol = 100, .dRow = 3, .dCol = 1, - .callback = AM_MoveSpin, .priv = &ms1, + .callback = AM_Spin, .priv = &ms1, }; - Animation_pushEvent(&anim, 0, 80, AM_MoveLinear, &ml3); + Animation_pushEvent(&anim, 0, 80, AM_Linear, &ml3); // White circle struct AO_Circle s4 = { .radius = 20, .color = 0xFFFFFFFF, }; - struct AM_MoveLinear ml4 = { + struct AM_Linear ml4 = { .startRow = 40, .startCol = 40, .dRow = 2, .dCol = 2, .callback = AO_Circle, .priv = &s4, }; - Animation_pushEvent(&anim, 0, 80, AM_MoveLinear, &ml4); + Animation_pushEvent(&anim, 0, 80, AM_Linear, &ml4); // Green square struct AO_Square s2 = { .width = 35, .height = 50, .color = 0xA009FAA5, }; - struct AM_MoveLinear ml2 = { + struct AM_Linear ml2 = { .startRow = 20, .startCol = 5, .dRow = -4, .dCol = -2, .wrapCoordinates = true, .callback = AO_Square, .priv = &s2, }; - Animation_pushEvent(&anim, 30, 110, AM_MoveLinear, &ml2); + Animation_pushEvent(&anim, 30, 110, AM_Linear, &ml2); // Segment struct AO_HorSegment ls1 = { .left = -40, .right = 40, .width = 3, .color = 0xFFA0A0A0, }; - struct AM_MoveSpin ms3 = { + struct AM_Spin ms3 = { .theta = 3.14159 / 10, .centerRow = 0, .centerCol = 0, .callback = AO_HorSegment, .priv = &ls1, }; - struct AM_MoveLinear ml6 = { + struct AM_Linear ml6 = { .startRow = 0, .startCol = 0, .dRow = 4, .dCol = 4, - .callback = AM_MoveSpin, .priv = &ms3, + .callback = AM_Spin, .priv = &ms3, }; - Animation_pushEvent(&anim, 0, 120, AM_MoveLinear, &ml6); + Animation_pushEvent(&anim, 0, 120, AM_Linear, &ml6); Animation_render(&anim); |
