···11+// MIT License
22+33+// Copyright (c) 2017 Vadim Grigoruk @nesbox // grigoruk@gmail.com
44+55+// Permission is hereby granted, free of charge, to any person obtaining a copy
66+// of this software and associated documentation files (the "Software"), to deal
77+// in the Software without restriction, including without limitation the rights
88+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99+// copies of the Software, and to permit persons to whom the Software is
1010+// furnished to do so, subject to the following conditions:
1111+1212+// The above copyright notice and this permission notice shall be included in all
1313+// copies or substantial portions of the Software.
1414+1515+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121+// SOFTWARE.
2222+2323+#pragma once
2424+2525+typedef enum
2626+{
2727+ AnimLinear,
2828+ AnimEaseIn,
2929+ AnimEaseOut,
3030+ AnimEaseInOut,
3131+ AnimEaseInCubic,
3232+ AnimEaseOutCubic,
3333+ AnimEaseInOutCubic,
3434+ AnimEaseInQuart,
3535+ AnimEaseOutQuart,
3636+ AnimEaseInOutQuart,
3737+ AnimEaseInQuint,
3838+ AnimEaseOutQuint,
3939+ AnimEaseInOutQuint,
4040+ AnimEaseInSine,
4141+ AnimEaseOutSine,
4242+ AnimEaseInOutSine,
4343+ AnimEaseInExpo,
4444+ AnimEaseOutExpo,
4545+ AnimEaseInOutExpo,
4646+ AnimEaseInCirc,
4747+ AnimEaseOutCirc,
4848+ AnimEaseInOutCirc,
4949+ AnimEaseInBack,
5050+ AnimEaseOutBack,
5151+ AnimEaseInOutBack,
5252+ AnimEaseInElastic,
5353+ AnimEaseOutElastic,
5454+ AnimEaseInOutElastic,
5555+ AnimEaseInBounce,
5656+ AnimEaseOutBounce,
5757+ AnimEaseInOutBounce,
5858+} AnimEffect;
5959+6060+typedef struct
6161+{
6262+ s32 start;
6363+ s32 end;
6464+ s32 time;
6565+6666+ s32 *value;
6767+6868+ AnimEffect effect;
6969+} Anim;
7070+7171+typedef struct
7272+{
7373+ void(*done)(void *data);
7474+7575+ s32 time;
7676+ s32 tick;
7777+7878+ s32 count;
7979+ Anim* items;
8080+} Movie;
8181+8282+#define MOVIE_DEF(TIME, DONE, ...) \
8383+{ \
8484+ .time = TIME, \
8585+ .done = DONE, \
8686+ .count = COUNT_OF(((Anim[])__VA_ARGS__)), \
8787+ .items = MOVE((Anim[])__VA_ARGS__), \
8888+}
8989+9090+void processAnim(Movie* movie, void* data);
9191+Movie* resetMovie(Movie* movie);