2015-04-21 14:44:14 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2016-01-10 04:06:50 +01:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2015-04-21 14:44:14 +02: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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MENU_DISPLAY_H__
|
|
|
|
#define __MENU_DISPLAY_H__
|
|
|
|
|
2015-06-13 23:07:27 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <boolean.h>
|
|
|
|
|
2016-01-08 08:42:29 +01:00
|
|
|
#include <gfx/math/matrix_4x4.h>
|
|
|
|
|
2015-11-08 01:30:07 +01:00
|
|
|
#include "../gfx/video_context_driver.h"
|
2016-03-05 07:27:48 +01:00
|
|
|
#include "../gfx/video_coord_array.h"
|
2015-11-02 22:06:51 +01:00
|
|
|
|
2015-04-21 14:44:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-09-25 13:27:15 +02:00
|
|
|
enum menu_display_ctl_state
|
|
|
|
{
|
2016-02-09 00:49:37 +01:00
|
|
|
MENU_DISPLAY_CTL_NONE = 0,
|
|
|
|
MENU_DISPLAY_CTL_SET_VIEWPORT,
|
2015-09-25 13:27:15 +02:00
|
|
|
MENU_DISPLAY_CTL_UNSET_VIEWPORT,
|
2015-09-25 21:07:12 +02:00
|
|
|
MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG,
|
2015-09-25 13:27:15 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG,
|
2015-09-25 14:03:20 +02:00
|
|
|
MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG,
|
2015-09-25 14:07:01 +02:00
|
|
|
MENU_DISPLAY_CTL_GET_DPI,
|
2015-09-25 20:28:56 +02:00
|
|
|
MENU_DISPLAY_CTL_UPDATE_PENDING,
|
|
|
|
MENU_DISPLAY_CTL_WIDTH,
|
|
|
|
MENU_DISPLAY_CTL_HEIGHT,
|
2015-09-25 21:52:04 +02:00
|
|
|
MENU_DISPLAY_CTL_HEADER_HEIGHT,
|
2015-09-26 23:37:25 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_HEADER_HEIGHT,
|
2015-09-25 20:28:56 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_WIDTH,
|
2015-09-25 21:03:23 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_HEIGHT,
|
2015-09-25 21:20:26 +02:00
|
|
|
MENU_DISPLAY_CTL_FB_PITCH,
|
2015-09-26 03:02:09 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_FB_PITCH,
|
2015-09-26 23:25:04 +02:00
|
|
|
MENU_DISPLAY_CTL_LIBRETRO,
|
2015-10-31 17:06:08 +01:00
|
|
|
MENU_DISPLAY_CTL_LIBRETRO_RUNNING,
|
2015-12-07 20:57:24 +01:00
|
|
|
MENU_DISPLAY_CTL_SET_STUB_DRAW_FRAME,
|
|
|
|
MENU_DISPLAY_CTL_UNSET_STUB_DRAW_FRAME,
|
2015-12-12 15:12:47 +01:00
|
|
|
MENU_DISPLAY_CTL_FRAMEBUF_DEINIT,
|
2016-02-09 00:07:12 +01:00
|
|
|
MENU_DISPLAY_CTL_DEINIT,
|
2016-02-09 00:12:09 +01:00
|
|
|
MENU_DISPLAY_CTL_INIT,
|
2016-02-09 00:49:37 +01:00
|
|
|
MENU_DISPLAY_CTL_INIT_FIRST_DRIVER,
|
2015-09-26 23:27:03 +02:00
|
|
|
MENU_DISPLAY_CTL_FONT_DATA_INIT,
|
2015-09-26 23:37:25 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_FONT_DATA_INIT,
|
|
|
|
MENU_DISPLAY_CTL_FONT_SIZE,
|
2015-09-26 23:51:35 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_FONT_SIZE,
|
|
|
|
MENU_DISPLAY_CTL_MSG_FORCE,
|
2015-09-27 00:00:54 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_MSG_FORCE,
|
|
|
|
MENU_DISPLAY_CTL_FONT_BUF,
|
2015-12-12 23:48:44 +01:00
|
|
|
MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK,
|
2015-09-27 00:00:54 +02:00
|
|
|
MENU_DISPLAY_CTL_SET_FONT_BUF,
|
|
|
|
MENU_DISPLAY_CTL_FONT_FB,
|
2015-12-12 23:53:16 +01:00
|
|
|
MENU_DISPLAY_CTL_SET_FONT_FB,
|
2016-02-09 01:24:35 +01:00
|
|
|
MENU_DISPLAY_CTL_FONT_MAIN_DEINIT,
|
|
|
|
MENU_DISPLAY_CTL_FONT_MAIN_INIT,
|
2016-02-09 00:57:10 +01:00
|
|
|
MENU_DISPLAY_CTL_FONT_BIND_BLOCK,
|
2015-12-12 23:53:16 +01:00
|
|
|
MENU_DISPLAY_CTL_BLEND_BEGIN,
|
2016-02-09 01:36:00 +01:00
|
|
|
MENU_DISPLAY_CTL_BLEND_END,
|
2016-02-09 03:04:23 +01:00
|
|
|
MENU_DISPLAY_CTL_RESTORE_CLEAR_COLOR,
|
2016-02-09 04:34:07 +01:00
|
|
|
MENU_DISPLAY_CTL_CLEAR_COLOR,
|
|
|
|
MENU_DISPLAY_CTL_DRAW,
|
2016-02-09 04:43:15 +01:00
|
|
|
MENU_DISPLAY_CTL_DRAW_BG,
|
2016-04-17 03:06:20 +07:00
|
|
|
MENU_DISPLAY_CTL_DRAW_GRADIENT,
|
2016-02-09 04:49:47 +01:00
|
|
|
MENU_DISPLAY_CTL_ROTATE_Z,
|
2016-02-09 05:03:13 +01:00
|
|
|
MENU_DISPLAY_CTL_TEX_COORDS_GET,
|
2016-04-19 07:17:17 +02:00
|
|
|
MENU_DISPLAY_CTL_TIMEDATE,
|
|
|
|
MENU_DISPLAY_CTL_COORDS_ARRAY_RESET,
|
|
|
|
MENU_DISPLAY_CTL_COORDS_ARRAY_GET
|
2015-09-25 13:27:15 +02:00
|
|
|
};
|
|
|
|
|
2015-10-24 07:51:33 +02:00
|
|
|
enum menu_display_prim_type
|
|
|
|
{
|
|
|
|
MENU_DISPLAY_PRIM_NONE = 0,
|
|
|
|
MENU_DISPLAY_PRIM_TRIANGLESTRIP,
|
|
|
|
MENU_DISPLAY_PRIM_TRIANGLES
|
|
|
|
};
|
|
|
|
|
2015-11-08 01:30:07 +01:00
|
|
|
enum menu_display_driver_type
|
|
|
|
{
|
|
|
|
MENU_VIDEO_DRIVER_GENERIC = 0,
|
|
|
|
MENU_VIDEO_DRIVER_OPENGL,
|
2016-02-16 20:24:00 +01:00
|
|
|
MENU_VIDEO_DRIVER_VULKAN,
|
2015-11-08 01:30:07 +01:00
|
|
|
MENU_VIDEO_DRIVER_DIRECT3D
|
|
|
|
};
|
|
|
|
|
2016-02-09 03:04:23 +01:00
|
|
|
typedef struct menu_display_ctx_clearcolor
|
|
|
|
{
|
|
|
|
float r;
|
|
|
|
float g;
|
|
|
|
float b;
|
|
|
|
float a;
|
|
|
|
} menu_display_ctx_clearcolor_t;
|
|
|
|
|
2016-02-09 04:12:33 +01:00
|
|
|
typedef struct menu_display_ctx_draw
|
|
|
|
{
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
unsigned width;
|
|
|
|
unsigned height;
|
2016-04-19 08:08:40 +02:00
|
|
|
bool dont_replace_coords;
|
2016-02-09 04:12:33 +01:00
|
|
|
struct gfx_coords *coords;
|
|
|
|
void *matrix_data;
|
|
|
|
uintptr_t texture;
|
|
|
|
enum menu_display_prim_type prim_type;
|
|
|
|
float handle_alpha;
|
|
|
|
bool force_transparency;
|
|
|
|
float *color;
|
|
|
|
const float *vertex;
|
|
|
|
const float *tex_coord;
|
|
|
|
size_t vertex_count;
|
|
|
|
} menu_display_ctx_draw_t;
|
|
|
|
|
|
|
|
typedef struct menu_display_ctx_rotate_draw
|
|
|
|
{
|
|
|
|
math_matrix_4x4 *matrix;
|
|
|
|
float rotation;
|
|
|
|
float scale_x;
|
|
|
|
float scale_y;
|
|
|
|
float scale_z;
|
|
|
|
bool scale_enable;
|
|
|
|
} menu_display_ctx_rotate_draw_t;
|
|
|
|
|
2016-02-09 04:49:47 +01:00
|
|
|
typedef struct menu_display_ctx_coord_draw
|
|
|
|
{
|
|
|
|
const float *ptr;
|
|
|
|
} menu_display_ctx_coord_draw_t;
|
|
|
|
|
2016-02-09 05:03:13 +01:00
|
|
|
typedef struct menu_display_ctx_datetime
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
size_t len;
|
|
|
|
unsigned time_mode;
|
|
|
|
} menu_display_ctx_datetime_t;
|
2015-04-26 18:08:17 +02:00
|
|
|
|
2016-02-09 15:55:31 +01:00
|
|
|
typedef struct menu_display_ctx_driver
|
|
|
|
{
|
2016-02-09 16:11:37 +01:00
|
|
|
void (*draw)(void *data);
|
2016-04-19 08:50:35 +02:00
|
|
|
void (*viewport)(void *data);
|
2016-02-09 15:55:31 +01:00
|
|
|
void (*blend_begin)(void);
|
|
|
|
void (*blend_end)(void);
|
|
|
|
void (*restore_clear_color)(void);
|
2016-04-15 04:20:57 +02:00
|
|
|
void (*clear_color)(menu_display_ctx_clearcolor_t *clearcolor);
|
2016-02-09 15:55:31 +01:00
|
|
|
void *(*get_default_mvp)(void);
|
2016-04-15 03:31:59 +02:00
|
|
|
const float *(*get_default_vertices)(void);
|
|
|
|
const float *(*get_default_tex_coords)(void);
|
2016-02-09 15:55:31 +01:00
|
|
|
bool (*font_init_first)(
|
2016-02-09 16:11:37 +01:00
|
|
|
void **font_handle, void *video_data,
|
|
|
|
const char *font_path, float font_size);
|
2016-02-09 15:55:31 +01:00
|
|
|
enum menu_display_driver_type type;
|
|
|
|
const char *ident;
|
|
|
|
} menu_display_ctx_driver_t;
|
|
|
|
|
|
|
|
typedef struct menu_display_ctx_font
|
|
|
|
{
|
|
|
|
const char *path;
|
|
|
|
float size;
|
|
|
|
} menu_display_ctx_font_t;
|
|
|
|
|
2016-03-05 08:40:28 +01:00
|
|
|
typedef uintptr_t menu_texture_item;
|
|
|
|
|
2016-02-09 05:03:13 +01:00
|
|
|
bool menu_display_ctl(enum menu_display_ctl_state state, void *data);
|
2015-06-08 14:57:46 +02:00
|
|
|
|
2016-02-09 00:59:42 +01:00
|
|
|
void menu_display_handle_wallpaper_upload(void *task_data,
|
|
|
|
void *user_data, const char *err);
|
2015-11-23 00:17:27 -03:00
|
|
|
|
2016-04-19 07:17:17 +02:00
|
|
|
void menu_display_push_quad(
|
2016-04-19 07:04:00 +02:00
|
|
|
unsigned width, unsigned height,
|
|
|
|
const float *colors, int x1, int y1,
|
2016-04-19 06:57:53 +02:00
|
|
|
int x2, int y2);
|
|
|
|
|
2016-04-19 07:17:17 +02:00
|
|
|
void menu_display_snow(int width, int height);
|
2016-04-19 06:57:53 +02:00
|
|
|
|
2016-04-19 07:41:05 +02:00
|
|
|
void menu_display_allocate_white_texture(void);
|
|
|
|
|
|
|
|
void menu_display_draw_cursor(
|
|
|
|
float *color, float cursor_size, uintptr_t texture,
|
|
|
|
float x, float y, unsigned width, unsigned height);
|
|
|
|
|
2016-04-18 02:56:42 +02:00
|
|
|
extern uintptr_t menu_display_white_texture;
|
2016-04-12 04:30:25 +07:00
|
|
|
|
2015-11-08 01:30:07 +01:00
|
|
|
extern menu_display_ctx_driver_t menu_display_ctx_gl;
|
2016-02-16 20:24:00 +01:00
|
|
|
extern menu_display_ctx_driver_t menu_display_ctx_vulkan;
|
2015-11-08 23:18:43 +01:00
|
|
|
extern menu_display_ctx_driver_t menu_display_ctx_d3d;
|
2015-11-08 01:30:07 +01:00
|
|
|
extern menu_display_ctx_driver_t menu_display_ctx_null;
|
2015-11-02 20:41:42 +01:00
|
|
|
|
2015-04-21 14:44:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|