[win32 build/link]
- Build milepost as a dynamic library - Add import/export directives to public API symbols - Change example build scripts accordingly
This commit is contained in:
parent
dc2961f513
commit
665c63c3d0
|
@ -6,5 +6,6 @@ set glsl_shaders=src\glsl_shaders\common.glsl src\glsl_shaders\blit_vertex.glsl
|
|||
call python3 scripts\embed_text.py %glsl_shaders% --prefix=glsl_ --output src\glsl_shaders.h
|
||||
|
||||
set INCLUDES=/I src /I src/util /I src/platform /I ext /I ext/angle_headers
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 %INCLUDES% /c /Fo:bin/milepost.obj src/milepost.c
|
||||
lib bin/milepost.obj /OUT:bin/milepost.lib
|
||||
set LIBS=user32.lib opengl32.lib gdi32.lib shcore.lib /LIBPATH:./bin libEGL.dll.lib libGLESv2.dll.lib
|
||||
|
||||
cl /we4013 /Zi /Zc:preprocessor /DMP_BUILD_DLL /std:c11 %INCLUDES% src/milepost.c /Fo:bin/milepost.o /LD /link %LIBS% /OUT:bin/milepost.dll /IMPLIB:bin/milepost.dll.lib
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
set INCLUDES=/I ..\..\src /I ..\..\src\util /I ..\..\src\platform /I ../../ext /I ../../ext/angle_headers
|
||||
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 %INCLUDES% main.c /link /LIBPATH:../../bin milepost.lib user32.lib opengl32.lib gdi32.lib shcore.lib /out:../../bin/example_canvas.exe
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 %INCLUDES% main.c /link /LIBPATH:../../bin milepost.dll.lib /out:../../bin/example_canvas.exe
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
set INCLUDES=/I ..\..\src /I ..\..\src\util /I ..\..\src\platform /I ../../ext
|
||||
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 %INCLUDES% main.c /link /LIBPATH:../../bin milepost.lib user32.lib opengl32.lib gdi32.lib shcore.lib /out:../../bin/perf_text.exe
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 %INCLUDES% main.c /link /LIBPATH:../../bin milepost.dll.lib /out:../../bin/perf_text.exe
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
set INCLUDES=/I ..\..\src /I ..\..\src\util /I ..\..\src\platform /I ../../ext
|
||||
|
||||
cl /we4013 /Zi /Zc:preprocessor /DMG_IMPLEMENTS_BACKEND_GL /std:c11 %INCLUDES% main.c /link /LIBPATH:../../bin milepost.lib user32.lib opengl32.lib gdi32.lib shcore.lib /LIBPATH:../../bin libEGL.dll.lib libGLESv2.dll.lib /out:../../bin/example_gl_triangle.exe
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 %INCLUDES% main.c /link /LIBPATH:../../bin milepost.dll.lib /out:../../bin/example_gl_triangle.exe
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
set INCLUDES=/I ..\..\src /I ..\..\src\util /I ..\..\src\platform /I ../../ext /I ../../ext/angle_headers
|
||||
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 %INCLUDES% main.c /link /LIBPATH:../../bin milepost.lib /LIBPATH:../../bin libEGL.dll.lib libGLESv2.dll.lib user32.lib opengl32.lib gdi32.lib shcore.lib /out:../../bin/example_gles_triangle.exe
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 %INCLUDES% main.c /link /LIBPATH:../../bin milepost.dll.lib /out:../../bin/example_gles_triangle.exe
|
||||
|
|
|
@ -96,12 +96,13 @@ for func in glall:
|
|||
f.write('\t' + 'PFN' + func.upper() + 'PROC ' + remove_prefix(func, 'gl') + ';\n')
|
||||
|
||||
f.write('} mg_gl_api;\n\n')
|
||||
f.write('extern mp_thread_local mg_gl_api* __mgGLAPI;\n\n');
|
||||
|
||||
# generate interface macros
|
||||
# TODO guard for different api/versions and only #define functions present in desired version
|
||||
f.write("MP_API mg_gl_api* mg_gl_get_api(void);\n\n")
|
||||
|
||||
for func in glall:
|
||||
f.write('#define ' + func + ' __mgGLAPI->' + remove_prefix(func, 'gl') + '\n')
|
||||
f.write('#define ' + func + ' mg_gl_get_api()->' + remove_prefix(func, 'gl') + '\n')
|
||||
|
||||
emit_end_guard(f, apiName)
|
||||
f.close()
|
||||
|
@ -124,8 +125,8 @@ f.write("void mg_gl_load_gl43(mg_gl_api* api, mg_gl_load_proc loadProc);\n")
|
|||
f.write("void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc);\n")
|
||||
f.write("void mg_gl_load_gles32(mg_gl_api* api, mg_gl_load_proc loadProc);\n\n")
|
||||
|
||||
f.write("void mg_gl_select_api(mg_gl_api* api);\n")
|
||||
f.write("mg_gl_api* mg_gl_get_api(void);\n\n")
|
||||
f.write("void mg_gl_select_api(mg_gl_api* api);\n\n")
|
||||
|
||||
|
||||
emit_end_guard(f, loaderName)
|
||||
f.close()
|
||||
|
|
2142
src/gl_api.h
2142
src/gl_api.h
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* @file: gl_loader.c
|
||||
* @note: auto-generated by glapi.py from gl.xml
|
||||
* @date: 20/022023
|
||||
* @date: 21/022023
|
||||
*
|
||||
*********************************************************/
|
||||
#include"gl_loader.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* @file: gl_loader.h
|
||||
* @note: auto-generated by glapi.py from gl.xml
|
||||
* @date: 20/022023
|
||||
* @date: 21/022023
|
||||
*
|
||||
*********************************************************/
|
||||
#ifndef __GL_LOADER_H__
|
||||
|
@ -18,6 +18,5 @@ void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc);
|
|||
void mg_gl_load_gles32(mg_gl_api* api, mg_gl_load_proc loadProc);
|
||||
|
||||
void mg_gl_select_api(mg_gl_api* api);
|
||||
mg_gl_api* mg_gl_get_api(void);
|
||||
|
||||
#endif // __GL_LOADER_H__
|
||||
|
|
174
src/graphics.h
174
src/graphics.h
|
@ -79,27 +79,27 @@ typedef enum {
|
|||
|
||||
//TODO: add MG_INCLUDE_OPENGL/GLES/etc, once we know how we make different gl versions co-exist
|
||||
|
||||
bool mg_is_surface_backend_available(mg_backend_id id);
|
||||
bool mg_is_canvas_backend_available(mg_backend_id id);
|
||||
MP_API bool mg_is_surface_backend_available(mg_backend_id id);
|
||||
MP_API bool mg_is_canvas_backend_available(mg_backend_id id);
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): graphics surface
|
||||
//------------------------------------------------------------------------------------------
|
||||
typedef struct mg_surface { u64 h; } mg_surface;
|
||||
|
||||
mg_surface mg_surface_nil();
|
||||
bool mg_surface_is_nil(mg_surface surface);
|
||||
MP_API mg_surface mg_surface_nil();
|
||||
MP_API bool mg_surface_is_nil(mg_surface surface);
|
||||
|
||||
mg_surface mg_surface_create_for_window(mp_window window, mg_backend_id backend);
|
||||
void mg_surface_destroy(mg_surface surface);
|
||||
void mg_surface_prepare(mg_surface surface);
|
||||
void mg_surface_present(mg_surface surface);
|
||||
void mg_surface_swap_interval(mg_surface surface, int swap);
|
||||
vec2 mg_surface_contents_scaling(mg_surface surface);
|
||||
mp_rect mg_surface_get_frame(mg_surface surface);
|
||||
void mg_surface_set_frame(mg_surface surface, mp_rect frame);
|
||||
bool mg_surface_get_hidden(mg_surface surface);
|
||||
void mg_surface_set_hidden(mg_surface surface, bool hidden);
|
||||
MP_API mg_surface mg_surface_create_for_window(mp_window window, mg_backend_id backend);
|
||||
MP_API void mg_surface_destroy(mg_surface surface);
|
||||
MP_API void mg_surface_prepare(mg_surface surface);
|
||||
MP_API void mg_surface_present(mg_surface surface);
|
||||
MP_API void mg_surface_swap_interval(mg_surface surface, int swap);
|
||||
MP_API vec2 mg_surface_contents_scaling(mg_surface surface);
|
||||
MP_API mp_rect mg_surface_get_frame(mg_surface surface);
|
||||
MP_API void mg_surface_set_frame(mg_surface surface, mp_rect frame);
|
||||
MP_API bool mg_surface_get_hidden(mg_surface surface);
|
||||
MP_API void mg_surface_set_hidden(mg_surface surface, bool hidden);
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
|
@ -161,128 +161,128 @@ typedef struct mg_text_extents
|
|||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): graphics canvas
|
||||
//------------------------------------------------------------------------------------------
|
||||
mg_canvas mg_canvas_nil();
|
||||
bool mg_canvas_is_nil(mg_canvas canvas);
|
||||
MP_API mg_canvas mg_canvas_nil();
|
||||
MP_API bool mg_canvas_is_nil(mg_canvas canvas);
|
||||
|
||||
mg_canvas mg_canvas_create(mg_surface surface);
|
||||
void mg_canvas_destroy(mg_canvas canvas);
|
||||
mg_canvas mg_canvas_set_current(mg_canvas canvas);
|
||||
MP_API mg_canvas mg_canvas_create(mg_surface surface);
|
||||
MP_API void mg_canvas_destroy(mg_canvas canvas);
|
||||
MP_API mg_canvas mg_canvas_set_current(mg_canvas canvas);
|
||||
|
||||
void mg_flush();
|
||||
MP_API void mg_flush();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): transform, viewport and clipping
|
||||
//------------------------------------------------------------------------------------------
|
||||
void mg_viewport(mp_rect viewPort);
|
||||
MP_API void mg_viewport(mp_rect viewPort);
|
||||
|
||||
void mg_matrix_push(mg_mat2x3 matrix);
|
||||
void mg_matrix_pop();
|
||||
MP_API void mg_matrix_push(mg_mat2x3 matrix);
|
||||
MP_API void mg_matrix_pop();
|
||||
|
||||
void mg_clip_push(f32 x, f32 y, f32 w, f32 h);
|
||||
void mg_clip_pop();
|
||||
MP_API void mg_clip_push(f32 x, f32 y, f32 w, f32 h);
|
||||
MP_API void mg_clip_pop();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): graphics attributes setting/getting
|
||||
//------------------------------------------------------------------------------------------
|
||||
void mg_set_color(mg_color color);
|
||||
void mg_set_color_rgba(f32 r, f32 g, f32 b, f32 a);
|
||||
void mg_set_width(f32 width);
|
||||
void mg_set_tolerance(f32 tolerance);
|
||||
void mg_set_joint(mg_joint_type joint);
|
||||
void mg_set_max_joint_excursion(f32 maxJointExcursion);
|
||||
void mg_set_cap(mg_cap_type cap);
|
||||
void mg_set_font(mg_font font);
|
||||
void mg_set_font_size(f32 size);
|
||||
void mg_set_text_flip(bool flip);
|
||||
MP_API void mg_set_color(mg_color color);
|
||||
MP_API void mg_set_color_rgba(f32 r, f32 g, f32 b, f32 a);
|
||||
MP_API void mg_set_width(f32 width);
|
||||
MP_API void mg_set_tolerance(f32 tolerance);
|
||||
MP_API void mg_set_joint(mg_joint_type joint);
|
||||
MP_API void mg_set_max_joint_excursion(f32 maxJointExcursion);
|
||||
MP_API void mg_set_cap(mg_cap_type cap);
|
||||
MP_API void mg_set_font(mg_font font);
|
||||
MP_API void mg_set_font_size(f32 size);
|
||||
MP_API void mg_set_text_flip(bool flip);
|
||||
|
||||
mg_color mg_get_color();
|
||||
f32 mg_get_width();
|
||||
f32 mg_get_tolerance();
|
||||
mg_joint_type mg_get_joint();
|
||||
f32 mg_get_max_joint_excursion();
|
||||
mg_cap_type mg_get_cap();
|
||||
mg_font mg_get_font();
|
||||
f32 mg_get_font_size();
|
||||
bool mg_get_text_flip();
|
||||
MP_API mg_color mg_get_color();
|
||||
MP_API f32 mg_get_width();
|
||||
MP_API f32 mg_get_tolerance();
|
||||
MP_API mg_joint_type mg_get_joint();
|
||||
MP_API f32 mg_get_max_joint_excursion();
|
||||
MP_API mg_cap_type mg_get_cap();
|
||||
MP_API mg_font mg_get_font();
|
||||
MP_API f32 mg_get_font_size();
|
||||
MP_API bool mg_get_text_flip();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): path construction
|
||||
//------------------------------------------------------------------------------------------
|
||||
vec2 mg_get_position();
|
||||
void mg_move_to(f32 x, f32 y);
|
||||
void mg_line_to(f32 x, f32 y);
|
||||
void mg_quadratic_to(f32 x1, f32 y1, f32 x2, f32 y2);
|
||||
void mg_cubic_to(f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3);
|
||||
void mg_close_path();
|
||||
MP_API vec2 mg_get_position();
|
||||
MP_API void mg_move_to(f32 x, f32 y);
|
||||
MP_API void mg_line_to(f32 x, f32 y);
|
||||
MP_API void mg_quadratic_to(f32 x1, f32 y1, f32 x2, f32 y2);
|
||||
MP_API void mg_cubic_to(f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3);
|
||||
MP_API void mg_close_path();
|
||||
|
||||
mp_rect mg_glyph_outlines(str32 glyphIndices);
|
||||
void mg_codepoints_outlines(str32 string);
|
||||
void mg_text_outlines(str8 string);
|
||||
MP_API mp_rect mg_glyph_outlines(str32 glyphIndices);
|
||||
MP_API void mg_codepoints_outlines(str32 string);
|
||||
MP_API void mg_text_outlines(str8 string);
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): clear/fill/stroke
|
||||
//------------------------------------------------------------------------------------------
|
||||
void mg_clear();
|
||||
void mg_fill();
|
||||
void mg_stroke();
|
||||
MP_API void mg_clear();
|
||||
MP_API void mg_fill();
|
||||
MP_API void mg_stroke();
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): 'fast' shapes primitives
|
||||
//------------------------------------------------------------------------------------------
|
||||
void mg_rectangle_fill(f32 x, f32 y, f32 w, f32 h);
|
||||
void mg_rectangle_stroke(f32 x, f32 y, f32 w, f32 h);
|
||||
void mg_rounded_rectangle_fill(f32 x, f32 y, f32 w, f32 h, f32 r);
|
||||
void mg_rounded_rectangle_stroke(f32 x, f32 y, f32 w, f32 h, f32 r);
|
||||
void mg_ellipse_fill(f32 x, f32 y, f32 rx, f32 ry);
|
||||
void mg_ellipse_stroke(f32 x, f32 y, f32 rx, f32 ry);
|
||||
void mg_circle_fill(f32 x, f32 y, f32 r);
|
||||
void mg_circle_stroke(f32 x, f32 y, f32 r);
|
||||
void mg_arc(f32 x, f32 y, f32 r, f32 arcAngle, f32 startAngle);
|
||||
MP_API void mg_rectangle_fill(f32 x, f32 y, f32 w, f32 h);
|
||||
MP_API void mg_rectangle_stroke(f32 x, f32 y, f32 w, f32 h);
|
||||
MP_API void mg_rounded_rectangle_fill(f32 x, f32 y, f32 w, f32 h, f32 r);
|
||||
MP_API void mg_rounded_rectangle_stroke(f32 x, f32 y, f32 w, f32 h, f32 r);
|
||||
MP_API void mg_ellipse_fill(f32 x, f32 y, f32 rx, f32 ry);
|
||||
MP_API void mg_ellipse_stroke(f32 x, f32 y, f32 rx, f32 ry);
|
||||
MP_API void mg_circle_fill(f32 x, f32 y, f32 r);
|
||||
MP_API void mg_circle_stroke(f32 x, f32 y, f32 r);
|
||||
MP_API void mg_arc(f32 x, f32 y, f32 r, f32 arcAngle, f32 startAngle);
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): fonts
|
||||
//------------------------------------------------------------------------------------------
|
||||
mg_font mg_font_nil();
|
||||
mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unicode_range* ranges);
|
||||
void mg_font_destroy(mg_font font);
|
||||
MP_API mg_font mg_font_nil();
|
||||
MP_API mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unicode_range* ranges);
|
||||
MP_API void mg_font_destroy(mg_font font);
|
||||
|
||||
//NOTE(martin): the following int valued functions return -1 if font is invalid or codepoint is not present in font//
|
||||
//TODO(martin): add enum error codes
|
||||
|
||||
mg_font_extents mg_font_get_extents(mg_font font);
|
||||
mg_font_extents mg_font_get_scaled_extents(mg_font font, f32 emSize);
|
||||
f32 mg_font_get_scale_for_em_pixels(mg_font font, f32 emSize);
|
||||
MP_API mg_font_extents mg_font_get_extents(mg_font font);
|
||||
MP_API mg_font_extents mg_font_get_scaled_extents(mg_font font, f32 emSize);
|
||||
MP_API f32 mg_font_get_scale_for_em_pixels(mg_font font, f32 emSize);
|
||||
|
||||
//NOTE(martin): if you need to process more than one codepoint, first convert your codepoints to glyph indices, then use the
|
||||
// glyph index versions of the functions, which can take an array of glyph indices.
|
||||
|
||||
str32 mg_font_get_glyph_indices(mg_font font, str32 codePoints, str32 backing);
|
||||
str32 mg_font_push_glyph_indices(mg_font font, mem_arena* arena, str32 codePoints);
|
||||
u32 mg_font_get_glyph_index(mg_font font, utf32 codePoint);
|
||||
MP_API str32 mg_font_get_glyph_indices(mg_font font, str32 codePoints, str32 backing);
|
||||
MP_API str32 mg_font_push_glyph_indices(mg_font font, mem_arena* arena, str32 codePoints);
|
||||
MP_API u32 mg_font_get_glyph_index(mg_font font, utf32 codePoint);
|
||||
|
||||
int mg_font_get_codepoint_extents(mg_font font, utf32 codePoint, mg_text_extents* outExtents);
|
||||
MP_API int mg_font_get_codepoint_extents(mg_font font, utf32 codePoint, mg_text_extents* outExtents);
|
||||
|
||||
int mg_font_get_glyph_extents(mg_font font, str32 glyphIndices, mg_text_extents* outExtents);
|
||||
MP_API int mg_font_get_glyph_extents(mg_font font, str32 glyphIndices, mg_text_extents* outExtents);
|
||||
|
||||
mp_rect mg_text_bounding_box_utf32(mg_font font, f32 fontSize, str32 text);
|
||||
mp_rect mg_text_bounding_box(mg_font font, f32 fontSize, str8 text);
|
||||
MP_API mp_rect mg_text_bounding_box_utf32(mg_font font, f32 fontSize, str32 text);
|
||||
MP_API mp_rect mg_text_bounding_box(mg_font font, f32 fontSize, str8 text);
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
//NOTE(martin): images
|
||||
//------------------------------------------------------------------------------------------
|
||||
typedef struct mg_image { u64 h; } mg_image;
|
||||
|
||||
mg_image mg_image_nil();
|
||||
bool mg_image_equal(mg_image a, mg_image b);
|
||||
MP_API mg_image mg_image_nil();
|
||||
MP_API bool mg_image_equal(mg_image a, mg_image b);
|
||||
|
||||
mg_image mg_image_create_from_rgba8(u32 width, u32 height, u8* pixels);
|
||||
mg_image mg_image_create_from_data(str8 data, bool flip);
|
||||
mg_image mg_image_create_from_file(str8 path, bool flip);
|
||||
MP_API mg_image mg_image_create_from_rgba8(u32 width, u32 height, u8* pixels);
|
||||
MP_API mg_image mg_image_create_from_data(str8 data, bool flip);
|
||||
MP_API mg_image mg_image_create_from_file(str8 path, bool flip);
|
||||
|
||||
void mg_image_drestroy(mg_image image);
|
||||
MP_API void mg_image_drestroy(mg_image image);
|
||||
|
||||
vec2 mg_image_size(mg_image image);
|
||||
void mg_image_draw(mg_image image, mp_rect rect);
|
||||
void mg_rounded_image_draw(mg_image image, mp_rect rect, f32 roundness);
|
||||
MP_API vec2 mg_image_size(mg_image image);
|
||||
MP_API void mg_image_draw(mg_image image, mp_rect rect);
|
||||
MP_API void mg_rounded_image_draw(mg_image image, mp_rect rect, f32 roundness);
|
||||
|
||||
#endif //__GRAPHICS_H_
|
||||
|
|
136
src/mp_app.h
136
src/mp_app.h
|
@ -258,122 +258,122 @@ typedef struct mp_event
|
|||
// app management
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
void mp_init();
|
||||
void mp_terminate();
|
||||
MP_API void mp_init(void);
|
||||
MP_API void mp_terminate(void);
|
||||
|
||||
bool mp_should_quit();
|
||||
void mp_cancel_quit();
|
||||
void mp_request_quit();
|
||||
MP_API bool mp_should_quit(void);
|
||||
MP_API void mp_cancel_quit(void);
|
||||
MP_API void mp_request_quit(void);
|
||||
|
||||
void mp_set_cursor(mp_mouse_cursor cursor);
|
||||
MP_API void mp_set_cursor(mp_mouse_cursor cursor);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Main loop and events handling
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
void mp_pump_events(f64 timeout);
|
||||
bool mp_next_event(mp_event* event);
|
||||
MP_API void mp_pump_events(f64 timeout);
|
||||
MP_API bool mp_next_event(mp_event* event);
|
||||
|
||||
typedef void(*mp_live_resize_callback)(mp_event event, void* data);
|
||||
void mp_set_live_resize_callback(mp_live_resize_callback callback, void* data);
|
||||
MP_API void mp_set_live_resize_callback(mp_live_resize_callback callback, void* data);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// window management
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
bool mp_window_handle_is_null(mp_window window);
|
||||
mp_window mp_window_null_handle();
|
||||
MP_API bool mp_window_handle_is_null(mp_window window);
|
||||
MP_API mp_window mp_window_null_handle(void);
|
||||
|
||||
mp_window mp_window_create(mp_rect contentRect, const char* title, mp_window_style style);
|
||||
void mp_window_destroy(mp_window window);
|
||||
void* mp_window_native_pointer(mp_window window);
|
||||
MP_API mp_window mp_window_create(mp_rect contentRect, const char* title, mp_window_style style);
|
||||
MP_API void mp_window_destroy(mp_window window);
|
||||
MP_API void* mp_window_native_pointer(mp_window window);
|
||||
|
||||
bool mp_window_should_close(mp_window window);
|
||||
void mp_window_request_close(mp_window window);
|
||||
void mp_window_cancel_close(mp_window window);
|
||||
MP_API bool mp_window_should_close(mp_window window);
|
||||
MP_API void mp_window_request_close(mp_window window);
|
||||
MP_API void mp_window_cancel_close(mp_window window);
|
||||
|
||||
bool mp_window_is_hidden(mp_window window);
|
||||
void mp_window_hide(mp_window window);
|
||||
void mp_window_show(mp_window window);
|
||||
MP_API bool mp_window_is_hidden(mp_window window);
|
||||
MP_API void mp_window_hide(mp_window window);
|
||||
MP_API void mp_window_show(mp_window window);
|
||||
|
||||
bool mp_window_is_minimized(mp_window window);
|
||||
bool mp_window_is_maximized(mp_window window);
|
||||
void mp_window_minimize(mp_window window);
|
||||
void mp_window_maximize(mp_window window);
|
||||
void mp_window_restore(mp_window window);
|
||||
MP_API bool mp_window_is_minimized(mp_window window);
|
||||
MP_API bool mp_window_is_maximized(mp_window window);
|
||||
MP_API void mp_window_minimize(mp_window window);
|
||||
MP_API void mp_window_maximize(mp_window window);
|
||||
MP_API void mp_window_restore(mp_window window);
|
||||
|
||||
bool mp_window_has_focus(mp_window window);
|
||||
void mp_window_focus(mp_window window);
|
||||
void mp_window_unfocus(mp_window window);
|
||||
MP_API bool mp_window_has_focus(mp_window window);
|
||||
MP_API void mp_window_focus(mp_window window);
|
||||
MP_API void mp_window_unfocus(mp_window window);
|
||||
|
||||
void mp_window_send_to_back(mp_window window);
|
||||
void mp_window_bring_to_front(mp_window window);
|
||||
MP_API void mp_window_send_to_back(mp_window window);
|
||||
MP_API void mp_window_bring_to_front(mp_window window);
|
||||
|
||||
mp_rect mp_window_get_content_rect(mp_window window);
|
||||
mp_rect mp_window_get_frame_rect(mp_window window);
|
||||
void mp_window_set_content_rect(mp_window window, mp_rect contentRect);
|
||||
void mp_window_set_frame_rect(mp_window window, mp_rect frameRect);
|
||||
MP_API mp_rect mp_window_get_content_rect(mp_window window);
|
||||
MP_API mp_rect mp_window_get_frame_rect(mp_window window);
|
||||
MP_API void mp_window_set_content_rect(mp_window window, mp_rect contentRect);
|
||||
MP_API void mp_window_set_frame_rect(mp_window window, mp_rect frameRect);
|
||||
|
||||
void mp_window_center(mp_window window);
|
||||
MP_API void mp_window_center(mp_window window);
|
||||
|
||||
mp_rect mp_window_content_rect_for_frame_rect(mp_rect frameRect, mp_window_style style);
|
||||
mp_rect mp_window_frame_rect_for_content_rect(mp_rect contentRect, mp_window_style style);
|
||||
MP_API mp_rect mp_window_content_rect_for_frame_rect(mp_rect frameRect, mp_window_style style);
|
||||
MP_API mp_rect mp_window_frame_rect_for_content_rect(mp_rect contentRect, mp_window_style style);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Input state polling
|
||||
//--------------------------------------------------------------------
|
||||
bool mp_input_key_down(mp_key_code key);
|
||||
bool mp_input_key_pressed(mp_key_code key);
|
||||
bool mp_input_key_released(mp_key_code key);
|
||||
mp_key_mods mp_input_key_mods();
|
||||
MP_API bool mp_input_key_down(mp_key_code key);
|
||||
MP_API bool mp_input_key_pressed(mp_key_code key);
|
||||
MP_API bool mp_input_key_released(mp_key_code key);
|
||||
MP_API mp_key_mods mp_input_key_mods(void);
|
||||
|
||||
str8 mp_key_to_label(mp_key_code key);
|
||||
mp_key_code mp_label_to_key(str8 label);
|
||||
MP_API str8 mp_key_to_label(mp_key_code key);
|
||||
MP_API mp_key_code mp_label_to_key(str8 label);
|
||||
|
||||
bool mp_input_mouse_down(mp_mouse_button button);
|
||||
bool mp_input_mouse_pressed(mp_mouse_button button);
|
||||
bool mp_input_mouse_released(mp_mouse_button button);
|
||||
bool mp_input_mouse_clicked(mp_mouse_button button);
|
||||
bool mp_input_mouse_double_clicked(mp_mouse_button button);
|
||||
MP_API bool mp_input_mouse_down(mp_mouse_button button);
|
||||
MP_API bool mp_input_mouse_pressed(mp_mouse_button button);
|
||||
MP_API bool mp_input_mouse_released(mp_mouse_button button);
|
||||
MP_API bool mp_input_mouse_clicked(mp_mouse_button button);
|
||||
MP_API bool mp_input_mouse_double_clicked(mp_mouse_button button);
|
||||
|
||||
vec2 mp_input_mouse_position();
|
||||
vec2 mp_input_mouse_delta();
|
||||
vec2 mp_input_mouse_wheel();
|
||||
MP_API vec2 mp_input_mouse_position(void);
|
||||
MP_API vec2 mp_input_mouse_delta(void);
|
||||
MP_API vec2 mp_input_mouse_wheel(void);
|
||||
|
||||
str32 mp_input_text_utf32(mem_arena* arena);
|
||||
str8 mp_input_text_utf8(mem_arena* arena);
|
||||
MP_API str32 mp_input_text_utf32(mem_arena* arena);
|
||||
MP_API str8 mp_input_text_utf8(mem_arena* arena);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Clipboard
|
||||
//--------------------------------------------------------------------
|
||||
void mp_clipboard_clear();
|
||||
MP_API void mp_clipboard_clear(void);
|
||||
|
||||
void mp_clipboard_set_string(str8 string);
|
||||
str8 mp_clipboard_get_string(mem_arena* arena);
|
||||
str8 mp_clipboard_copy_string(str8 backing);
|
||||
MP_API void mp_clipboard_set_string(str8 string);
|
||||
MP_API str8 mp_clipboard_get_string(mem_arena* arena);
|
||||
MP_API str8 mp_clipboard_copy_string(str8 backing);
|
||||
|
||||
bool mp_clipboard_has_tag(const char* tag);
|
||||
void mp_clipboard_set_data_for_tag(const char* tag, str8 data);
|
||||
str8 mp_clipboard_get_data_for_tag(mem_arena* arena, const char* tag);
|
||||
MP_API bool mp_clipboard_has_tag(const char* tag);
|
||||
MP_API void mp_clipboard_set_data_for_tag(const char* tag, str8 data);
|
||||
MP_API str8 mp_clipboard_get_data_for_tag(mem_arena* arena, const char* tag);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// native open/save/alert windows
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
str8 mp_open_dialog(mem_arena* arena,
|
||||
MP_API str8 mp_open_dialog(mem_arena* arena,
|
||||
const char* title,
|
||||
const char* defaultPath,
|
||||
int filterCount,
|
||||
const char** filters,
|
||||
bool directory);
|
||||
|
||||
str8 mp_save_dialog(mem_arena* arena,
|
||||
MP_API str8 mp_save_dialog(mem_arena* arena,
|
||||
const char* title,
|
||||
const char* defaultPath,
|
||||
int filterCount,
|
||||
const char** filters);
|
||||
|
||||
int mp_alert_popup(const char* title,
|
||||
MP_API int mp_alert_popup(const char* title,
|
||||
const char* message,
|
||||
u32 count,
|
||||
const char** options);
|
||||
|
@ -382,13 +382,13 @@ int mp_alert_popup(const char* title,
|
|||
//--------------------------------------------------------------------
|
||||
// file system stuff... //TODO: move elsewhere
|
||||
//--------------------------------------------------------------------
|
||||
int mp_file_move(str8 from, str8 to);
|
||||
int mp_file_remove(str8 path);
|
||||
MP_API int mp_file_move(str8 from, str8 to);
|
||||
MP_API int mp_file_remove(str8 path);
|
||||
|
||||
int mp_directory_create(str8 path);
|
||||
MP_API int mp_directory_create(str8 path);
|
||||
|
||||
str8 mp_app_get_resource_path(mem_arena* arena, const char* name);
|
||||
str8 mp_app_get_executable_path(mem_arena* arena);
|
||||
MP_API str8 mp_app_get_resource_path(mem_arena* arena, const char* name);
|
||||
MP_API str8 mp_app_get_executable_path(mem_arena* arena);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -77,8 +77,16 @@
|
|||
// platform helper macros
|
||||
//-----------------------------------------------------------------
|
||||
#if defined(COMPILER_CL)
|
||||
#if defined(MP_BUILD_DLL)
|
||||
#define MP_API __declspec(dllexport)
|
||||
#else
|
||||
#define MP_API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define mp_thread_local __declspec(thread)
|
||||
|
||||
#elif defined(COMPILER_GCC) || defined(COMPILER_CLANG)
|
||||
#define MP_API
|
||||
#define mp_thread_local __thread
|
||||
#endif
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ typedef enum {
|
|||
MP_CLOCK_DATE // clock that is driven by the platform time
|
||||
} mp_clock_kind;
|
||||
|
||||
void mp_clock_init(); // initialize the clock subsystem
|
||||
u64 mp_get_timestamp(mp_clock_kind clock);
|
||||
f64 mp_get_time(mp_clock_kind clock);
|
||||
void mp_sleep_nanoseconds(u64 nanoseconds); // sleep for a given number of nanoseconds
|
||||
MP_API void mp_clock_init(); // initialize the clock subsystem
|
||||
MP_API u64 mp_get_timestamp(mp_clock_kind clock);
|
||||
MP_API f64 mp_get_time(mp_clock_kind clock);
|
||||
MP_API void mp_sleep_nanoseconds(u64 nanoseconds); // sleep for a given number of nanoseconds
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#define __DEBUG_LOG_H_
|
||||
|
||||
#include<stdio.h>
|
||||
#include"platform.h"
|
||||
#include"typedefs.h"
|
||||
#include"macro_helpers.h"
|
||||
|
||||
|
@ -36,17 +37,17 @@ typedef enum { LOG_LEVEL_ERROR,
|
|||
LOG_LEVEL_DEBUG,
|
||||
LOG_LEVEL_COUNT } log_level;
|
||||
|
||||
void LogGeneric(log_level level,
|
||||
const char* subsystem,
|
||||
const char* functionName,
|
||||
const char* fileName,
|
||||
u32 line,
|
||||
const char* msg,
|
||||
...);
|
||||
MP_API void LogGeneric(log_level level,
|
||||
const char* subsystem,
|
||||
const char* functionName,
|
||||
const char* fileName,
|
||||
u32 line,
|
||||
const char* msg,
|
||||
...);
|
||||
|
||||
void LogOutput(FILE* output);
|
||||
void LogLevel(log_level level);
|
||||
void LogFilter(const char* subsystem, log_level level);
|
||||
MP_API void LogOutput(FILE* output);
|
||||
MP_API void LogLevel(log_level level);
|
||||
MP_API void LogFilter(const char* subsystem, log_level level);
|
||||
|
||||
#define LOG_GENERIC(level, func, file, line, msg, ...) LogGeneric(level, LOG_SUBSYSTEM, func, file, line, msg, ##__VA_ARGS__ )
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
u64 mp_hash_aes_u64(u64 x);
|
||||
u64 mp_hash_aes_u64_x2(u64 x, u64 y);
|
||||
u64 mp_hash_aes_string(str8 string);
|
||||
u64 mp_hash_aes_string_seed(str8 string, u64 seed);
|
||||
MP_API u64 mp_hash_aes_u64(u64 x);
|
||||
MP_API u64 mp_hash_aes_u64_x2(u64 x, u64 y);
|
||||
MP_API u64 mp_hash_aes_string(str8 string);
|
||||
MP_API u64 mp_hash_aes_string_seed(str8 string, u64 seed);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef struct mem_base_allocator
|
|||
|
||||
} mem_base_allocator;
|
||||
|
||||
mem_base_allocator* mem_base_allocator_default();
|
||||
MP_API mem_base_allocator* mem_base_allocator_default();
|
||||
|
||||
#define mem_base_reserve(base, size) base->reserve(base->context, size)
|
||||
#define mem_base_commit(base, ptr, size) base->commit(base->context, ptr, size)
|
||||
|
@ -57,12 +57,12 @@ typedef struct mem_arena_options
|
|||
u64 reserve;
|
||||
} mem_arena_options;
|
||||
|
||||
void mem_arena_init(mem_arena* arena);
|
||||
void mem_arena_init_with_options(mem_arena* arena, mem_arena_options* options);
|
||||
void mem_arena_release(mem_arena* arena);
|
||||
MP_API void mem_arena_init(mem_arena* arena);
|
||||
MP_API void mem_arena_init_with_options(mem_arena* arena, mem_arena_options* options);
|
||||
MP_API void mem_arena_release(mem_arena* arena);
|
||||
|
||||
void* mem_arena_alloc(mem_arena* arena, u64 size);
|
||||
void mem_arena_clear(mem_arena* arena);
|
||||
MP_API void* mem_arena_alloc(mem_arena* arena, u64 size);
|
||||
MP_API void mem_arena_clear(mem_arena* arena);
|
||||
|
||||
#define mem_arena_alloc_type(arena, type) ((type*)mem_arena_alloc(arena, sizeof(type)))
|
||||
#define mem_arena_alloc_array(arena, type, count) ((type*)mem_arena_alloc(arena, sizeof(type)*(count)))
|
||||
|
@ -83,21 +83,21 @@ typedef struct mem_pool_options
|
|||
u64 reserve;
|
||||
} mem_pool_options;
|
||||
|
||||
void mem_pool_init(mem_pool* pool, u64 blockSize);
|
||||
void mem_pool_init_with_options(mem_pool* pool, u64 blockSize, mem_pool_options* options);
|
||||
void mem_pool_release(mem_pool* pool);
|
||||
MP_API void mem_pool_init(mem_pool* pool, u64 blockSize);
|
||||
MP_API void mem_pool_init_with_options(mem_pool* pool, u64 blockSize, mem_pool_options* options);
|
||||
MP_API void mem_pool_release(mem_pool* pool);
|
||||
|
||||
void* mem_pool_alloc(mem_pool* pool);
|
||||
void mem_pool_recycle(mem_pool* pool, void* ptr);
|
||||
void mem_pool_clear(mem_pool* pool);
|
||||
MP_API void* mem_pool_alloc(mem_pool* pool);
|
||||
MP_API void mem_pool_recycle(mem_pool* pool, void* ptr);
|
||||
MP_API void mem_pool_clear(mem_pool* pool);
|
||||
|
||||
#define mem_pool_alloc_type(arena, type) ((type*)mem_pool_alloc(arena))
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
//NOTE(martin): per-thread implicit scratch arena
|
||||
//--------------------------------------------------------------------------------
|
||||
void mem_scratch_clear();
|
||||
mem_arena* mem_scratch();
|
||||
MP_API void mem_scratch_clear();
|
||||
MP_API mem_arena* mem_scratch();
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
@ -29,21 +29,21 @@ typedef struct str8
|
|||
#define str8_lit(s) ((str8){.len = sizeof(s)-1, .ptr = (char*)(s)})
|
||||
#define str8_unbox(s) (int)((s).len), ((s).ptr)
|
||||
|
||||
str8 str8_from_buffer(u64 len, char* buffer);
|
||||
str8 str8_from_cstring(char* str);
|
||||
str8 str8_slice(str8 s, u64 start, u64 end);
|
||||
MP_API str8 str8_from_buffer(u64 len, char* buffer);
|
||||
MP_API str8 str8_from_cstring(char* str);
|
||||
MP_API str8 str8_slice(str8 s, u64 start, u64 end);
|
||||
|
||||
str8 str8_push_buffer(mem_arena* arena, u64 len, char* buffer);
|
||||
str8 str8_push_cstring(mem_arena* arena, const char* str);
|
||||
str8 str8_push_copy(mem_arena* arena, str8 s);
|
||||
str8 str8_push_slice(mem_arena* arena, str8 s, u64 start, u64 end);
|
||||
MP_API str8 str8_push_buffer(mem_arena* arena, u64 len, char* buffer);
|
||||
MP_API str8 str8_push_cstring(mem_arena* arena, const char* str);
|
||||
MP_API str8 str8_push_copy(mem_arena* arena, str8 s);
|
||||
MP_API str8 str8_push_slice(mem_arena* arena, str8 s, u64 start, u64 end);
|
||||
|
||||
str8 str8_pushfv(mem_arena* arena, const char* format, va_list args);
|
||||
str8 str8_pushf(mem_arena* arena, const char* format, ...);
|
||||
MP_API str8 str8_pushfv(mem_arena* arena, const char* format, va_list args);
|
||||
MP_API str8 str8_pushf(mem_arena* arena, const char* format, ...);
|
||||
|
||||
int str8_cmp(str8 s1, str8 s2);
|
||||
MP_API int str8_cmp(str8 s1, str8 s2);
|
||||
|
||||
char* str8_to_cstring(mem_arena* arena, str8 string);
|
||||
MP_API char* str8_to_cstring(mem_arena* arena, str8 string);
|
||||
//----------------------------------------------------------------------------------
|
||||
// string lists
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -60,11 +60,11 @@ typedef struct str8_list
|
|||
u64 len;
|
||||
} str8_list;
|
||||
|
||||
void str8_list_push(mem_arena* arena, str8_list* list, str8 str);
|
||||
void str8_list_pushf(mem_arena* arena, str8_list* list, const char* format, ...);
|
||||
MP_API void str8_list_push(mem_arena* arena, str8_list* list, str8 str);
|
||||
MP_API void str8_list_pushf(mem_arena* arena, str8_list* list, const char* format, ...);
|
||||
|
||||
str8 str8_list_join(mem_arena* arena, str8_list list);
|
||||
str8_list str8_split(mem_arena* arena, str8 str, str8_list separators);
|
||||
MP_API str8 str8_list_join(mem_arena* arena, str8_list list);
|
||||
MP_API str8_list str8_split(mem_arena* arena, str8 str, str8_list separators);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// u32 strings
|
||||
|
@ -75,12 +75,12 @@ typedef struct str32
|
|||
u32* ptr;
|
||||
} str32;
|
||||
|
||||
str32 str32_from_buffer(u64 len, u32* buffer);
|
||||
str32 str32_slice(str32 s, u64 start, u64 end);
|
||||
MP_API str32 str32_from_buffer(u64 len, u32* buffer);
|
||||
MP_API str32 str32_slice(str32 s, u64 start, u64 end);
|
||||
|
||||
str32 str32_push_buffer(mem_arena* arena, u64 len, u32* buffer);
|
||||
str32 str32_push_copy(mem_arena* arena, str32 s);
|
||||
str32 str32_push_slice(mem_arena* arena, str32 s, u64 start, u64 end);
|
||||
MP_API str32 str32_push_buffer(mem_arena* arena, u64 len, u32* buffer);
|
||||
MP_API str32 str32_push_copy(mem_arena* arena, str32 s);
|
||||
MP_API str32 str32_push_slice(mem_arena* arena, str32 s, u64 start, u64 end);
|
||||
|
||||
typedef struct str32_elt
|
||||
{
|
||||
|
@ -95,15 +95,15 @@ typedef struct str32_list
|
|||
u64 len;
|
||||
} str32_list;
|
||||
|
||||
void str32_list_push(mem_arena* arena, str32_list* list, str32 str);
|
||||
str32 str32_list_join(mem_arena* arena, str32_list list);
|
||||
str32_list str32_split(mem_arena* arena, str32 str, str32_list separators);
|
||||
MP_API void str32_list_push(mem_arena* arena, str32_list* list, str32 str);
|
||||
MP_API str32 str32_list_join(mem_arena* arena, str32_list list);
|
||||
MP_API str32_list str32_split(mem_arena* arena, str32 str, str32_list separators);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Paths helpers
|
||||
//----------------------------------------------------------------------------------
|
||||
str8 mp_path_directory(str8 fullPath);
|
||||
str8 mp_path_base_name(str8 fullPath);
|
||||
MP_API str8 mp_path_directory(str8 fullPath);
|
||||
MP_API str8 mp_path_base_name(str8 fullPath);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
//
|
||||
//*****************************************************************
|
||||
#include"utf8.h"
|
||||
#include"platform.h"
|
||||
#include<string.h>
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
@ -278,6 +279,6 @@ str8 utf8_push_from_codepoints(mem_arena* arena, str32 codePoints)
|
|||
return(res);
|
||||
}
|
||||
|
||||
#define UNICODE_RANGE(start, cnt, name) const unicode_range _cat2_(UNICODE_RANGE_, name) = { .firstCodePoint = start, .count = cnt };
|
||||
#define UNICODE_RANGE(start, cnt, name) MP_API extern const unicode_range _cat2_(UNICODE_RANGE_, name) = { .firstCodePoint = start, .count = cnt };
|
||||
UNICODE_RANGES
|
||||
#undef UNICODE_RANGE
|
||||
|
|
|
@ -23,14 +23,14 @@ typedef u32 utf32;
|
|||
//-----------------------------------------------------------------
|
||||
//NOTE: getting sizes / offsets / indices
|
||||
//-----------------------------------------------------------------
|
||||
u32 utf8_size_from_leading_char(char leadingChar);
|
||||
u32 utf8_codepoint_size(utf32 codePoint);
|
||||
MP_API u32 utf8_size_from_leading_char(char leadingChar);
|
||||
MP_API u32 utf8_codepoint_size(utf32 codePoint);
|
||||
|
||||
u64 utf8_codepoint_count_for_string(str8 string);
|
||||
u64 utf8_byte_count_for_codepoints(str32 codePoints);
|
||||
MP_API u64 utf8_codepoint_count_for_string(str8 string);
|
||||
MP_API u64 utf8_byte_count_for_codepoints(str32 codePoints);
|
||||
|
||||
u64 utf8_next_offset(str8 string, u64 byteOffset);
|
||||
u64 utf8_prev_offset(str8 string, u64 byteOffset);
|
||||
MP_API u64 utf8_next_offset(str8 string, u64 byteOffset);
|
||||
MP_API u64 utf8_prev_offset(str8 string, u64 byteOffset);
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
//NOTE: encoding / decoding
|
||||
|
@ -41,15 +41,15 @@ typedef struct utf8_dec
|
|||
u32 size; //NOTE: size of corresponding utf8 sequence
|
||||
} utf8_dec;
|
||||
|
||||
utf8_dec utf8_decode(str8 string); //NOTE: decode a single utf8 sequence at start of string
|
||||
utf8_dec utf8_decode_at(str8 string, u64 offset); //NOTE: decode a single utf8 sequence starting at byte offset
|
||||
str8 utf8_encode(char* dst, utf32 codePoint); //NOTE: encode codepoint into backing buffer dst
|
||||
MP_API utf8_dec utf8_decode(str8 string); //NOTE: decode a single utf8 sequence at start of string
|
||||
MP_API utf8_dec utf8_decode_at(str8 string, u64 offset); //NOTE: decode a single utf8 sequence starting at byte offset
|
||||
MP_API str8 utf8_encode(char* dst, utf32 codePoint); //NOTE: encode codepoint into backing buffer dst
|
||||
|
||||
str32 utf8_to_codepoints(u64 maxCount, utf32* backing, str8 string);
|
||||
str8 utf8_from_codepoints(u64 maxBytes, char* backing, str32 codePoints);
|
||||
MP_API str32 utf8_to_codepoints(u64 maxCount, utf32* backing, str8 string);
|
||||
MP_API str8 utf8_from_codepoints(u64 maxBytes, char* backing, str32 codePoints);
|
||||
|
||||
str32 utf8_push_to_codepoints(mem_arena* arena, str8 string);
|
||||
str8 utf8_push_from_codepoints(mem_arena* arena, str32 codePoints);
|
||||
MP_API str32 utf8_push_to_codepoints(mem_arena* arena, str8 string);
|
||||
MP_API str8 utf8_push_from_codepoints(mem_arena* arena, str32 codePoints);
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// utf8 range struct and X-macros for defining utf8 ranges
|
||||
|
@ -189,9 +189,8 @@ UNICODE_RANGE(0xe0100, 239, VARIATION_SELECTORS_SUPPLEMENT) \
|
|||
UNICODE_RANGE(0xf0000, 65533, SUPPLEMENTARY_PRIVATE_USE_AREA_A) \
|
||||
UNICODE_RANGE(0x100000, 65533, SUPPLEMENTARY_PRIVATE_USE_AREA_B)
|
||||
|
||||
|
||||
#define UNICODE_RANGE(start, count, name) \
|
||||
extern const unicode_range _cat2_(UNICODE_RANGE_, name);
|
||||
MP_API extern const unicode_range _cat2_(UNICODE_RANGE_, name);
|
||||
UNICODE_RANGES
|
||||
#undef UNICODE_RANGE
|
||||
|
||||
|
|
2
todo.txt
2
todo.txt
|
@ -16,7 +16,7 @@ Overview
|
|||
[.] Make linking with libEGL optional, even if EGL backend is compiled in milepost?
|
||||
[x] using weak linking on macos
|
||||
[ ] use /DELAYLOAD:lib on windows?
|
||||
[.] Remove the need for client apps to link with all dependent libs explicitly
|
||||
[x] Remove the need for client apps to link with all dependent libs explicitly
|
||||
|
||||
[!] Allow controlling surface overlaying
|
||||
[!] Sort out contents scaling for high dpi on osx
|
||||
|
|
Loading…
Reference in New Issue