2012-04-21 21:13:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2013-01-01 00:37:37 +00:00
|
|
|
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
|
2012-07-25 05:22:49 +00:00
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2011-03-26 17:34:58 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2011-03-26 17:34:58 +00:00
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
2012-04-21 21:31:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2011-03-26 17:34:58 +00:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GFX_COMMON_H
|
|
|
|
#define __GFX_COMMON_H
|
|
|
|
|
2012-11-04 21:55:11 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2011-03-26 17:34:58 +00:00
|
|
|
#include <stddef.h>
|
2013-01-29 18:28:33 +00:00
|
|
|
#include "../general.h"
|
2011-12-24 12:46:12 +00:00
|
|
|
#include "../boolean.h"
|
2011-03-26 17:34:58 +00:00
|
|
|
|
2012-07-27 13:47:56 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
2013-10-07 19:54:29 +00:00
|
|
|
// bufs gets a string suitable for Window title, buf_fps for raw FPS only.
|
|
|
|
// buf_fps is optional.
|
|
|
|
bool gfx_get_fps(char *buf, size_t size, char *buf_fps, size_t size_fps);
|
2011-03-26 17:34:58 +00:00
|
|
|
|
2011-08-07 13:00:34 +00:00
|
|
|
#ifdef _WIN32
|
2011-08-07 19:15:50 +00:00
|
|
|
void gfx_set_dwm(void);
|
2011-08-07 13:00:34 +00:00
|
|
|
#endif
|
|
|
|
|
2013-01-29 18:28:33 +00:00
|
|
|
void gfx_scale_integer(struct rarch_viewport *vp, unsigned win_width, unsigned win_height,
|
|
|
|
float aspect_ratio, bool keep_aspect);
|
|
|
|
|
2013-03-11 19:05:05 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
float scale;
|
|
|
|
unsigned color;
|
|
|
|
} font_params_t;
|
|
|
|
|
2013-03-09 02:20:33 +00:00
|
|
|
#define MIN_SCALING_FACTOR (1.0f)
|
|
|
|
|
|
|
|
#if defined(__CELLOS_LV2__)
|
|
|
|
#define MAX_SCALING_FACTOR (5.0f)
|
|
|
|
#else
|
|
|
|
#define MAX_SCALING_FACTOR (2.0f)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
enum aspect_ratio
|
|
|
|
{
|
2013-04-20 08:56:04 +00:00
|
|
|
ASPECT_RATIO_4_3 = 0,
|
|
|
|
ASPECT_RATIO_16_9,
|
|
|
|
ASPECT_RATIO_16_10,
|
|
|
|
ASPECT_RATIO_16_15,
|
|
|
|
#ifdef RARCH_CONSOLE // None of these aspect ratios make any sense.
|
|
|
|
ASPECT_RATIO_1_1,
|
2013-03-09 02:20:33 +00:00
|
|
|
ASPECT_RATIO_2_1,
|
|
|
|
ASPECT_RATIO_3_2,
|
|
|
|
ASPECT_RATIO_3_4,
|
|
|
|
ASPECT_RATIO_4_1,
|
|
|
|
ASPECT_RATIO_4_4,
|
|
|
|
ASPECT_RATIO_5_4,
|
|
|
|
ASPECT_RATIO_6_5,
|
|
|
|
ASPECT_RATIO_7_9,
|
|
|
|
ASPECT_RATIO_8_3,
|
|
|
|
ASPECT_RATIO_8_7,
|
|
|
|
ASPECT_RATIO_19_12,
|
|
|
|
ASPECT_RATIO_19_14,
|
|
|
|
ASPECT_RATIO_30_17,
|
|
|
|
ASPECT_RATIO_32_9,
|
2013-04-20 08:56:04 +00:00
|
|
|
#endif
|
|
|
|
ASPECT_RATIO_CONFIG,
|
|
|
|
ASPECT_RATIO_SQUARE,
|
2013-03-09 02:20:33 +00:00
|
|
|
ASPECT_RATIO_CORE,
|
|
|
|
ASPECT_RATIO_CUSTOM,
|
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
ASPECT_RATIO_END
|
2013-03-09 02:20:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define LAST_ASPECT_RATIO ASPECT_RATIO_CUSTOM
|
|
|
|
|
|
|
|
enum rotation
|
|
|
|
{
|
|
|
|
ORIENTATION_NORMAL = 0,
|
|
|
|
ORIENTATION_VERTICAL,
|
|
|
|
ORIENTATION_FLIPPED,
|
|
|
|
ORIENTATION_FLIPPED_ROTATED,
|
|
|
|
ORIENTATION_END
|
|
|
|
};
|
|
|
|
|
2013-03-10 00:16:56 +00:00
|
|
|
#define LAST_ORIENTATION (ORIENTATION_END - 1)
|
2013-03-09 02:20:33 +00:00
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
extern char rotation_lut[4][32];
|
2013-03-09 02:20:33 +00:00
|
|
|
|
|
|
|
/* ABGR color format defines */
|
|
|
|
|
|
|
|
#define WHITE 0xffffffffu
|
|
|
|
#define RED 0xff0000ffu
|
|
|
|
#define GREEN 0xff00ff00u
|
|
|
|
#define BLUE 0xffff0000u
|
|
|
|
#define YELLOW 0xff00ffffu
|
|
|
|
#define PURPLE 0xffff00ffu
|
|
|
|
#define CYAN 0xffffff00u
|
|
|
|
#define ORANGE 0xff0063ffu
|
|
|
|
#define SILVER 0xff8c848cu
|
|
|
|
#define LIGHTBLUE 0xFFFFE0E0U
|
|
|
|
#define LIGHTORANGE 0xFFE0EEFFu
|
|
|
|
|
|
|
|
struct aspect_ratio_elem
|
|
|
|
{
|
|
|
|
char name[64];
|
|
|
|
float value;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END];
|
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
void gfx_set_square_pixel_viewport(unsigned width, unsigned height);
|
|
|
|
void gfx_set_core_viewport(void);
|
|
|
|
void gfx_set_config_viewport(void);
|
2013-03-09 02:20:33 +00:00
|
|
|
|
2012-11-04 21:55:11 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-03-26 17:34:58 +00:00
|
|
|
#endif
|