#ifndef ULTRALIGHT_CAPI_H
#define ULTRALIGHT_CAPI_H
#ifndef __cplusplus
#endif
#include <stddef.h>
#include "JavaScriptCore/JavaScript.h"
#ifdef __OBJC__
#import <AppKit/NSEvent.h>
#endif
#if defined(__WIN32__) || defined(_WIN32)
# if defined(ULTRALIGHT_IMPLEMENTATION)
# define ULExport __declspec(dllexport)
# else
# define ULExport __declspec(dllimport)
# endif
#define _thread_local __declspec(thread)
#ifndef _NATIVE_WCHAR_T_DEFINED
#define DISABLE_NATIVE_WCHAR_T
typedef unsigned short ULChar16;
#else
typedef wchar_t ULChar16;
#endif
#else
# define ULExport __attribute__((visibility("default")))
#define _thread_local __thread
typedef unsigned short ULChar16;
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct C_Config* ULConfig;
typedef struct C_Renderer* ULRenderer;
typedef struct C_Session* ULSession;
typedef struct C_ViewConfig* ULViewConfig;
typedef struct C_View* ULView;
typedef struct C_Bitmap* ULBitmap;
typedef struct C_String* ULString;
typedef struct C_Buffer* ULBuffer;
typedef struct C_KeyEvent* ULKeyEvent;
typedef struct C_MouseEvent* ULMouseEvent;
typedef struct C_ScrollEvent* ULScrollEvent;
typedef struct C_Surface* ULSurface;
typedef struct C_Surface* ULBitmapSurface;
typedef enum {
kMessageSource_XML = 0,
kMessageSource_JS,
kMessageSource_Network,
kMessageSource_ConsoleAPI,
kMessageSource_Storage,
kMessageSource_AppCache,
kMessageSource_Rendering,
kMessageSource_CSS,
kMessageSource_Security,
kMessageSource_ContentBlocker,
kMessageSource_Other,
} ULMessageSource;
typedef enum {
kMessageLevel_Log = 1,
kMessageLevel_Warning = 2,
kMessageLevel_Error = 3,
kMessageLevel_Debug = 4,
kMessageLevel_Info = 5,
} ULMessageLevel;
typedef enum {
kCursor_Pointer = 0,
kCursor_Cross,
kCursor_Hand,
kCursor_IBeam,
kCursor_Wait,
kCursor_Help,
kCursor_EastResize,
kCursor_NorthResize,
kCursor_NorthEastResize,
kCursor_NorthWestResize,
kCursor_SouthResize,
kCursor_SouthEastResize,
kCursor_SouthWestResize,
kCursor_WestResize,
kCursor_NorthSouthResize,
kCursor_EastWestResize,
kCursor_NorthEastSouthWestResize,
kCursor_NorthWestSouthEastResize,
kCursor_ColumnResize,
kCursor_RowResize,
kCursor_MiddlePanning,
kCursor_EastPanning,
kCursor_NorthPanning,
kCursor_NorthEastPanning,
kCursor_NorthWestPanning,
kCursor_SouthPanning,
kCursor_SouthEastPanning,
kCursor_SouthWestPanning,
kCursor_WestPanning,
kCursor_Move,
kCursor_VerticalText,
kCursor_Cell,
kCursor_ContextMenu,
kCursor_Alias,
kCursor_Progress,
kCursor_NoDrop,
kCursor_Copy,
kCursor_None,
kCursor_NotAllowed,
kCursor_ZoomIn,
kCursor_ZoomOut,
kCursor_Grab,
kCursor_Grabbing,
kCursor_Custom
} ULCursor;
typedef enum {
kBitmapFormat_A8_UNORM,
kBitmapFormat_BGRA8_UNORM_SRGB
} ULBitmapFormat;
typedef enum {
kKeyEventType_KeyDown,
kKeyEventType_KeyUp,
kKeyEventType_RawKeyDown,
kKeyEventType_Char,
} ULKeyEventType;
typedef enum {
kMouseEventType_MouseMoved,
kMouseEventType_MouseDown,
kMouseEventType_MouseUp,
} ULMouseEventType;
typedef enum {
kMouseButton_None = 0,
kMouseButton_Left,
kMouseButton_Middle,
kMouseButton_Right,
} ULMouseButton;
typedef enum {
kScrollEventType_ScrollByPixel,
kScrollEventType_ScrollByPage,
} ULScrollEventType;
typedef enum {
kFaceWinding_Clockwise,
kFaceWindow_CounterClockwise,
} ULFaceWinding;
typedef enum {
kFontHinting_Smooth,
kFontHinting_Normal,
kFontHinting_Monochrome,
} ULFontHinting;
typedef struct {
float left;
float top;
float right;
float bottom;
} ULRect;
typedef struct {
int left;
int top;
int right;
int bottom;
} ULIntRect;
typedef struct {
bool is_empty;
unsigned int width;
unsigned int height;
unsigned int texture_id;
unsigned int texture_width;
unsigned int texture_height;
ULBitmapFormat texture_format;
ULRect uv_coords;
unsigned int render_buffer_id;
} ULRenderTarget;
ULExport const char* ulVersionString();
ULExport unsigned int ulVersionMajor();
ULExport unsigned int ulVersionMinor();
ULExport unsigned int ulVersionPatch();
ULExport ULConfig ulCreateConfig();
ULExport void ulDestroyConfig(ULConfig config);
ULExport void ulConfigSetCachePath(ULConfig config, ULString cache_path);
ULExport void ulConfigSetFaceWinding(ULConfig config, ULFaceWinding winding);
ULExport void ulConfigSetFontHinting(ULConfig config, ULFontHinting font_hinting);
ULExport void ulConfigSetFontGamma(ULConfig config, double font_gamma);
ULExport void ulConfigSetUserStylesheet(ULConfig config, ULString css_string);
ULExport void ulConfigSetForceRepaint(ULConfig config, bool enabled);
ULExport void ulConfigSetAnimationTimerDelay(ULConfig config, double delay);
ULExport void ulConfigSetScrollTimerDelay(ULConfig config, double delay);
ULExport void ulConfigSetRecycleDelay(ULConfig config, double delay);
ULExport void ulConfigSetMemoryCacheSize(ULConfig config, unsigned int size);
ULExport void ulConfigSetPageCacheSize(ULConfig config, unsigned int size);
ULExport void ulConfigSetOverrideRAMSize(ULConfig config, unsigned int size);
ULExport void ulConfigSetMinLargeHeapSize(ULConfig config, unsigned int size);
ULExport void ulConfigSetMinSmallHeapSize(ULConfig config, unsigned int size);
ULExport ULRenderer ulCreateRenderer(ULConfig config);
ULExport void ulDestroyRenderer(ULRenderer renderer);
ULExport void ulUpdate(ULRenderer renderer);
ULExport void ulRender(ULRenderer renderer);
ULExport void ulPurgeMemory(ULRenderer renderer);
ULExport void ulLogMemoryUsage(ULRenderer renderer);
ULExport ULSession ulCreateSession(ULRenderer renderer, bool is_persistent,
ULString name);
ULExport void ulDestroySession(ULSession session);
ULExport ULSession ulDefaultSession(ULRenderer renderer);
ULExport bool ulSessionIsPersistent(ULSession session);
ULExport ULString ulSessionGetName(ULSession session);
ULExport unsigned long long ulSessionGetId(ULSession session);
ULExport ULString ulSessionGetDiskPath(ULSession session);
ULExport ULViewConfig ulCreateViewConfig();
ULExport void ulDestroyViewConfig(ULViewConfig config);
ULExport void ulViewConfigSetIsAccelerated(ULViewConfig config, bool is_accelerated);
ULExport void ulViewConfigSetIsTransparent(ULViewConfig config, bool is_transparent);
ULExport void ulViewConfigSetInitialDeviceScale(ULViewConfig config, double initial_device_scale);
ULExport void ulViewConfigSetInitialFocus(ULViewConfig config, bool is_focused);
ULExport void ulViewConfigSetEnableImages(ULViewConfig config, bool enabled);
ULExport void ulViewConfigSetEnableJavaScript(ULViewConfig config, bool enabled);
ULExport void ulViewConfigSetFontFamilyStandard(ULViewConfig config, ULString font_name);
ULExport void ulViewConfigSetFontFamilyFixed(ULViewConfig config, ULString font_name);
ULExport void ulViewConfigSetFontFamilySerif(ULViewConfig config, ULString font_name);
ULExport void ulViewConfigSetFontFamilySansSerif(ULViewConfig config, ULString font_name);
ULExport void ulViewConfigSetUserAgent(ULViewConfig config, ULString agent_string);
ULExport ULView ulCreateView(ULRenderer renderer, unsigned int width, unsigned int height,
ULViewConfig view_config, ULSession session);
ULExport void ulDestroyView(ULView view);
ULExport ULString ulViewGetURL(ULView view);
ULExport ULString ulViewGetTitle(ULView view);
ULExport unsigned int ulViewGetWidth(ULView view);
ULExport unsigned int ulViewGetHeight(ULView view);
ULExport bool ulViewIsLoading(ULView view);
ULExport ULRenderTarget ulViewGetRenderTarget(ULView view);
ULExport ULSurface ulViewGetSurface(ULView view);
ULExport void ulViewLoadHTML(ULView view, ULString html_string);
ULExport void ulViewLoadURL(ULView view, ULString url_string);
ULExport void ulViewResize(ULView view, unsigned int width,
unsigned int height);
ULExport JSContextRef ulViewLockJSContext(ULView view);
ULExport void ulViewUnlockJSContext(ULView view);
ULExport ULString ulViewEvaluateScript(ULView view, ULString js_string, ULString* exception);
ULExport bool ulViewCanGoBack(ULView view);
ULExport bool ulViewCanGoForward(ULView view);
ULExport void ulViewGoBack(ULView view);
ULExport void ulViewGoForward(ULView view);
ULExport void ulViewGoToHistoryOffset(ULView view, int offset);
ULExport void ulViewReload(ULView view);
ULExport void ulViewStop(ULView view);
ULExport void ulViewFocus(ULView view);
ULExport void ulViewUnfocus(ULView view);
ULExport bool ulViewHasFocus(ULView view);
ULExport bool ulViewHasInputFocus(ULView view);
ULExport void ulViewFireKeyEvent(ULView view, ULKeyEvent key_event);
ULExport void ulViewFireMouseEvent(ULView view, ULMouseEvent mouse_event);
ULExport void ulViewFireScrollEvent(ULView view, ULScrollEvent scroll_event);
typedef void
(*ULChangeTitleCallback) (void* user_data, ULView caller, ULString title);
ULExport void ulViewSetChangeTitleCallback(ULView view,
ULChangeTitleCallback callback,
void* user_data);
typedef void
(*ULChangeURLCallback) (void* user_data, ULView caller, ULString url);
ULExport void ulViewSetChangeURLCallback(ULView view,
ULChangeURLCallback callback,
void* user_data);
typedef void
(*ULChangeTooltipCallback) (void* user_data, ULView caller, ULString tooltip);
ULExport void ulViewSetChangeTooltipCallback(ULView view,
ULChangeTooltipCallback callback,
void* user_data);
typedef void
(*ULChangeCursorCallback) (void* user_data, ULView caller, ULCursor cursor);
ULExport void ulViewSetChangeCursorCallback(ULView view,
ULChangeCursorCallback callback,
void* user_data);
typedef void
(*ULAddConsoleMessageCallback) (void* user_data, ULView caller,
ULMessageSource source, ULMessageLevel level,
ULString message, unsigned int line_number,
unsigned int column_number,
ULString source_id);
ULExport void ulViewSetAddConsoleMessageCallback(ULView view,
ULAddConsoleMessageCallback callback,
void* user_data);
typedef ULView
(*ULCreateChildViewCallback) (void* user_data, ULView caller,
ULString opener_url, ULString target_url, bool is_popup,
ULIntRect popup_rect);
ULExport void ulViewSetCreateChildViewCallback(ULView view,
ULCreateChildViewCallback callback,
void* user_data);
typedef void
(*ULBeginLoadingCallback) (void* user_data, ULView caller,
unsigned long long frame_id, bool is_main_frame, ULString url);
ULExport void ulViewSetBeginLoadingCallback(ULView view,
ULBeginLoadingCallback callback,
void* user_data);
typedef void
(*ULFinishLoadingCallback) (void* user_data, ULView caller,
unsigned long long frame_id, bool is_main_frame, ULString url);
ULExport void ulViewSetFinishLoadingCallback(ULView view,
ULFinishLoadingCallback callback,
void* user_data);
typedef void
(*ULFailLoadingCallback) (void* user_data, ULView caller,
unsigned long long frame_id, bool is_main_frame, ULString url,
ULString description, ULString error_domain, int error_code);
ULExport void ulViewSetFailLoadingCallback(ULView view,
ULFailLoadingCallback callback,
void* user_data);
typedef void
(*ULWindowObjectReadyCallback) (void* user_data, ULView caller,
unsigned long long frame_id, bool is_main_frame, ULString url);
ULExport void ulViewSetWindowObjectReadyCallback(ULView view,
ULWindowObjectReadyCallback callback,
void* user_data);
typedef void
(*ULDOMReadyCallback) (void* user_data, ULView caller,
unsigned long long frame_id, bool is_main_frame, ULString url);
ULExport void ulViewSetDOMReadyCallback(ULView view,
ULDOMReadyCallback callback,
void* user_data);
typedef void
(*ULUpdateHistoryCallback) (void* user_data, ULView caller);
ULExport void ulViewSetUpdateHistoryCallback(ULView view,
ULUpdateHistoryCallback callback,
void* user_data);
ULExport void ulViewSetNeedsPaint(ULView view, bool needs_paint);
ULExport bool ulViewGetNeedsPaint(ULView view);
ULExport ULView ulViewCreateInspectorView(ULView view);
ULExport ULString ulCreateString(const char* str);
ULExport ULString ulCreateStringUTF8(const char* str, size_t len);
ULExport ULString ulCreateStringUTF16(ULChar16* str, size_t len);
ULExport ULString ulCreateStringFromCopy(ULString str);
ULExport void ulDestroyString(ULString str);
ULExport ULChar16* ulStringGetData(ULString str);
ULExport size_t ulStringGetLength(ULString str);
ULExport bool ulStringIsEmpty(ULString str);
ULExport void ulStringAssignString(ULString str, ULString new_str);
ULExport void ulStringAssignCString(ULString str, const char* c_str);
ULExport ULBitmap ulCreateEmptyBitmap();
ULExport ULBitmap ulCreateBitmap(unsigned int width, unsigned int height,
ULBitmapFormat format);
ULExport ULBitmap ulCreateBitmapFromPixels(unsigned int width,
unsigned int height,
ULBitmapFormat format,
unsigned int row_bytes,
const void* pixels, size_t size,
bool should_copy);
ULExport ULBitmap ulCreateBitmapFromCopy(ULBitmap existing_bitmap);
ULExport void ulDestroyBitmap(ULBitmap bitmap);
ULExport unsigned int ulBitmapGetWidth(ULBitmap bitmap);
ULExport unsigned int ulBitmapGetHeight(ULBitmap bitmap);
ULExport ULBitmapFormat ulBitmapGetFormat(ULBitmap bitmap);
ULExport unsigned int ulBitmapGetBpp(ULBitmap bitmap);
ULExport unsigned int ulBitmapGetRowBytes(ULBitmap bitmap);
ULExport size_t ulBitmapGetSize(ULBitmap bitmap);
ULExport bool ulBitmapOwnsPixels(ULBitmap bitmap);
ULExport void* ulBitmapLockPixels(ULBitmap bitmap);
ULExport void ulBitmapUnlockPixels(ULBitmap bitmap);
ULExport void* ulBitmapRawPixels(ULBitmap bitmap);
ULExport bool ulBitmapIsEmpty(ULBitmap bitmap);
ULExport void ulBitmapErase(ULBitmap bitmap);
ULExport bool ulBitmapWritePNG(ULBitmap bitmap, const char* path);
ULExport void ulBitmapSwapRedBlueChannels(ULBitmap bitmap);
ULExport ULKeyEvent ulCreateKeyEvent(ULKeyEventType type,
unsigned int modifiers,
int virtual_key_code, int native_key_code,
ULString text, ULString unmodified_text,
bool is_keypad, bool is_auto_repeat,
bool is_system_key);
#ifdef _WIN32
ULExport ULKeyEvent ulCreateKeyEventWindows(ULKeyEventType type,
uintptr_t wparam, intptr_t lparam,
bool is_system_key);
#endif
#ifdef __OBJC__
ULExport ULKeyEvent ulCreateKeyEventMacOS(NSEvent* evt);
#endif
ULExport void ulDestroyKeyEvent(ULKeyEvent evt);
ULExport ULMouseEvent ulCreateMouseEvent(ULMouseEventType type, int x, int y,
ULMouseButton button);
ULExport void ulDestroyMouseEvent(ULMouseEvent evt);
ULExport ULScrollEvent ulCreateScrollEvent(ULScrollEventType type, int delta_x,
int delta_y);
ULExport void ulDestroyScrollEvent(ULScrollEvent evt);
ULExport bool ulRectIsEmpty(ULRect rect);
ULExport ULRect ulRectMakeEmpty();
ULExport bool ulIntRectIsEmpty(ULIntRect rect);
ULExport ULIntRect ulIntRectMakeEmpty();
ULExport unsigned int ulSurfaceGetWidth(ULSurface surface);
ULExport unsigned int ulSurfaceGetHeight(ULSurface surface);
ULExport unsigned int ulSurfaceGetRowBytes(ULSurface surface);
ULExport size_t ulSurfaceGetSize(ULSurface surface);
ULExport void* ulSurfaceLockPixels(ULSurface surface);
ULExport void ulSurfaceUnlockPixels(ULSurface surface);
ULExport void ulSurfaceResize(ULSurface surface, unsigned int width, unsigned int height);
ULExport void ulSurfaceSetDirtyBounds(ULSurface surface, ULIntRect bounds);
ULExport ULIntRect ulSurfaceGetDirtyBounds(ULSurface surface);
ULExport void ulSurfaceClearDirtyBounds(ULSurface surface);
ULExport void* ulSurfaceGetUserData(ULSurface surface);
ULExport ULBitmap ulBitmapSurfaceGetBitmap(ULBitmapSurface surface);
typedef void*
(*ULSurfaceDefinitionCreateCallback) (unsigned int width, unsigned int height);
typedef void
(*ULSurfaceDefinitionDestroyCallback) (void* user_data);
typedef unsigned int
(*ULSurfaceDefinitionGetWidthCallback) (void* user_data);
typedef unsigned int
(*ULSurfaceDefinitionGetHeightCallback) (void* user_data);
typedef unsigned int
(*ULSurfaceDefinitionGetRowBytesCallback) (void* user_data);
typedef size_t
(*ULSurfaceDefinitionGetSizeCallback) (void* user_data);
typedef void*
(*ULSurfaceDefinitionLockPixelsCallback) (void* user_data);
typedef void
(*ULSurfaceDefinitionUnlockPixelsCallback) (void* user_data);
typedef void
(*ULSurfaceDefinitionResizeCallback) (void* user_data, unsigned int width, unsigned int height);
typedef struct {
ULSurfaceDefinitionCreateCallback create;
ULSurfaceDefinitionDestroyCallback destroy;
ULSurfaceDefinitionGetWidthCallback get_width;
ULSurfaceDefinitionGetHeightCallback get_height;
ULSurfaceDefinitionGetRowBytesCallback get_row_bytes;
ULSurfaceDefinitionGetSizeCallback get_size;
ULSurfaceDefinitionLockPixelsCallback lock_pixels;
ULSurfaceDefinitionUnlockPixelsCallback unlock_pixels;
ULSurfaceDefinitionResizeCallback resize;
} ULSurfaceDefinition;
#if defined(__WIN32__) || defined(_WIN32)
typedef size_t ULFileHandle;
#else
typedef int ULFileHandle;
#endif
const ULFileHandle ULInvalidFileHandle = (ULFileHandle)-1;
typedef bool
(*ULFileSystemFileExistsCallback) (ULString path);
typedef bool
(*ULFileSystemGetFileSizeCallback) (ULFileHandle handle, long long* result);
typedef bool
(*ULFileSystemGetFileMimeTypeCallback) (ULString path, ULString result);
typedef ULFileHandle
(*ULFileSystemOpenFileCallback) (ULString path, bool open_for_writing);
typedef void
(*ULFileSystemCloseFileCallback) (ULFileHandle handle);
typedef long long
(*ULFileSystemReadFromFileCallback) (ULFileHandle handle, char* data, long long length);
typedef struct {
ULFileSystemFileExistsCallback file_exists;
ULFileSystemGetFileSizeCallback get_file_size;
ULFileSystemGetFileMimeTypeCallback get_file_mime_type;
ULFileSystemOpenFileCallback open_file;
ULFileSystemCloseFileCallback close_file;
ULFileSystemReadFromFileCallback read_from_file;
} ULFileSystem;
typedef enum {
kLogLevel_Error = 0,
kLogLevel_Warning,
kLogLevel_Info
} ULLogLevel;
typedef void
(*ULLoggerLogMessageCallback) (ULLogLevel log_level, ULString message);
typedef struct {
ULLoggerLogMessageCallback log_message;
} ULLogger;
typedef struct {
unsigned int texture_id; unsigned int width; unsigned int height; bool has_stencil_buffer; bool has_depth_buffer; } ULRenderBuffer;
#pragma pack(push, 1)
typedef struct {
float pos[2];
unsigned char color[4];
float obj[2];
} ULVertex_2f_4ub_2f;
typedef struct {
float pos[2];
unsigned char color[4];
float tex[2];
float obj[2];
float data0[4];
float data1[4];
float data2[4];
float data3[4];
float data4[4];
float data5[4];
float data6[4];
} ULVertex_2f_4ub_2f_2f_28f;
#pragma pack(pop)
typedef enum {
kVertexBufferFormat_2f_4ub_2f,
kVertexBufferFormat_2f_4ub_2f_2f_28f,
} ULVertexBufferFormat;
typedef struct {
ULVertexBufferFormat format;
unsigned int size;
unsigned char* data;
} ULVertexBuffer;
typedef unsigned int ULIndexType;
typedef struct {
unsigned int size;
unsigned char* data;
} ULIndexBuffer;
typedef enum {
kShaderType_Fill, kShaderType_FillPath, } ULShaderType;
typedef struct {
float data[16];
} ULMatrix4x4;
typedef struct {
float value[4];
} ULvec4;
typedef struct {
unsigned int viewport_width;
unsigned int viewport_height;
ULMatrix4x4 transform;
bool enable_texturing;
bool enable_blend;
unsigned char shader_type;
unsigned int render_buffer_id;
unsigned int texture_1_id;
unsigned int texture_2_id;
unsigned int texture_3_id;
float uniform_scalar[8];
ULvec4 uniform_vector[8];
unsigned char clip_size;
ULMatrix4x4 clip[8];
bool enable_scissor;
ULIntRect scissor_rect;
} ULGPUState;
typedef enum {
kCommandType_ClearRenderBuffer,
kCommandType_DrawGeometry,
} ULCommandType;
typedef struct {
unsigned char command_type; ULGPUState gpu_state;
unsigned int geometry_id; unsigned int indices_count; unsigned int indices_offset; } ULCommand;
typedef struct {
unsigned int size;
ULCommand* commands;
} ULCommandList;
typedef void
(*ULGPUDriverBeginSynchronizeCallback) ();
typedef void
(*ULGPUDriverEndSynchronizeCallback) ();
typedef unsigned int
(*ULGPUDriverNextTextureIdCallback) ();
typedef void
(*ULGPUDriverCreateTextureCallback) (unsigned int texture_id,
ULBitmap bitmap);
typedef void
(*ULGPUDriverUpdateTextureCallback) (unsigned int texture_id,
ULBitmap bitmap);
typedef void
(*ULGPUDriverDestroyTextureCallback) (unsigned int texture_id);
typedef unsigned int
(*ULGPUDriverNextRenderBufferIdCallback) ();
typedef void
(*ULGPUDriverCreateRenderBufferCallback) (unsigned int render_buffer_id,
ULRenderBuffer buffer);
typedef void
(*ULGPUDriverDestroyRenderBufferCallback) (unsigned int render_buffer_id);
typedef unsigned int
(*ULGPUDriverNextGeometryIdCallback) ();
typedef void
(*ULGPUDriverCreateGeometryCallback) (unsigned int geometry_id,
ULVertexBuffer vertices,
ULIndexBuffer indices);
typedef void
(*ULGPUDriverUpdateGeometryCallback) (unsigned int geometry_id,
ULVertexBuffer vertices,
ULIndexBuffer indices);
typedef void
(*ULGPUDriverDestroyGeometryCallback) (unsigned int geometry_id);
typedef void
(*ULGPUDriverUpdateCommandListCallback) (ULCommandList list);
typedef struct {
ULGPUDriverBeginSynchronizeCallback begin_synchronize;
ULGPUDriverEndSynchronizeCallback end_synchronize;
ULGPUDriverNextTextureIdCallback next_texture_id;
ULGPUDriverCreateTextureCallback create_texture;
ULGPUDriverUpdateTextureCallback update_texture;
ULGPUDriverDestroyTextureCallback destroy_texture;
ULGPUDriverNextRenderBufferIdCallback next_render_buffer_id;
ULGPUDriverCreateRenderBufferCallback create_render_buffer;
ULGPUDriverDestroyRenderBufferCallback destroy_render_buffer;
ULGPUDriverNextGeometryIdCallback next_geometry_id;
ULGPUDriverCreateGeometryCallback create_geometry;
ULGPUDriverUpdateGeometryCallback update_geometry;
ULGPUDriverDestroyGeometryCallback destroy_geometry;
ULGPUDriverUpdateCommandListCallback update_command_list;
} ULGPUDriver;
ULExport ULMatrix4x4 ulApplyProjection(ULMatrix4x4 transform,
float viewport_width,
float viewport_height,
bool flip_y);
typedef void
(*ULClipboardClearCallback) ();
typedef void
(*ULClipboardReadPlainTextCallback) (ULString result);
typedef void
(*ULClipboardWritePlainTextCallback) (ULString text);
typedef struct {
ULClipboardClearCallback clear;
ULClipboardReadPlainTextCallback read_plain_text;
ULClipboardWritePlainTextCallback write_plain_text;
} ULClipboard;
ULExport void ulPlatformSetLogger(ULLogger logger);
ULExport void ulPlatformSetFileSystem(ULFileSystem file_system);
ULExport void ulPlatformSetSurfaceDefinition(ULSurfaceDefinition surface_definition);
ULExport void ulPlatformSetGPUDriver(ULGPUDriver gpu_driver);
ULExport void ulPlatformSetClipboard(ULClipboard clipboard);
#ifdef __cplusplus
}
#endif
#endif