Commit Graph

38 Commits

Author SHA1 Message Date
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 47dc052508 Minor consistency things:
- oc_window_style could be enum
- clikCount in oc_key_event to u8
- return of oc_input_key_press -> u8
- rename oc_key_pressed/released/repeated to oc_key_press/release/repeat_count to reflect meaning of return value
2023-09-14 10:47:10 +02:00
Martin Fouilleul 0e680c989b consistency: use _proc everywhere instead of _function or _callback in procedure typedefs. Also remove unused oc_live_resize_callback 2023-09-14 10:31:12 +02:00
Ilia Demianenko a5567da82c Clipboard handling 2023-09-13 16:59:26 +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
Ilia Demianenko 18dff15cf1 Support double and triple click text selection
Higher order click processing courtesy of https://devblogs.microsoft.com/oldnewthing/20041018-00/?p=37543
2023-09-09 14:57:51 +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 d9703519b9
osx vsync notification 2023-09-08 20:58:14 -07:00
Reuben Dunnington be5b6aea30
vblank notification: win32 2023-09-08 20:58:11 -07:00
Martin Fouilleul bd35b75f4b Minor API cleanup:
- Removing unused remote/host surfaces for now
- Complete canvas attributes getters
- Separate surface creation APIs accessible by host and guest
- added oc_get_matrix(), removed oc_viewport()
- oc_get_clip -> oc_clip_top, oc_get_matrix -> oc_matrix_top
2023-09-06 08:58:04 +02: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 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
Martin Fouilleul b5034d3c81 [osx] implement oc_surface_bring_to_front() and oc_surface_send_to_back() 2023-08-28 15:48:24 +02:00
Ilia Demianenko 53cf85db53 Support move/select/delete word with keyboard in textbox 2023-08-25 15:46:04 +02:00
Reuben Dunnington 1917085990 win32: initialize clock in oc_init() 2023-08-25 13:39:04 +00:00
Reuben Dunnington fad375c403
macos window title/size
* add macOS implmentation for oc_window_set_title()
* move implementation of oc_window_set_content_size() to a block that
  is guaranteed to run on the main thread
2023-08-24 11:57:41 -07: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 72209200b5
format app.h 2023-08-24 11:42:26 -07:00
Martin Fouilleul 42738195b5 Don't assume oc_scratch() is cleared at the frame boundary. Use oc_scratch_begin()/oc_scratch_end() instead 2023-08-23 16:24:13 +02:00
Martin Fouilleul edaffcb649 implement oc_window_is_minimized on macos 2023-08-23 12:16:01 +02:00
Reuben Dunnington 7b48c20c26 remove stray declaration 2023-08-22 21:32:13 +00:00
Reuben Dunnington 9ca7e82c82 flatten oc_request_quit() binding 2023-08-22 21:32:13 +00:00
Reuben Dunnington 0973e26150 expose oc_request_quit() to wasm runtime 2023-08-22 21:32:13 +00:00
Ilia Demianenko 2c07c9b665 Bring back the main modifier, get rid of _impl 2023-08-22 20:15:21 +00:00
Ilia Demianenko a6f81a1320 Use textbox shortcuts from the host platform 2023-08-22 20:15:21 +00:00
Reuben Dunnington 7755827485 ensure focus remains on main window when creating child windows 2023-08-22 20:10:57 +00:00
Martin Fouilleul 94b9cb2bbf Auto-formatting with clang-format 2023-08-19 15:52:11 +02:00
Reuben Dunnington 9a125361d6 forward sys keys to default window proc to get alt+f4 handling 2023-08-18 17:22:08 +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