Commit Graph

36 Commits

Author SHA1 Message Date
Reuben Dunnington 4b30bd70d0 fix gl error spam when window is resized to 0 width/height 2023-09-19 06:37:46 +00:00
Reuben Dunnington 0d839a9767
call oc_on_mouse_wheel() when getting a wheel event 2023-09-18 19:17:31 -07:00
Martin Fouilleul 116e614ab6 Keep log format as "function() in file:line: msg", but pass the arguments in consistent order between the host and guest app. 2023-09-18 10:19:13 +00:00
Martin Fouilleul 09cf30cf45 Consistency/intent
- pass arenas as first parameters (exception being texbox widget, where we always pass tag as first parameter)
- pass lists by value when there's no modification (eg oc_list_for etc...)
- fix sketches, use oc_arena_scope as value.
2023-09-14 11:54:38 +02:00
Martin Fouilleul 8cd571f923 Remove oc_scratch()/oc_scratch_next() in favour of safer oc_scratch_begin()/oc_scratch_end() 2023-09-13 18:10:47 +02:00
Ilia Demianenko a5567da82c Clipboard handling 2023-09-13 16:59:26 +02:00
Martin Fouilleul 7026919b38 pass both scancode and keycode to oc_on_key_up()/oc_on_key_down() 2023-09-13 16:33:28 +02:00
Martin Fouilleul d53c688810 Keyboard layout support:
- Convey both fixed scancodes and keyboard-layout dependent keycodes in key events.
- Update scancode to keycode mapping when keyboard layout changes
- Allow querying key input state using either keycodes or scancodes
2023-09-13 16:22:33 +02:00
Martin Fouilleul b9232b796c Fix hang on quit. Closes #91 2023-09-12 09:36:32 +02:00
Martin Fouilleul 313f2e0ad4 Fix quit by sending an event to wakeup the main loop when calling oc_request_quit() 2023-09-11 18:36:40 +02:00
Martin Fouilleul 06a7642055 Licensing and copyright information 2023-09-11 11:09:47 +02:00
Martin Fouilleul e6a3ac7694 oc_render uses currently selected surface 2023-09-10 15:21:11 +02:00
Martin Fouilleul 4b2580f510 Documentation and some API cleaning
- Fleshing out Readme
- Renaming pong to breakout
- Renaming triangleGLES to triangle
- Move cheatsheets to their own directory
- Cleanup clock example to use in QuickStart
- QuickStart.md
- Some API cleaning:
    - oc_font_create_from_file()/oc_font_create_from_path()
    - oc_image_create_from_file/oc_image_create_from_path
    - oc_canvas_set_current() -> oc_canvas_select()
    - some matrix helpers
2023-09-10 12:29:40 +02:00
martinfouilleul 9aad2c0ec8 Fix debug overlay vsync on windows 2023-09-10 12:28:53 +02:00
Martin Fouilleul 5a7182a3b9 make vsync differences between win32 and macos explicit in runtime.c 2023-09-09 14:34:20 +02:00
Reuben Dunnington 6ae129022e
rework vsync to be manual wait for win32 2023-09-08 21:35:13 -07:00
Reuben Dunnington be5b6aea30
vblank notification: win32 2023-09-08 20:58:11 -07:00
Martin Fouilleul 907f33bc27 [osx] quickfix for frame pacing on osx, keep swap interval to 1 for all surfaces 2023-09-08 10:32:59 +02:00
Martin Fouilleul 8f413fdb46 fix auto-scrolling in debug UI (due to change in how oc_ui_panel() is structured) 2023-09-08 10:11:51 +02:00
Reuben Dunnington 15a8e2ae22 wasm bindings: enforce pointer length
* bindgen.py: print an error when a pointer argument doesn't have an annotated length
* ensure all bindings with pointers have length annotations
* add a couple helper functions for dealing with length annotations
2023-09-07 07:51:23 +00:00
Martin Fouilleul fbb03d27a3 Helpers for manipulating orca structs living in wasm memory:
- convert between wasm memory and native pointers, asserting on out-of-bounds
- oc_wasm_list helpers
- oc_wasm_str8 helpers
- pushing things to arenas in wasm memory
2023-09-02 18:07:57 +02:00
Martin Fouilleul 0205d90941 - Added oc_file_open_with_request() to request new file capability for a given path. This presents user with a message box allowing them to accept or deny the request.
- Added oc_file_open_with_dialog() to ask user to grant new file capabilities through an open/save dialog.
2023-09-02 11:00:28 +02:00
martinfouilleul 19ce7447aa use app->quit on main thread instead of oc_should_quit(), to ensure that runloop_thread always exits its event loop before main thread 2023-08-30 12:06:32 +02:00
martinfouilleul 46ef9ee7e8 don't hide debug overlay, paint it transparent instead, brought to you by Windows stuttering and crashing on close if you call SwapBuffer on a hidden window :*) 2023-08-29 16:14:20 +00:00
Martin Fouilleul f268f031af Set user-created surfaces to non-blocking and use the debug overlay surface to block on vsync. 2023-08-29 16:14:20 +00:00
martinfouilleul ec97c6d9ca win32 implementation of oc_surface_bring_to_front/send_to_back 2023-08-28 17:04:55 +02:00
Martin Fouilleul 02bfe30672 Expose oc_surface_bring_to_front/send_to_back() to orca apps, and always bring debug layer to front when displaying it 2023-08-28 16:11:55 +02:00
Reuben Dunnington bfd4c2a450
update oc_window_set_content_size to use oc_vec2 for consistency 2023-08-24 11:42:27 -07:00
Reuben Dunnington d4cb93c61a
oc_runtime_window_set_title and oc_runtime_window_set_size 2023-08-24 11:42:27 -07:00
Reuben Dunnington e4ac212408
wip window title and size API 2023-08-24 11:42:26 -07:00
Reuben Dunnington 0973e26150 expose oc_request_quit() to wasm runtime 2023-08-22 21:32:13 +00:00
Reuben Dunnington c27e1c6b62
don't attempt to draw when the window is minimized 2023-08-22 07:43:22 -07:00
Reuben Dunnington 464a25c55d
fixes for a couple compile errors 2023-08-21 11:50:42 -07:00
Martin Fouilleul 94b9cb2bbf Auto-formatting with clang-format 2023-08-19 15:52:11 +02:00
Martin Fouilleul 75621d85a5 Big renaming and consistency pass, including:
- "Namespacing" the Orca APIs by adding the oc_ prefix everywhere
- Naming consistency tweaks, eg create_from_memory vs. create_from_data
- Adhering to a more consistent convention when pairing functions defining entities lifetime, eg. create/destroy, push/clear, alloc/recycle, init/cleanup
- Preferring oc_str8 to const char*, except when we expect lots of C string literals (e.g. when tagging UI widgets) or when it would be annoying to systematically wrap data we want to read/write into a string
- Reorganize macros for asserts/logging, and properly exposing them to the apps with non conflicting names
- Generally rearrange some bits and pruning unused stuff to make things more navigable
2023-08-18 16:30:55 +02:00
Martin Fouilleul cf88ba6290 This commit restructures the codebase to melt the milepost platform layer into the main orca codebase.
Here's a list of commits squashed in this update:

- move angle files to ext/ and pull includes/libs from there when needed
- remove milepost/ext/angle_headers
- Collapsed milepost/ext into ext
- Collapse milepost/scripts into scripts/
- collapse milepost/resources into resources/. WARN: this temporarily breaks milepost's native examples
- collapse milepost/test into test/
- renamed test/ to tests/
- build milepost directly into build/bin
- remove unused GLES and KHR folders from sdk/
- reorganizing milepost directory tree into app, graphics, platfrom, ui, util
- collapse milepost/src to src/
- Move all native examples to sketches/ and remove milepost repo
- Moving sketches resources into their own shared folder separate from the runtime's resource folder
- Moving all binding code to src/wasmbind
- Moving all binding code to src/wasmbind
- pong: fix typo in error log
- fixing log parameter order
- add error logs to mg_image_create_*
- Fix build scripts on windows
- fixed include mistake after rebase
- collapsing milepost.{h|c|m} to orca.{h|c|m} and moving from sdk/ to src/
- rename orca_app.h/main.c to runtime.h/c
- collapsed sdk/ to src/
- put old sdk files into their respective dirs
- renamed canvas_api.json to surface_api.json
- moved all stb headers in ext/stb/
- remove unused OpenSansLatinSubset.ttf font
- moving cstdlib to src/wasmlibc and removing some duplicates with src/platform
- move libc stdarg and string functions from platform/ to wasmlibc/
- rename wasmlibc to libc-shim to reflect non-completeness
- Expose abort/assert variadic functions and macros to orca apps, and forward libc-shim abort/assert to these
- move Orca API runtime implementations to runtime_xxx
- fix missing math constants when including math.h with msvc in graphics_common.c
- Change name of runtime to orca_runtime. When bundling on Windows, change name of runtime executable to the name of the app.
2023-08-13 15:28:57 +02:00