Commit Graph

542 Commits

Author SHA1 Message Date
MartinFouilleul 9b3a71a5c8 Merge pull request 'Make UI look nicer' (#80) from ilidemi/orca:ui-redesign into main
Reviewed-on: #80
2023-09-07 07:42:23 +00:00
Ilia Demianenko 15bc29d703 Merge branch 'main' of git.handmade.network:hmn/orca into ui-redesign 2023-09-06 22:31:03 -07:00
Ilia Demianenko aff03630da Make UI look nicer
Design system by semi.design: https://semi.design/en-US/start/overview

SVG icon workflow:
- Find the SVG with devtools
- Copy curve path to https://yqnn.github.io/svg-path-editor/
- Scale X and Y by 1/size (usually 1/24)
- In `ui.c`, do offset and scale with a matrix transform, then the draw commands can use the exact numbers from the normalized SVG
2023-09-06 22:24:00 -07:00
Martin Fouilleul 425d9b3448 - Added basic cheatsheets
- Minor cleanups:
    - Hiding some native-only path APIs
    - Re-formatting ui.h
2023-09-06 08:58:43 +02: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
Martin Fouilleul 0db1589dc6 [canvas] remove degenerate point lines when encoding strokes 2023-09-01 19:40:37 +02:00
Martin Fouilleul fe25476305 remove stale comments in samples 2023-08-30 15:35: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
Martin Fouilleul 1907663cdc Skip drawing ui box when it's rect + boders are fully outside current clip 2023-08-29 18:43:25 +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
Martin Fouilleul 07414af087 [mtl canvas] Fix nTilesX/nTilesY computation in oc_mtl_canvas_render (don't multiply twice by scale) 2023-08-29 18:13:01 +02:00
Martin Fouilleul 9164e66cc6 [mtl canvas] fixed bug were order of mtl_segment_setup arguments tileOpMax and segmentMax were interverted, which would cull tile ops based on max number of segments, causing weird artifacts for some lengths of the segment buffer 2023-08-29 17:36:30 +02:00
martinfouilleul d86d0f8074 replace cp with copy in sketches build.bat scripts 2023-08-29 07:56:28 +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
Martin Fouilleul b5034d3c81 [osx] implement oc_surface_bring_to_front() and oc_surface_send_to_back() 2023-08-28 15:48:24 +02:00
Reuben Dunnington 416044ea76 Makes sketches compile and run with changes introduced by renaming pass.
This is a combination of 19 commits:

- fix atlas
- fix canvas
- fix image
- add OpenSansLatinSubset to resources
- fix multi_surface
- fix perf_text
- fix polygon
- fix render_thread
- fix simpleWindow
- fix smooth_resize
- fix surface_sharing
- fixed tiger
- fix triangleGL
- fix triangleGLES (note rendering doesn't work)
- fix ui
- fix all on osx
- Fix sketch triangleGLES
- Make transparent rectangle clearer in sketches polygon
- Add proper error message in sketch/triangleGL on macOS
2023-08-28 12:37:33 +02:00
Reuben Dunnington ceb4a3a95d [osx canvas] Early out when eltCount or pathCount == 0, which avoid encoding empty passes and firing metal asserts when running in debug mode from xcode. 2023-08-28 12:16:31 +02:00
Martin Fouilleul 4b1ab4db97 expose oc_surface_contents_scaling() to get dpi scaling from a surface 2023-08-28 12:10:29 +02:00
MartinFouilleul 0727466f48 Merge pull request 'Support move/select/delete word with keyboard in textbox' (#63) from ilidemi/orca:text-box-words into main
Reviewed-on: #63
2023-08-25 13:50:14 +00:00
Ilia Demianenko 3c199dce34 minor 2023-08-25 15:46:11 +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
Ilia Demianenko 396d52edcd Clamp rounded rect radius 2023-08-25 13:33:49 +00:00
MartinFouilleul 5c89f1d103 Merge pull request 'window_size_title_api' (#61) from window_size_title_api into main
Reviewed-on: #61
2023-08-25 13:29:27 +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 9ed636e018
update samples for oc_window_set_content_size oc_vec2 change 2023-08-24 11:42:28 -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 81712c14c1
update samples with title/window size 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
Reuben Dunnington b9e843f4bb
fix some crashes in metal implementation when pathCount and etlCount are 0 2023-08-24 11:33:21 -07:00
MartinFouilleul d3e27df818 Merge pull request 'Fix leak in canvas code and samples' (#60) from fix_canvas_leak into main
Reviewed-on: #60
2023-08-23 14:33:22 +00: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 98f131cb30 Fix leak in metal surface: command buffer must not be committed if there is no surface to present it to, or it will result in a huge leak in metal resources. Also wrap oc_mtl_surface_acquire_command_buffer() in an @autoreleasepool to fix a smaller leak 2023-08-23 15:09:06 +02:00
Martin Fouilleul 86b1121fbe allow enabling/disabling metal frame capture when bundling a macos app 2023-08-23 15:06:35 +02:00
Martin Fouilleul 232c5f4f4c Fix exec permission on samples/clock/build.sh 2023-08-23 12:21:02 +02:00
Reuben Dunnington 4bde491a36 clock sample app 2023-08-23 12:16:32 +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 f4a82cd381 pong: demo oc_request_quit() and oc_on_terminate()
* gamestate now records your score (total blocks destroyed)
* when all blocks are destroyed, quit
* print a message when the app is terminated
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
Reuben Dunnington 9d1d8e5306
add win32 impl for oc_clock_time() 2023-08-22 13:42:01 -07:00
Reuben Dunnington 5a4fba96fa clang-format: use custom brace/indent style 2023-08-22 20:18:04 +00:00
Ilia Demianenko 2c07c9b665 Bring back the main modifier, get rid of _impl 2023-08-22 20:15:21 +00:00