RetroArch/menu/menu_display.h

195 lines
5.6 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* 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__
#include <stdint.h>
#include <stdlib.h>
#include <boolean.h>
2016-01-08 07:42:29 +00:00
#include <gfx/math/matrix_4x4.h>
#include "../gfx/video_context_driver.h"
#include "../gfx/font_driver.h"
#include "../gfx/video_common.h"
#ifdef __cplusplus
extern "C" {
#endif
2015-09-25 11:27:15 +00:00
enum menu_display_ctl_state
{
MENU_DISPLAY_CTL_SET_VIEWPORT = 0,
MENU_DISPLAY_CTL_UNSET_VIEWPORT,
2015-09-25 19:07:12 +00:00
MENU_DISPLAY_CTL_GET_FRAMEBUFFER_DIRTY_FLAG,
2015-09-25 11:27:15 +00:00
MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG,
2015-09-25 12:03:20 +00:00
MENU_DISPLAY_CTL_UNSET_FRAMEBUFFER_DIRTY_FLAG,
2015-09-25 12:07:01 +00:00
MENU_DISPLAY_CTL_GET_DPI,
MENU_DISPLAY_CTL_UPDATE_PENDING,
MENU_DISPLAY_CTL_WIDTH,
MENU_DISPLAY_CTL_HEIGHT,
2015-09-25 19:52:04 +00:00
MENU_DISPLAY_CTL_HEADER_HEIGHT,
2015-09-26 21:37:25 +00:00
MENU_DISPLAY_CTL_SET_HEADER_HEIGHT,
MENU_DISPLAY_CTL_SET_WIDTH,
MENU_DISPLAY_CTL_SET_HEIGHT,
MENU_DISPLAY_CTL_FB_DATA,
2015-09-25 19:36:11 +00:00
MENU_DISPLAY_CTL_SET_FB_DATA,
2015-09-25 19:20:26 +00:00
MENU_DISPLAY_CTL_FB_PITCH,
2015-09-26 01:02:09 +00:00
MENU_DISPLAY_CTL_SET_FB_PITCH,
2015-09-26 21:25:04 +00:00
MENU_DISPLAY_CTL_LIBRETRO,
MENU_DISPLAY_CTL_LIBRETRO_RUNNING,
MENU_DISPLAY_CTL_SET_STUB_DRAW_FRAME,
MENU_DISPLAY_CTL_UNSET_STUB_DRAW_FRAME,
2015-12-12 14:12:47 +00:00
MENU_DISPLAY_CTL_FRAMEBUF_DEINIT,
2015-09-26 21:27:03 +00:00
MENU_DISPLAY_CTL_FONT_DATA_INIT,
2015-09-26 21:37:25 +00:00
MENU_DISPLAY_CTL_SET_FONT_DATA_INIT,
MENU_DISPLAY_CTL_FONT_SIZE,
MENU_DISPLAY_CTL_SET_FONT_SIZE,
MENU_DISPLAY_CTL_MSG_FORCE,
MENU_DISPLAY_CTL_SET_MSG_FORCE,
MENU_DISPLAY_CTL_FONT_BUF,
MENU_DISPLAY_CTL_FONT_FLUSH_BLOCK,
MENU_DISPLAY_CTL_SET_FONT_BUF,
MENU_DISPLAY_CTL_FONT_FB,
MENU_DISPLAY_CTL_SET_FONT_FB,
MENU_DISPLAY_CTL_BLEND_BEGIN,
MENU_DISPLAY_CTL_BLEND_END
2015-09-25 11:27:15 +00:00
};
2015-10-24 05:51:33 +00:00
enum menu_display_prim_type
{
MENU_DISPLAY_PRIM_NONE = 0,
MENU_DISPLAY_PRIM_TRIANGLESTRIP,
MENU_DISPLAY_PRIM_TRIANGLES
};
enum menu_display_driver_type
{
MENU_VIDEO_DRIVER_GENERIC = 0,
MENU_VIDEO_DRIVER_OPENGL,
MENU_VIDEO_DRIVER_DIRECT3D
};
typedef void (*menu_display_draw_t)(float x, float y,
unsigned width, unsigned height,
struct gfx_coords *coords,
void *matrix_data,
uintptr_t texture,
enum menu_display_prim_type prim_type
);
typedef void (*menu_display_draw_bg_t)(
unsigned width, unsigned height,
uintptr_t texture,
float handle_alpha,
bool force_transparency,
float *color,
float *color2,
const float *vertex,
const float *tex_coord,
size_t vertex_count,
enum menu_display_prim_type prim_type
);
typedef struct menu_display_ctx_driver
{
menu_display_draw_t draw;
menu_display_draw_bg_t draw_bg;
void (*blend_begin)(void);
void (*blend_end)(void);
void (*restore_clear_color)(void);
void (*clear_color)(float r, float g, float b, float a);
void *(*get_default_mvp)(void);
const float *(*get_tex_coords)(void);
unsigned (*texture_load)(void *data, enum texture_filter_type type);
void (*texture_unload)(uintptr_t *id);
2015-12-05 10:29:06 +00:00
bool (*font_init_first)(
void **font_handle, void *video_data, const char *font_path,
float font_size);
enum menu_display_driver_type type;
const char *ident;
} menu_display_ctx_driver_t;
void menu_display_free(void);
bool menu_display_init(void);
bool menu_display_font_bind_block(void *userdata);
bool menu_display_init_main_font(const char *font_path, float font_size);
void menu_display_free_main_font(void);
2015-09-25 11:27:15 +00:00
bool menu_display_ctl(enum menu_display_ctl_state state, void *data);
2015-04-26 16:08:17 +00:00
2015-06-08 12:57:46 +00:00
void menu_display_timedate(char *s, size_t len, unsigned time_mode);
2015-09-22 20:10:43 +00:00
void menu_display_msg_queue_push(const char *msg, unsigned prio, unsigned duration,
bool flush);
2015-10-18 05:15:54 +00:00
bool menu_display_driver_init_first(void);
void menu_display_draw(float x, float y,
2015-10-18 05:15:54 +00:00
unsigned width, unsigned height,
struct gfx_coords *coords,
2015-11-02 20:53:51 +00:00
void *matrix_data,
uintptr_t texture,
2015-10-24 05:51:33 +00:00
enum menu_display_prim_type prim_type
2015-10-18 05:15:54 +00:00
);
void menu_display_draw_bg(
2015-10-18 05:15:54 +00:00
unsigned width, unsigned height,
uintptr_t texture,
2015-10-18 05:15:54 +00:00
float handle_alpha,
bool force_transparency,
float *color,
float *color2,
const float *vertex,
const float *tex_coord,
2015-10-24 05:51:33 +00:00
size_t vertex_count,
enum menu_display_prim_type prim_type
);
2015-11-01 18:49:19 +00:00
2016-01-08 07:42:29 +00:00
void menu_display_matrix_4x4_rotate_z(math_matrix_4x4 *matrix, float rotation,
float scale_x, float scale_y, float scale_z, bool scale_enable);
2015-10-18 05:15:54 +00:00
unsigned menu_display_texture_load(void *data,
enum texture_filter_type filter_type);
void menu_display_restore_clear_color(void);
void menu_display_clear_color(float r, float g, float b, float a);
void menu_display_texture_unload(uintptr_t *id);
2015-11-23 03:17:27 +00:00
void menu_display_handle_wallpaper_upload(void *task_data, void *user_data, const char *err);
void menu_display_handle_boxart_upload(void *task_data, void *user_data, const char *err);
const float *menu_display_get_tex_coords(void);
extern menu_display_ctx_driver_t menu_display_ctx_gl;
2015-11-08 22:18:43 +00:00
extern menu_display_ctx_driver_t menu_display_ctx_d3d;
extern menu_display_ctx_driver_t menu_display_ctx_null;
#ifdef __cplusplus
}
#endif
#endif