mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
Configurable smoothness.
This commit is contained in:
parent
d82bff0bb6
commit
a4b6c3d1ec
1
config.h
1
config.h
@ -54,6 +54,7 @@ static const unsigned fullscreen_y = 720;
|
||||
|
||||
// Video VSYNC (recommended)
|
||||
static const bool vsync = true;
|
||||
static const bool video_smooth = true; // Smooths picture
|
||||
|
||||
// Audio
|
||||
static const unsigned out_rate = 44100;
|
||||
|
12
driver.h
12
driver.h
@ -30,6 +30,16 @@ struct snes_keybind
|
||||
int joykey;
|
||||
};
|
||||
|
||||
typedef struct video_info
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
bool fullscreen;
|
||||
bool vsync;
|
||||
bool force_aspect;
|
||||
bool smooth;
|
||||
} video_info_t;
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
void* (*init)(const char* device, int rate, int latency);
|
||||
@ -49,7 +59,7 @@ typedef struct input_driver
|
||||
|
||||
typedef struct video_driver
|
||||
{
|
||||
void* (*init)(int width, int height, bool fullscreen, bool vsync, bool force_aspect, input_driver_t **input);
|
||||
void* (*init)(video_info_t *video, input_driver_t **input);
|
||||
// Should the video driver act as an input driver as well? :)
|
||||
bool (*frame)(void* data, const uint16_t* frame, int width, int height);
|
||||
void (*free)(void* data);
|
||||
|
17
gl.c
17
gl.c
@ -25,6 +25,7 @@
|
||||
static GLuint texture;
|
||||
static uint8_t *gl_buffer;
|
||||
static bool keep_aspect = true;
|
||||
static GLuint tex_filter;
|
||||
|
||||
typedef struct gl
|
||||
{
|
||||
@ -137,8 +138,8 @@ static bool gl_frame(void *data, const uint16_t* frame, int width, int height)
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, tex_filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, tex_filter);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
|
||||
|
||||
@ -169,18 +170,22 @@ static void gl_free(void *data)
|
||||
free(gl_buffer);
|
||||
}
|
||||
|
||||
static void* gl_init(int width, int height, bool fullscreen, bool vsync, bool force_aspect, input_driver_t **input)
|
||||
static void* gl_init(video_info_t *video, input_driver_t **input)
|
||||
{
|
||||
gl_t *foo = malloc(sizeof(gl_t));
|
||||
if ( foo == NULL )
|
||||
return NULL;
|
||||
|
||||
keep_aspect = force_aspect;
|
||||
keep_aspect = video->force_aspect;
|
||||
if ( video->smooth )
|
||||
tex_filter = GL_LINEAR;
|
||||
else
|
||||
tex_filter = GL_NEAREST;
|
||||
|
||||
glfwInit();
|
||||
|
||||
int res;
|
||||
res = glfwOpenWindow(width, height, 0, 0, 0, 0, 0, 0, (fullscreen) ? GLFW_FULLSCREEN : GLFW_WINDOW);
|
||||
res = glfwOpenWindow(video->width, video->height, 0, 0, 0, 0, 0, 0, (video->fullscreen) ? GLFW_FULLSCREEN : GLFW_WINDOW);
|
||||
|
||||
if ( !res )
|
||||
{
|
||||
@ -190,7 +195,7 @@ static void* gl_init(int width, int height, bool fullscreen, bool vsync, bool fo
|
||||
|
||||
glfwSetWindowSizeCallback(resize);
|
||||
|
||||
if ( vsync )
|
||||
if ( video->vsync )
|
||||
glfwSwapInterval(1); // Force vsync
|
||||
else
|
||||
glfwSwapInterval(0);
|
||||
|
11
ssnes.c
11
ssnes.c
@ -101,7 +101,16 @@ static void uninit_audio(void)
|
||||
|
||||
static void init_video_input(void)
|
||||
{
|
||||
driver.video_data = driver.video->init((fullscreen) ? fullscreen_x : (256 * xscale), (fullscreen) ? fullscreen_y : (224 * yscale), fullscreen, vsync, force_aspect, (input_driver_t**)&(driver.input));
|
||||
video_info_t video = {
|
||||
.width = (fullscreen) ? fullscreen_x : (256 * xscale),
|
||||
.height = (fullscreen) ? fullscreen_y : (224 * yscale),
|
||||
.fullscreen = fullscreen,
|
||||
.vsync = vsync,
|
||||
.force_aspect = force_aspect,
|
||||
.smooth = video_smooth
|
||||
};
|
||||
|
||||
driver.video_data = driver.video->init(&video, (input_driver_t**)&(driver.input));
|
||||
|
||||
if ( driver.video_data == NULL )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user