Remove hardcoded gfx backend name
Now it's dynamically inserted!
This commit is contained in:
parent
75e1812e79
commit
d965f83daa
5 changed files with 11 additions and 7 deletions
|
@ -503,6 +503,10 @@ static void gfx_opengl_end_frame(void) {
|
|||
static void gfx_opengl_finish_render(void) {
|
||||
}
|
||||
|
||||
const char* gfx_opengl_get_name(void) {
|
||||
return "OpenGL";
|
||||
}
|
||||
|
||||
struct GfxRenderingAPI gfx_opengl_api = {
|
||||
gfx_opengl_z_is_from_0_to_1,
|
||||
gfx_opengl_unload_shader,
|
||||
|
@ -525,7 +529,8 @@ struct GfxRenderingAPI gfx_opengl_api = {
|
|||
gfx_opengl_on_resize,
|
||||
gfx_opengl_start_frame,
|
||||
gfx_opengl_end_frame,
|
||||
gfx_opengl_finish_render
|
||||
gfx_opengl_finish_render,
|
||||
gfx_opengl_get_name,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1611,7 +1611,7 @@ void gfx_get_dimensions(uint32_t *width, uint32_t *height) {
|
|||
void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, const char *game_name, bool start_in_fullscreen) {
|
||||
gfx_wapi = wapi;
|
||||
gfx_rapi = rapi;
|
||||
gfx_wapi->init(game_name, start_in_fullscreen);
|
||||
gfx_wapi->init(game_name, rapi->get_name(), start_in_fullscreen);
|
||||
gfx_rapi->init();
|
||||
|
||||
// Used in the 120 star TAS
|
||||
|
|
|
@ -30,6 +30,7 @@ struct GfxRenderingAPI {
|
|||
void (*start_frame)(void);
|
||||
void (*end_frame)(void);
|
||||
void (*finish_render)(void);
|
||||
const char* (*get_name)(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "gfx_window_manager_api.h"
|
||||
#include "gfx_screen_config.h"
|
||||
|
||||
#define GFX_API_NAME "SDL2 - OpenGL"
|
||||
|
||||
static SDL_Window *wnd;
|
||||
static int inverted_scancode_table[512];
|
||||
static int vsync_enabled = 0;
|
||||
|
@ -152,7 +150,7 @@ int test_vsync(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen) {
|
||||
static void gfx_sdl_init(const char *game_name, const char* gfx_name, bool start_in_fullscreen) {
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||
|
@ -162,7 +160,7 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen) {
|
|||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||
|
||||
char title[512];
|
||||
int len = sprintf(title, "%s (%s)", game_name, GFX_API_NAME);
|
||||
int len = sprintf(title, "%s (SDL - %s)", game_name, gfx_name);
|
||||
|
||||
wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
struct GfxWindowManagerAPI {
|
||||
void (*init)(const char *game_name, bool start_in_fullscreen);
|
||||
void (*init)(const char *game_name, const char* gfx_name, bool start_in_fullscreen);
|
||||
void (*set_keyboard_callbacks)(bool (*on_key_down)(int scancode), bool (*on_key_up)(int scancode), void (*on_all_keys_up)(void));
|
||||
void (*set_fullscreen_changed_callback)(void (*on_fullscreen_changed)(bool is_now_fullscreen));
|
||||
void (*set_fullscreen)(bool enable);
|
||||
|
|
Loading…
Add table
Reference in a new issue