Commit Graph

586 Commits

Author SHA1 Message Date
Ilia Demianenko 9377558993 UI demo with styling 2023-09-14 23:26:38 -07:00
Ilia Demianenko d44ac5a1fb Use color + bgColor for selected radio instead of bgColor + borderColor 2023-09-13 14:02:50 -07:00
Ilia Demianenko 82aefaf758 Radio button group 2023-09-13 14:02:50 -07: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
Martin Fouilleul a0f9ab5f85 Allow building apps in C++ mode 2023-09-13 15:18:15 +00:00
Martin Fouilleul 0f3f7b5052 oc_runtime_clipboard_get_string() pushes to an arena, so to maintain oc_str8 conventions, we push an implicit null terminator after it 2023-09-13 17:05:15 +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 a1ffcd3ddc [ui] macOS text edit shortcuts 2023-09-13 16:25:18 +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 db36158e7a check return pointer sizes in binding stubs 2023-09-12 17:06:01 +02:00
Martin Fouilleul d90c11db58 Save return pointer before calling native function in binding stubs 2023-09-12 15:03:56 +02:00
Martin Fouilleul b9232b796c Fix hang on quit. Closes #91 2023-09-12 09:36:32 +02:00
Martin Fouilleul ce752713f6 oc_matrix_push() -> oc_matrix_multiply_push(), and add oc_matrix_push() to push a matrix on the stack as is 2023-09-11 20:02:46 +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
martinfouilleul ab4abd28d7 Fix broken build on MSVC due to size_t being considered equivalent to u64 in _Generic associations 2023-09-11 18:09:47 +02:00
Martin Fouilleul 3e2f550b68 switch order of designated enums in strings, to make it easier to compile in c++ mode 2023-09-11 14:15:35 +02:00
Martin Fouilleul dc837a6a6d change len of strings to size_t 2023-09-11 12:53:15 +02:00
Martin Fouilleul 8d346eca90 flip order of len and ptr in oc_str8/16/32 structs, to make bindings easier 2023-09-11 12:53:15 +02:00
Ilia Demianenko afbb4329f5 Fix scrolling 2023-09-11 09:43:58 +00:00
Martin Fouilleul 06a7642055 Licensing and copyright information 2023-09-11 11:09:47 +02:00
Ilia Demianenko bb39bc7a13 Make arrow keys always move the cursor to the edge of the selection first 2023-09-11 09:08:47 +00:00
Ben Visness 748617d9b0 Remove unnecessary hr 2023-09-10 16:55:18 -05:00
Ben Visness 5394e8f301 Update README 2023-09-10 16:46:32 -05:00
Martin Fouilleul 5cdded57b3 Replace confusing oc_text_bounding_box() with oc_font_text_metrics(), which returns both the logical metrics and ink bounding box of text 2023-09-10 19:25:41 +02:00
Martin Fouilleul e6a3ac7694 oc_render uses currently selected surface 2023-09-10 15:21:11 +02:00
Martin Fouilleul b223abcd5b add current features to Readme 2023-09-10 15:00:58 +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 565bef5896 #if guard vsync API from Orca apps 2023-09-09 15:33:59 +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 aa1c5ef915
cleanup dead code 2023-09-08 20:58:14 -07:00
Reuben Dunnington be5b6aea30
vblank notification: win32 2023-09-08 20:58:11 -07:00
Martin Fouilleul 8fbfeab261 fix clock sample oc_runtime_window_set_size() -> oc_window_set_size() 2023-09-08 15:04:40 +02:00
Ilia Demianenko 3bcbc76662 Make tooltip disappear on mouse leave 2023-09-08 14:35:42 +02:00
Ilia Demianenko b4797dcd2d Light UI theme 2023-09-08 12:22:03 +00: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
martinfouilleul 3effde949e Fix file date on windows 2023-09-08 10:18:22 +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
Martin Fouilleul a275b3da28 adding file timestamps to file_status 2023-09-07 10:09:26 +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
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