2018-11-22 14:45:52 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
|
|
|
* Copyright (C) 2018 - natinusala
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
#ifndef _GFX_WIDGETS_H
|
|
|
|
#define _GFX_WIDGETS_H
|
2018-11-22 14:45:52 +00:00
|
|
|
|
2020-02-23 10:03:38 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
2020-01-12 20:46:28 +00:00
|
|
|
#include <formats/image.h>
|
2018-11-22 14:45:52 +00:00
|
|
|
#include <queues/task_queue.h>
|
|
|
|
#include <queues/message_queue.h>
|
|
|
|
|
2019-02-21 09:23:21 +00:00
|
|
|
#define DEFAULT_BACKDROP 0.75f
|
|
|
|
|
|
|
|
#define MSG_QUEUE_PENDING_MAX 32
|
|
|
|
#define MSG_QUEUE_ONSCREEN_MAX 4
|
|
|
|
|
|
|
|
#define MSG_QUEUE_ANIMATION_DURATION 330
|
|
|
|
#define VOLUME_DURATION 3000
|
|
|
|
#define SCREENSHOT_DURATION_IN 66
|
|
|
|
#define SCREENSHOT_DURATION_OUT SCREENSHOT_DURATION_IN*10
|
2019-05-01 13:46:57 +00:00
|
|
|
#define SCREENSHOT_NOTIFICATION_DURATION 6000
|
2019-04-11 14:46:29 +00:00
|
|
|
#define CHEEVO_NOTIFICATION_DURATION 4000
|
2019-02-21 09:23:21 +00:00
|
|
|
#define TASK_FINISHED_DURATION 3000
|
|
|
|
#define HOURGLASS_INTERVAL 5000
|
|
|
|
#define HOURGLASS_DURATION 1000
|
2019-05-04 21:21:17 +00:00
|
|
|
#define GENERIC_MESSAGE_DURATION 3000
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-03-09 08:55:27 +00:00
|
|
|
/* A widget */
|
2020-03-09 09:32:12 +00:00
|
|
|
/* TODO: cleanup all unused parameters */
|
2020-03-09 08:55:27 +00:00
|
|
|
struct gfx_widget
|
|
|
|
{
|
|
|
|
/* called when the widgets system is initialized
|
|
|
|
* -> initialize the widget here */
|
|
|
|
bool (*init)(bool video_is_threaded, bool fullscreen);
|
|
|
|
|
|
|
|
/* called when the widgets system is freed
|
|
|
|
* -> free the widget here */
|
|
|
|
void (*free)(void);
|
|
|
|
|
|
|
|
/* called when the graphics context is reset
|
|
|
|
* -> (re)load the textures here */
|
|
|
|
void (*context_reset)(bool is_threaded,
|
|
|
|
unsigned width, unsigned height, bool fullscreen,
|
|
|
|
const char *dir_assets, char *font_path);
|
|
|
|
|
|
|
|
/* called when the graphics context is destroyed
|
|
|
|
* -> release the textures here */
|
|
|
|
void (*context_destroy)(void);
|
|
|
|
|
|
|
|
/* called when the window resolution changes
|
|
|
|
* -> (re)layout the widget here */
|
|
|
|
void (*layout)(bool is_threaded, const char *dir_assets, char *font_path);
|
|
|
|
|
|
|
|
/* called every frame on the main thread
|
|
|
|
* -> update the widget logic here */
|
|
|
|
void (*iterate)(
|
|
|
|
unsigned width, unsigned height, bool fullscreen,
|
|
|
|
const char *dir_assets, char *font_path,
|
|
|
|
bool is_threaded);
|
|
|
|
|
|
|
|
/* called every frame
|
|
|
|
* (on the video thread if threaded video is on)
|
|
|
|
* -> draw the widget here */
|
|
|
|
void (*frame)(void* data);
|
|
|
|
};
|
|
|
|
|
2020-03-09 09:32:12 +00:00
|
|
|
typedef struct gfx_widget gfx_widget_t;
|
|
|
|
|
|
|
|
extern gfx_widget_t gfx_widget_screenshot;
|
2020-03-09 08:55:27 +00:00
|
|
|
|
2020-03-04 17:07:49 +00:00
|
|
|
bool gfx_widgets_init(bool video_is_threaded, bool fullscreen);
|
2019-08-15 12:56:38 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_free(void);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_msg_queue_push(
|
2019-06-18 19:24:42 +00:00
|
|
|
retro_task_t *task, const char *msg,
|
2019-02-21 09:23:21 +00:00
|
|
|
unsigned duration,
|
|
|
|
char *title,
|
2019-06-18 19:24:42 +00:00
|
|
|
enum message_queue_icon icon,
|
|
|
|
enum message_queue_category category,
|
2020-02-17 15:07:37 +00:00
|
|
|
unsigned prio, bool flush,
|
|
|
|
bool menu_is_alive);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_volume_update_and_show(float new_volume,
|
2020-02-16 22:34:49 +00:00
|
|
|
bool mute);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_iterate(
|
2020-03-04 17:07:49 +00:00
|
|
|
unsigned width, unsigned height, bool fullscreen,
|
2020-02-16 22:38:24 +00:00
|
|
|
const char *dir_assets, char *font_path,
|
|
|
|
bool is_threaded);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_screenshot_taken(const char *shotname, const char *filename);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2019-10-23 21:15:14 +00:00
|
|
|
/* AI Service functions */
|
2020-02-23 10:03:38 +00:00
|
|
|
#ifdef HAVE_TRANSLATE
|
2020-02-17 00:43:40 +00:00
|
|
|
int gfx_widgets_ai_service_overlay_get_state(void);
|
|
|
|
bool gfx_widgets_ai_service_overlay_set_state(int state);
|
2019-10-23 21:15:14 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
bool gfx_widgets_ai_service_overlay_load(
|
2020-01-12 20:46:28 +00:00
|
|
|
char* buffer, unsigned buffer_len,
|
|
|
|
enum image_type_enum image_type);
|
2019-10-23 21:15:14 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_ai_service_overlay_unload(void);
|
2020-02-23 10:03:38 +00:00
|
|
|
#endif
|
2019-10-23 21:15:14 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_start_load_content_animation(
|
2020-01-12 20:46:28 +00:00
|
|
|
const char *content_name, bool remove_extension);
|
2019-08-15 13:50:26 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_cleanup_load_content_animation(void);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_context_reset(bool is_threaded,
|
2020-03-04 17:07:49 +00:00
|
|
|
unsigned width, unsigned height, bool fullscreen,
|
2020-02-13 17:26:16 +00:00
|
|
|
const char *dir_assets, char *font_path);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_push_achievement(const char *title, const char *badge);
|
2019-04-11 14:46:29 +00:00
|
|
|
|
2019-05-04 21:21:17 +00:00
|
|
|
/* Warning: not thread safe! */
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_set_message(char *message);
|
2019-05-04 21:21:17 +00:00
|
|
|
|
2019-05-11 15:24:00 +00:00
|
|
|
/* Warning: not thread safe! */
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_set_libretro_message(const char *message, unsigned duration);
|
2019-05-11 15:24:00 +00:00
|
|
|
|
2019-02-21 09:23:21 +00:00
|
|
|
/* All the functions below should be called in
|
2019-04-11 14:46:29 +00:00
|
|
|
* the video driver - once they are all added, set
|
2019-02-21 09:23:21 +00:00
|
|
|
* enable_menu_widgets to true for that driver */
|
2020-02-17 00:43:40 +00:00
|
|
|
void gfx_widgets_frame(void *data);
|
2019-02-21 09:23:21 +00:00
|
|
|
|
2020-02-17 00:43:40 +00:00
|
|
|
bool gfx_widgets_set_fps_text(const char *new_fps_text);
|
2019-09-23 07:22:35 +00:00
|
|
|
|
2019-05-04 16:26:57 +00:00
|
|
|
#endif
|