aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--bindgen/gen_zig.py4
-rw-r--r--sokol_app.h18
-rw-r--r--sokol_fetch.h10
4 files changed, 21 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c60b1bb..fd78a299 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,6 @@
## Updates
-- **21-Jul-2021**: A new utility header sokol_color.h has been added, which adds
+- **21-Jun-2021**: A new utility header sokol_color.h has been added, which adds
sokol_gfx.h-compatible named color constants and a handful initial utility
functions. See the [header documentation](https://github.com/floooh/sokol/blob/master/util/sokol_color.h)
for details. Many thanks to Stuart Adams (@nyalloc) for contributing the header!
diff --git a/bindgen/gen_zig.py b/bindgen/gen_zig.py
index 0a979580..00d1f6b3 100644
--- a/bindgen/gen_zig.py
+++ b/bindgen/gen_zig.py
@@ -431,7 +431,7 @@ def gen_consts(decl, prefix):
l(f"pub const {as_snake_case(item['name'], prefix)} = {item['value']};")
def gen_enum(decl, prefix):
- l(f"pub const {as_zig_enum_type(decl['name'], prefix)} = extern enum(i32) {{")
+ l(f"pub const {as_zig_enum_type(decl['name'], prefix)} = enum(i32) {{")
for item in decl['items']:
item_name = as_enum_item_name(item['name'])
if item_name != "FORCE_U32":
@@ -515,11 +515,13 @@ def gen_helpers(inp):
l('pub const Writer = struct {')
l(' pub const Error = error { };')
l(' pub fn writeAll(self: Writer, bytes: []const u8) Error!void {')
+ l(' _ = self;')
l(' for (bytes) |byte| {')
l(' putc(byte);')
l(' }')
l(' }')
l(' pub fn writeByteNTimes(self: Writer, byte: u8, n: u64) Error!void {')
+ l(' _ = self;')
l(' var i: u64 = 0;')
l(' while (i < n): (i += 1) {')
l(' putc(byte);')
diff --git a/sokol_app.h b/sokol_app.h
index 2e635a52..b695b1c3 100644
--- a/sokol_app.h
+++ b/sokol_app.h
@@ -5905,18 +5905,18 @@ _SOKOL_PRIVATE bool _sapp_win32_update_dimensions(void) {
if (GetClientRect(_sapp.win32.hwnd, &rect)) {
_sapp.window_width = (int)((float)(rect.right - rect.left) / _sapp.win32.dpi.window_scale);
_sapp.window_height = (int)((float)(rect.bottom - rect.top) / _sapp.win32.dpi.window_scale);
- const int fb_width = (int)((float)_sapp.window_width * _sapp.win32.dpi.content_scale);
- const int fb_height = (int)((float)_sapp.window_height * _sapp.win32.dpi.content_scale);
+ int fb_width = (int)((float)_sapp.window_width * _sapp.win32.dpi.content_scale);
+ int fb_height = (int)((float)_sapp.window_height * _sapp.win32.dpi.content_scale);
+ /* prevent a framebuffer size of 0 when window is minimized */
+ if (0 == fb_width) {
+ fb_width = 1;
+ }
+ if (0 == fb_height) {
+ fb_height = 1;
+ }
if ((fb_width != _sapp.framebuffer_width) || (fb_height != _sapp.framebuffer_height)) {
_sapp.framebuffer_width = fb_width;
_sapp.framebuffer_height = fb_height;
- /* prevent a framebuffer size of 0 when window is minimized */
- if (_sapp.framebuffer_width == 0) {
- _sapp.framebuffer_width = 1;
- }
- if (_sapp.framebuffer_height == 0) {
- _sapp.framebuffer_height = 1;
- }
return true;
}
}
diff --git a/sokol_fetch.h b/sokol_fetch.h
index a8c76315..9ff62d3d 100644
--- a/sokol_fetch.h
+++ b/sokol_fetch.h
@@ -118,9 +118,15 @@
}
}
- (4) finally, call sfetch_shutdown() at the end of the application:
+ (4) pump the sokol-fetch message queues, and invoke response callbacks
+ by calling:
- sfetch_shutdown()
+ sfetch_dowork();
+
+ In an event-driven app this should be called in the event loop. If you
+ use sokol-app this would be in your frame_cb function.
+
+ (5) finally, call sfetch_shutdown() at the end of the application:
There's many other loading-scenarios, for instance one doesn't have to
provide a buffer upfront, this can also happen in the response callback.