form window title in pc_main; show correct RAPI in it

This commit is contained in:
fgsfds 2020-06-11 03:54:30 +03:00
parent a81a8e6ef1
commit 383983ef9d
3 changed files with 17 additions and 14 deletions

View file

@ -1718,18 +1718,7 @@ void gfx_get_dimensions(uint32_t *width, uint32_t *height) {
gfx_wapi->get_dimensions(width, height); gfx_wapi->get_dimensions(width, height);
} }
void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi) { void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, const char *window_title) {
char window_title[96] =
#ifndef USE_GLES
"Super Mario 64 PC port (OpenGL)"
#else
"Super Mario 64 PC port (OpenGL_ES2)"
#endif
#ifdef NIGHTLY
" nightly " GIT_HASH
#endif
;
gfx_wapi = wapi; gfx_wapi = wapi;
gfx_rapi = rapi; gfx_rapi = rapi;
gfx_wapi->init(window_title); gfx_wapi->init(window_title);

View file

@ -11,7 +11,7 @@ struct GfxDimensions {
extern struct GfxDimensions gfx_current_dimensions; extern struct GfxDimensions gfx_current_dimensions;
void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi); void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, const char *window_title);
void gfx_start_frame(void); void gfx_start_frame(void);
void gfx_run(Gfx *commands); void gfx_run(Gfx *commands);
void gfx_end_frame(void); void gfx_end_frame(void);

View file

@ -175,15 +175,29 @@ void main_func(void) {
#if defined(RAPI_D3D11) #if defined(RAPI_D3D11)
rendering_api = &gfx_d3d11_api; rendering_api = &gfx_d3d11_api;
# define RAPI_NAME "DirectX 11"
#elif defined(RAPI_D3D12) #elif defined(RAPI_D3D12)
rendering_api = &gfx_d3d12_api; rendering_api = &gfx_d3d12_api;
# define RAPI_NAME "DirectX 12"
#elif defined(RAPI_GL) || defined(RAPI_GL_LEGACY) #elif defined(RAPI_GL) || defined(RAPI_GL_LEGACY)
rendering_api = &gfx_opengl_api; rendering_api = &gfx_opengl_api;
# ifdef USE_GLES
# define RAPI_NAME "OpenGL ES"
# else
# define RAPI_NAME "OpenGL"
# endif
#else #else
#error No rendering API! #error No rendering API!
#endif #endif
gfx_init(wm_api, rendering_api); char window_title[96] =
"Super Mario 64 PC port (" RAPI_NAME ")"
#ifdef NIGHTLY
" nightly " GIT_HASH
#endif
;
gfx_init(wm_api, rendering_api, window_title);
wm_api->set_keyboard_callbacks(keyboard_on_key_down, keyboard_on_key_up, keyboard_on_all_keys_up); wm_api->set_keyboard_callbacks(keyboard_on_key_down, keyboard_on_key_up, keyboard_on_all_keys_up);
if (audio_api == NULL && audio_sdl.init()) if (audio_api == NULL && audio_sdl.init())