[graphics, win32] applying changes to surface backend API

This commit is contained in:
martinfouilleul 2023-03-01 17:41:39 +01:00
parent 43d413dbbc
commit 1dfc5dd684
3 changed files with 79 additions and 81 deletions

View File

@ -2,7 +2,7 @@
*
* file: glsl_shaders.h
* note: string literals auto-generated by embed_text.py
* date: 27/022023
* date: 01/032023
*
**********************************************************************/
#ifndef __GLSL_SHADERS_H__

View File

@ -192,7 +192,7 @@ bool mg_wgl_surface_get_hidden(mg_surface_data* interface)
void* mg_wgl_surface_native_layer(mg_surface_data* interface)
{
mg_wgl_surface* surface = (mg_wgl_surface*)interface;
return(mg_layer_native_surface(&surface->layer));
return(mp_layer_native_surface(&surface->layer));
}
void* mg_wgl_get_proc(const char* name)
@ -211,9 +211,9 @@ void* mg_wgl_get_proc(const char* name)
return(p);
}
mg_surface mg_wgl_surface_create_for_window(mp_window window)
mg_surface_data* mg_wgl_surface_create_for_window(mp_window window)
{
mg_surface surfaceHandle = mg_surface_nil();
mg_surface* surface = 0;
mp_window_data* windowData = mp_window_ptr_from_handle(window);
if(windowData)
@ -222,7 +222,8 @@ mg_surface mg_wgl_surface_create_for_window(mp_window window)
//NOTE: fill surface data and load api
mg_wgl_surface* surface = malloc_type(mg_wgl_surface);
if(surface)
{
surface->interface.backend = MG_BACKEND_GL;
surface->interface.destroy = mg_wgl_surface_destroy;
surface->interface.prepare = mg_wgl_surface_prepare;
@ -298,10 +299,7 @@ mg_surface mg_wgl_surface_create_for_window(mp_window window)
wglMakeCurrent(surface->hDC, surface->glContext);
wglSwapIntervalEXT(1);
mg_gl_load_gl43(&surface->api, mg_wgl_get_proc);
surfaceHandle = mg_surface_alloc_handle((mg_surface_data*)surface);
}
quit:;
return(surfaceHandle);
}
return((mg_surface_data*)surface);
}

View File

@ -9,8 +9,8 @@
#ifndef __WGL_SURFACE_H_
#define __WGL_SURFACE_H_
#include"graphics.h"
#include"graphics_internal.h"
mg_surface mg_wgl_surface_create_for_window(mp_window window);
mg_surface_data* mg_wgl_surface_create_for_window(mp_window window);
#endif // __WIN32_GL_SURFACE_H_