|
@@ -4,7 +4,7 @@
|
|
|
|
|
|
Do this:
|
|
|
#define SOKOL_IMPL
|
|
|
- before you include this file in *one* C or C++ file to create the
|
|
|
+ before you include this file in *one* C or C++ file to create the
|
|
|
implementation.
|
|
|
|
|
|
Optionally provide the following defines with your own implementations:
|
|
@@ -29,7 +29,7 @@
|
|
|
|
|
|
If you use sokol_app.h together with sokol_gfx.h, include both headers
|
|
|
in the implementation source file, and include sokol_app.h before
|
|
|
- sokol_gfx.h since sokol_app.h will also include the required 3D-API
|
|
|
+ sokol_gfx.h since sokol_app.h will also include the required 3D-API
|
|
|
headers.
|
|
|
|
|
|
On Windows, a minimal 'GL header' and function loader is integrated which
|
|
@@ -107,7 +107,7 @@
|
|
|
============
|
|
|
--- Add a sokol_main() to your code which returns a sapp_desc structure
|
|
|
with initialization parameters and callback function pointers. This
|
|
|
- function is called very early, usually at the start of the
|
|
|
+ function is called very early, usually at the start of the
|
|
|
platform's entry function (e.g. main or WinMain). You should do as
|
|
|
little as possible here, since the rest of your code might be called
|
|
|
from another thread (this depends on the platform):
|
|
@@ -129,7 +129,7 @@
|
|
|
below.
|
|
|
|
|
|
DO NOT call any sokol-app function from inside sokol_main(), since
|
|
|
- sokol-app will not be initialized at this point.
|
|
|
+ sokol-app will not be initialized at this point.
|
|
|
|
|
|
The .width and .height parameters are the preferred size of the 3D
|
|
|
rendering canvas. The actual size may differ from this depending on
|
|
@@ -156,7 +156,7 @@
|
|
|
future may also be used to communicate other types of events
|
|
|
to the application. Keep the event_cb struct member zero-initialized
|
|
|
if your application doesn't require event handling.
|
|
|
-
|
|
|
+
|
|
|
--- Implement the initialization callback function, this is called once
|
|
|
after the rendering surface, 3D API and swap chain have been
|
|
|
initialized by sokol_app. All sokol-app functions can be called
|
|
@@ -168,7 +168,7 @@
|
|
|
from one frame to the next.
|
|
|
int sapp_height(void)
|
|
|
Likewise, returns the current height of the default framebuffer.
|
|
|
-
|
|
|
+
|
|
|
bool sapp_gles2(void)
|
|
|
Returns true if as GLES2 or WebGL2 context had been created (for
|
|
|
instance because GLES3/WebGL2 isn't available on the device)
|
|
@@ -196,7 +196,7 @@
|
|
|
const void* sapp_d3d11_get_render_target_view(void);
|
|
|
const void* sapp_d3d11_get_depth_stencil_view(void);
|
|
|
Similar to the sapp_metal_* functions, the sapp_d3d11_* functions
|
|
|
- return pointers to D3D11 API objects required for rendering,
|
|
|
+ return pointers to D3D11 API objects required for rendering,
|
|
|
only if the D3D11 backend has been selected. Otherwise they
|
|
|
return a null pointer. Note that the returned pointers to the
|
|
|
render-target-view and depth-stencil-view may change from one
|
|
@@ -268,7 +268,7 @@
|
|
|
FULLSCREEN
|
|
|
==========
|
|
|
If the sapp_desc.fullscreen flag is true, sokol-app will try to create
|
|
|
- a fullscreen window on platforms with a 'proper' window system
|
|
|
+ a fullscreen window on platforms with a 'proper' window system
|
|
|
(mobile devices will always use fullscreen). The implementation details
|
|
|
depend on the target platform, in general sokol-app will use a
|
|
|
'soft approach' which doesn't interfere too much with the platform's
|
|
@@ -553,7 +553,7 @@ typedef struct {
|
|
|
bool html5_canvas_resize;
|
|
|
bool ios_keyboard_resizes_canvas;
|
|
|
/* use GLES2 even if GLES3 is available */
|
|
|
- bool gl_force_gles2;
|
|
|
+ bool gl_force_gles2;
|
|
|
/* if true, user is expected to manage cursor image and visibility on SAPP_EVENTTYPE_UPDATE_CURSOR */
|
|
|
bool user_cursor;
|
|
|
} sapp_desc;
|
|
@@ -576,7 +576,7 @@ SOKOL_API_DECL bool sapp_gles2(void);
|
|
|
/* OSX/Metal specific functions */
|
|
|
SOKOL_API_DECL const void* sapp_metal_get_device(void);
|
|
|
SOKOL_API_DECL const void* sapp_metal_get_renderpass_descriptor(void);
|
|
|
-SOKOL_API_DECL const void* sapp_metal_get_drawable(void);
|
|
|
+SOKOL_API_DECL const void* sapp_metal_get_drawable(void);
|
|
|
SOKOL_API_DECL const void* sapp_macos_get_window(void);
|
|
|
SOKOL_API_DECL const void* sapp_ios_get_window(void);
|
|
|
|
|
@@ -662,7 +662,7 @@ SOKOL_API_DECL const void* sapp_win32_get_hwnd(void);
|
|
|
#define SOKOL_FREE(p) free(p)
|
|
|
#endif
|
|
|
#ifndef SOKOL_LOG
|
|
|
- #ifdef SOKOL_DEBUG
|
|
|
+ #ifdef SOKOL_DEBUG
|
|
|
#include <stdio.h>
|
|
|
#define SOKOL_LOG(s) { SOKOL_ASSERT(s); puts(s); }
|
|
|
#else
|
|
@@ -1215,8 +1215,8 @@ _SOKOL_PRIVATE void _sapp_macos_app_event(sapp_event_type type) {
|
|
|
}
|
|
|
}
|
|
|
- (void)keyUp:(NSEvent*)event {
|
|
|
- _sapp_macos_key_event(SAPP_EVENTTYPE_KEY_UP,
|
|
|
- _sapp_translate_key(event.keyCode),
|
|
|
+ _sapp_macos_key_event(SAPP_EVENTTYPE_KEY_UP,
|
|
|
+ _sapp_translate_key(event.keyCode),
|
|
|
_sapp_macos_mod(event.modifierFlags));
|
|
|
}
|
|
|
- (void)flagsChanged:(NSEvent*)event {
|
|
@@ -1619,7 +1619,7 @@ _SOKOL_PRIVATE void _sapp_ios_touch_event(sapp_event_type type, NSSet<UITouch *>
|
|
|
#if defined(SOKOL_GLES3)
|
|
|
#include <GLES3/gl3.h>
|
|
|
#else
|
|
|
-#ifndef GL_EXT_PROTOTYPES
|
|
|
+#ifndef GL_EXT_PROTOTYPES
|
|
|
#define GL_GLEXT_PROTOTYPES
|
|
|
#endif
|
|
|
#include <GLES2/gl2.h>
|
|
@@ -1872,7 +1872,7 @@ _SOKOL_PRIVATE EM_BOOL _sapp_emsc_key_cb(int emsc_type, const EmscriptenKeyboard
|
|
|
break;
|
|
|
default:
|
|
|
type = SAPP_EVENTTYPE_INVALID;
|
|
|
- break;
|
|
|
+ break;
|
|
|
}
|
|
|
if (type != SAPP_EVENTTYPE_INVALID) {
|
|
|
_sapp_init_event(type);
|
|
@@ -3716,7 +3716,7 @@ _SOKOL_PRIVATE void _sapp_win32_create_window(void) {
|
|
|
rect.bottom = GetSystemMetrics(SM_CYSCREEN);
|
|
|
}
|
|
|
else {
|
|
|
- win_style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX;
|
|
|
+ win_style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX;
|
|
|
rect.right = (int) (_sapp.window_width * _sapp_win32_window_scale);
|
|
|
rect.bottom = (int) (_sapp.window_height * _sapp_win32_window_scale);
|
|
|
}
|
|
@@ -3824,7 +3824,7 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
|
|
|
_sapp_win32_utf8_to_wide(_sapp.window_title, _sapp.window_title_wide, sizeof(_sapp.window_title_wide));
|
|
|
_sapp_win32_init_dpi();
|
|
|
_sapp_win32_create_window();
|
|
|
- #if defined(SOKOL_D3D11)
|
|
|
+ #if defined(SOKOL_D3D11)
|
|
|
_sapp_d3d11_create_device_and_swapchain();
|
|
|
_sapp_d3d11_create_default_render_target();
|
|
|
#endif
|
|
@@ -3870,7 +3870,7 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
|
|
|
_sapp_win32_destroy_window();
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
#undef _SAPP_SAFE_RELEASE
|
|
|
#endif /* WINDOWS */
|
|
|
|
|
@@ -4006,19 +4006,19 @@ static const struct _sapp_x11_codepair {
|
|
|
uint16_t keysym;
|
|
|
uint16_t ucs;
|
|
|
} _sapp_x11_keysymtab[] = {
|
|
|
- { 0x01a1, 0x0104 },
|
|
|
- { 0x01a2, 0x02d8 },
|
|
|
- { 0x01a3, 0x0141 },
|
|
|
- { 0x01a5, 0x013d },
|
|
|
- { 0x01a6, 0x015a },
|
|
|
+ { 0x01a1, 0x0104 },
|
|
|
+ { 0x01a2, 0x02d8 },
|
|
|
+ { 0x01a3, 0x0141 },
|
|
|
+ { 0x01a5, 0x013d },
|
|
|
+ { 0x01a6, 0x015a },
|
|
|
{ 0x01a9, 0x0160 },
|
|
|
- { 0x01aa, 0x015e },
|
|
|
- { 0x01ab, 0x0164 },
|
|
|
- { 0x01ac, 0x0179 },
|
|
|
- { 0x01ae, 0x017d },
|
|
|
- { 0x01af, 0x017b },
|
|
|
+ { 0x01aa, 0x015e },
|
|
|
+ { 0x01ab, 0x0164 },
|
|
|
+ { 0x01ac, 0x0179 },
|
|
|
+ { 0x01ae, 0x017d },
|
|
|
+ { 0x01af, 0x017b },
|
|
|
{ 0x01b1, 0x0105 },
|
|
|
- { 0x01b2, 0x02db },
|
|
|
+ { 0x01b2, 0x02db },
|
|
|
{ 0x01b3, 0x0142 },
|
|
|
{ 0x01b5, 0x013e },
|
|
|
{ 0x01b6, 0x015b },
|
|
@@ -5536,7 +5536,7 @@ _SOKOL_PRIVATE int32_t _sapp_x11_keysym_to_unicode(KeySym keysym) {
|
|
|
|
|
|
_SOKOL_PRIVATE void _sapp_x11_process_event(XEvent* event) {
|
|
|
switch (event->type) {
|
|
|
- case KeyPress:
|
|
|
+ case KeyPress:
|
|
|
{
|
|
|
const sapp_keycode key = _sapp_x11_translate_key(event->xkey.keycode);
|
|
|
const uint32_t mods = _sapp_x11_mod(event->xkey.state);
|
|
@@ -5551,7 +5551,7 @@ _SOKOL_PRIVATE void _sapp_x11_process_event(XEvent* event) {
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
- case KeyRelease:
|
|
|
+ case KeyRelease:
|
|
|
{
|
|
|
const sapp_keycode key = _sapp_x11_translate_key(event->xkey.keycode);
|
|
|
if (key != SAPP_KEYCODE_INVALID) {
|
|
@@ -5587,7 +5587,7 @@ _SOKOL_PRIVATE void _sapp_x11_process_event(XEvent* event) {
|
|
|
}
|
|
|
break;
|
|
|
case EnterNotify:
|
|
|
- _sapp_x11_mouse_event(SAPP_EVENTTYPE_MOUSE_ENTER, SAPP_MOUSEBUTTON_INVALID, _sapp_x11_mod(event->xcrossing.state));
|
|
|
+ _sapp_x11_mouse_event(SAPP_EVENTTYPE_MOUSE_ENTER, SAPP_MOUSEBUTTON_INVALID, _sapp_x11_mod(event->xcrossing.state));
|
|
|
break;
|
|
|
case LeaveNotify:
|
|
|
_sapp_x11_mouse_event(SAPP_EVENTTYPE_MOUSE_LEAVE, SAPP_MOUSEBUTTON_INVALID, _sapp_x11_mod(event->xcrossing.state));
|
|
@@ -5650,7 +5650,7 @@ int main(int argc, char* argv[]) {
|
|
|
_sapp_x11_screen = DefaultScreen(_sapp_x11_display);
|
|
|
_sapp_x11_root = DefaultRootWindow(_sapp_x11_display);
|
|
|
_sapp_x11_query_system_dpi();
|
|
|
- _sapp.dpi_scale = _sapp_x11_dpi / 96.0f;
|
|
|
+ _sapp.dpi_scale = _sapp_x11_dpi / 96.0f;
|
|
|
_sapp_x11_init_extensions();
|
|
|
_sapp_glx_init();
|
|
|
Visual* visual = 0;
|