2014-09-19 11:36:18 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2016-10-27 16:17:43 +00:00
|
|
|
* Copyright (C) 2014-2016 - Jean-André Santoni
|
2016-01-10 03:06:50 +00:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2014-10-10 17:53:13 +00:00
|
|
|
*
|
2014-09-19 11:36:18 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-10-10 17:54:15 +00:00
|
|
|
#ifndef _MENU_ANIMATION_H
|
|
|
|
#define _MENU_ANIMATION_H
|
2014-09-19 11:36:18 +00:00
|
|
|
|
2014-10-10 17:53:13 +00:00
|
|
|
#include <stdint.h>
|
2014-09-19 11:36:18 +00:00
|
|
|
#include <stdlib.h>
|
2016-06-03 03:49:46 +00:00
|
|
|
|
2015-02-01 22:05:16 +00:00
|
|
|
#include <boolean.h>
|
2016-06-03 03:49:46 +00:00
|
|
|
#include <retro_common_api.h>
|
2014-09-19 11:36:18 +00:00
|
|
|
|
2016-06-03 03:49:46 +00:00
|
|
|
RETRO_BEGIN_DECLS
|
2014-10-12 18:22:33 +00:00
|
|
|
|
2015-09-26 22:42:27 +00:00
|
|
|
typedef float (*easing_cb) (float, float, float, float);
|
|
|
|
typedef void (*tween_cb) (void);
|
2014-09-19 11:36:18 +00:00
|
|
|
|
2015-09-25 21:33:11 +00:00
|
|
|
enum menu_animation_ctl_state
|
|
|
|
{
|
2016-02-11 00:54:09 +00:00
|
|
|
MENU_ANIMATION_CTL_NONE = 0,
|
2015-12-11 11:00:49 +00:00
|
|
|
MENU_ANIMATION_CTL_DEINIT,
|
2015-09-25 21:39:02 +00:00
|
|
|
MENU_ANIMATION_CTL_CLEAR_ACTIVE,
|
2015-09-25 21:42:00 +00:00
|
|
|
MENU_ANIMATION_CTL_SET_ACTIVE,
|
2015-09-25 21:43:44 +00:00
|
|
|
MENU_ANIMATION_CTL_DELTA_TIME,
|
2016-02-25 14:05:18 +00:00
|
|
|
MENU_ANIMATION_CTL_KILL_BY_TAG,
|
2017-01-17 15:53:06 +00:00
|
|
|
MENU_ANIMATION_CTL_KILL_BY_SUBJECT
|
2015-09-25 21:33:11 +00:00
|
|
|
};
|
|
|
|
|
2015-06-13 21:23:29 +00:00
|
|
|
enum menu_animation_easing_type
|
2015-02-11 00:15:16 +00:00
|
|
|
{
|
|
|
|
/* Linear */
|
|
|
|
EASING_LINEAR = 0,
|
|
|
|
/* Quad */
|
|
|
|
EASING_IN_QUAD,
|
|
|
|
EASING_OUT_QUAD,
|
|
|
|
EASING_IN_OUT_QUAD,
|
|
|
|
EASING_OUT_IN_QUAD,
|
|
|
|
/* Cubic */
|
|
|
|
EASING_IN_CUBIC,
|
|
|
|
EASING_OUT_CUBIC,
|
|
|
|
EASING_IN_OUT_CUBIC,
|
|
|
|
EASING_OUT_IN_CUBIC,
|
|
|
|
/* Quart */
|
|
|
|
EASING_IN_QUART,
|
|
|
|
EASING_OUT_QUART,
|
|
|
|
EASING_IN_OUT_QUART,
|
|
|
|
EASING_OUT_IN_QUART,
|
|
|
|
/* Quint */
|
|
|
|
EASING_IN_QUINT,
|
|
|
|
EASING_OUT_QUINT,
|
|
|
|
EASING_IN_OUT_QUINT,
|
|
|
|
EASING_OUT_IN_QUINT,
|
|
|
|
/* Sine */
|
|
|
|
EASING_IN_SINE,
|
|
|
|
EASING_OUT_SINE,
|
|
|
|
EASING_IN_OUT_SINE,
|
|
|
|
EASING_OUT_IN_SINE,
|
|
|
|
/* Expo */
|
|
|
|
EASING_IN_EXPO,
|
|
|
|
EASING_OUT_EXPO,
|
|
|
|
EASING_IN_OUT_EXPO,
|
|
|
|
EASING_OUT_IN_EXPO,
|
|
|
|
/* Circ */
|
|
|
|
EASING_IN_CIRC,
|
|
|
|
EASING_OUT_CIRC,
|
|
|
|
EASING_IN_OUT_CIRC,
|
|
|
|
EASING_OUT_IN_CIRC,
|
|
|
|
/* Bounce */
|
|
|
|
EASING_IN_BOUNCE,
|
|
|
|
EASING_OUT_BOUNCE,
|
|
|
|
EASING_IN_OUT_BOUNCE,
|
2015-06-26 13:53:18 +00:00
|
|
|
EASING_OUT_IN_BOUNCE
|
2015-02-11 00:15:16 +00:00
|
|
|
};
|
|
|
|
|
2016-02-25 15:05:30 +00:00
|
|
|
typedef struct menu_animation_ctx_delta
|
|
|
|
{
|
|
|
|
float current;
|
|
|
|
float ideal;
|
|
|
|
} menu_animation_ctx_delta_t;
|
|
|
|
|
2016-02-25 12:23:39 +00:00
|
|
|
typedef struct menu_animation_ctx_tag
|
|
|
|
{
|
|
|
|
int id;
|
|
|
|
} menu_animation_ctx_tag_t;
|
2015-06-12 23:04:07 +00:00
|
|
|
|
2016-02-25 14:05:18 +00:00
|
|
|
typedef struct menu_animation_ctx_subject
|
|
|
|
{
|
|
|
|
size_t count;
|
|
|
|
const void *data;
|
|
|
|
} menu_animation_ctx_subject_t;
|
2015-06-23 14:04:57 +00:00
|
|
|
|
2016-02-25 14:44:30 +00:00
|
|
|
typedef struct menu_animation_ctx_entry
|
|
|
|
{
|
|
|
|
float duration;
|
|
|
|
float target_value;
|
|
|
|
float *subject;
|
|
|
|
enum menu_animation_easing_type easing_enum;
|
|
|
|
int tag;
|
|
|
|
tween_cb cb;
|
|
|
|
} menu_animation_ctx_entry_t;
|
|
|
|
|
2016-02-25 14:19:33 +00:00
|
|
|
typedef struct menu_animation_ctx_ticker
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
size_t len;
|
|
|
|
uint64_t idx;
|
|
|
|
const char *str;
|
|
|
|
bool selected;
|
|
|
|
} menu_animation_ctx_ticker_t;
|
|
|
|
|
2017-01-09 15:39:09 +00:00
|
|
|
bool menu_animation_update(float delta_time);
|
|
|
|
|
2017-01-17 15:37:03 +00:00
|
|
|
bool menu_animation_get_ideal_delta_time(menu_animation_ctx_delta_t *delta);
|
|
|
|
|
2017-01-17 15:29:23 +00:00
|
|
|
bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker);
|
|
|
|
|
2017-01-17 15:40:48 +00:00
|
|
|
void menu_animation_update_time(void);
|
|
|
|
|
|
|
|
bool menu_animation_is_active(void);
|
|
|
|
|
2017-01-17 15:53:06 +00:00
|
|
|
bool menu_animation_push(menu_animation_ctx_entry_t *entry);
|
|
|
|
|
2015-09-25 21:33:11 +00:00
|
|
|
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data);
|
2015-09-06 00:41:36 +00:00
|
|
|
|
2016-06-03 03:49:46 +00:00
|
|
|
RETRO_END_DECLS
|
2014-10-12 18:22:33 +00:00
|
|
|
|
2014-10-10 17:53:13 +00:00
|
|
|
#endif
|