properly destroying windows and fonts

This commit is contained in:
martinfouilleul 2023-02-10 12:05:52 +01:00
parent 08d3521b61
commit f54f639db5
4 changed files with 6 additions and 6 deletions

View File

@ -22,9 +22,7 @@ mg_font create_font()
{
//NOTE(martin): create font
str8 fontPath = mp_app_get_resource_path(mem_scratch(), "../resources/OpenSansLatinSubset.ttf");
// char* fontPathCString = str8_to_cstring(mem_scratch(), fontPath);
char* fontPathCString = "resources/OpenSansLatinSubset.ttf";
char* fontPathCString = str8_to_cstring(mem_scratch(), fontPath);
FILE* fontFile = fopen(fontPathCString, "r");
if(!fontFile)
@ -238,8 +236,11 @@ int main()
frameTime = mp_get_time(MP_CLOCK_MONOTONIC) - startTime;
}
mg_font_destroy(font);
mg_canvas_destroy(canvas);
mg_surface_destroy(surface);
mp_window_destroy(window);
mp_terminate();
return(0);

View File

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

View File

@ -2306,7 +2306,6 @@ void mg_font_destroy(mg_font fontHandle)
free(fontData->glyphMap);
free(fontData->glyphs);
free(fontData->outlines);
free(fontData);
mg_resource_handle_recycle(&__mgData.fonts, fontHandle.h);
}

View File

@ -32,7 +32,7 @@ Clean+Fixes
[x] Destroy canvas backend properly
[x] Destroy surface properly
[ ] Destroy window properly
[x] Destroy window properly
[>] Make surface backend and canvas backend compile-time and run-time selections easier