Commit Graph

32 Commits

Author SHA1 Message Date
Reuben Dunnington ea74114693 windows: fix vsync logspam when window is minimized 2023-09-19 06:42:58 +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 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
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 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
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 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
Martin Fouilleul 06a7642055 Licensing and copyright information 2023-09-11 11:09:47 +02: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 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
Martin Fouilleul 565bef5896 #if guard vsync API from Orca apps 2023-09-09 15:33:59 +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 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 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 0db1589dc6 [canvas] remove degenerate point lines when encoding strokes 2023-09-01 19:40:37 +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
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
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 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
Ilia Demianenko 396d52edcd Clamp rounded rect radius 2023-08-25 13:33:49 +00:00
Reuben Dunnington b9e843f4bb
fix some crashes in metal implementation when pathCount and etlCount are 0 2023-08-24 11:33:21 -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 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 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