Commit graph

1174 commits

Author SHA1 Message Date
Olivier Goffart
81688906f7 C++ Interpreter: add API to get/set global value 2021-08-27 13:36:48 +02:00
Olivier Goffart
59e1361388 Fix compilation with C++20
Fixes #428
2021-08-20 18:49:15 +02:00
Olivier Goffart
071c1ea92f Update version number in README 2021-08-19 10:46:25 +02:00
Olivier Goffart
7c3555e280 Update the version number that shows in the documentation
It does not update the version number in the README because
these are either not part of the versionized documentation
or the demantic versioning make it work anyway
2021-08-19 09:57:13 +02:00
Olivier Goffart
c31ff31460 Update sixtyfps-cpp/README 2021-08-18 15:02:08 +02:00
Simon Hausmann
bcb200c547 Add an example for invoke_from_event_loop in C++
This way we can link from it from the blog and it looks maybe as good as in Rust :)
2021-08-18 10:12:34 +02:00
Tobias Hunger
09e272abb6 Janitor: Fix clippy::useless_conversion 2021-08-18 00:24:51 +02:00
Tobias Hunger
aea4ecca99 Apply pre-commit hooks to all files 2021-08-17 22:38:16 +02:00
Olivier Goffart
a39dd6ac4f Interpreter API: preserve the dashes and underscore when listing properties 2021-08-17 18:47:41 +02:00
Olivier Goffart
a094ce7a2a Add a warning on the internal crates documentation that we don't follow semver 2021-08-16 18:26:33 +02:00
Simon Hausmann
a752c798b8 Changed C++'s SharedVector::clear() to not preserve capacity when shared 2021-08-12 13:41:08 +02:00
Simon Hausmann
511027dad0 Implement SharedVector::clear() for C++ 2021-08-12 13:41:08 +02:00
Olivier Goffart
7cc13d78c3 C++ Make the stron_ref and weak_ref of VRc atomic
To match the equivalent in rust
2021-08-12 12:59:50 +02:00
Olivier Goffart
9b869f2dc0 C++ Add a few asserts that the non-thread safe API is not called in a thread 2021-08-12 12:59:50 +02:00
Olivier Goffart
0dbb2a7758 Fix nodejs CI
replaceAll was added in node 15, but the CI still runs node 12
2021-08-10 22:21:01 +02:00
Olivier Goffart
532827b646 Fix the C++ interpreter API compatibility after the change from _ to -
Property name with _ should still be supported by set_property/get_property
2021-08-10 22:21:01 +02:00
Olivier Goffart
c25538c982 Normalize identifiers to - instead of _
As a result
 - The error messages will now show the error with `-` instead of `_`
 - The LSP will auto-complete with -
 - The interpreter's list of properties will list the property with '-'
   (but we made the change so that set_property, get_property, and so on
   work also if passed a '-')
2021-08-10 22:21:01 +02:00
Simon Hausmann
1fca971fa8 Rename RGB(A)8Pixel to Rgb(a)8Pixel
That's consistent casing with RgbaColor.
2021-08-10 15:56:01 +02:00
Simon Hausmann
6016007c6f Avoid the need for SharedPixelBuffer users to depend on rgb
Re-export the two typical pixel types, for convenience. Of course other
types can be used, too, if the user depends on rgb directly.
2021-08-10 15:56:01 +02:00
Simon Hausmann
f25f85844d Remove SharedImageBuffer from the public Rust API
and instead fold the constructor functions into Image as `new_rgb8`/`new_rgba8` and `new_rgba8_premultiplied`.
2021-08-10 15:56:01 +02:00
Simon Hausmann
8a3a68a4fa Add API to Rust sixtyfps::Image to enable creation from user supplied image buffers
This adds an ImageBuffer and PixelBuffer type for SharedVector
backed images. The documentation explains how to use this
with low-level rendering functions and the popular image crate.

Fixes #387
2021-08-10 15:56:01 +02:00
ogoffart
53f286258c Bump version number to 0.1.1 2021-08-10 08:06:20 +00:00
Olivier Goffart
74c00b1cec Add a github action to bump version numbers 2021-08-10 09:03:29 +02:00
Tobias Hunger
87df173d17 Janitor: Fix clippy::explicit_counter_loop 2021-08-09 13:19:34 +02:00
Olivier Goffart
23e3c68357 Online editor: ability to select the style 2021-08-07 12:49:53 +02:00
Tobias Hunger
4c7ecc57d8 Janitor: Fix clippy::or_fun_call 2021-08-04 22:50:35 +02:00
Tobias Hunger
04738a900f Janitor: Fix clippy::map_clone 2021-08-04 22:50:35 +02:00
Tobias Hunger
2606d6d9e7 Janitor: Fix clippy::clone_on_copy 2021-08-04 22:50:35 +02:00
Tobias Hunger
46edbd0410 Janitor: Fix clippy::useless_format 2021-08-04 22:50:35 +02:00
Tobias Hunger
ce976a1dbb Janitor: Fix clippy::useless_conversion 2021-08-04 22:50:35 +02:00
Tobias Hunger
24a2021226 Janitor: Fix clippy::needless_borrow 2021-08-04 22:50:35 +02:00
Tobias Hunger
3c9451f94c Janitor: Fix clippy::needless_question_mark 2021-08-04 22:50:35 +02:00
Olivier Goffart
603c5df47a Building the doc no longer need nightly rust
Rust 1.54 has the feature that allow us to include markdown files
in the docs
2021-08-03 16:27:31 +02:00
Simon Hausmann
661f23760b Fix build: Add missing non-const arrow/deref operators for VRc/Component 2021-08-03 10:32:04 +02:00
Simon Hausmann
e97ecea480 Fix constness in generated C++ API
run(), show() and hide() should not be const, as well as the window() accessor.
2021-08-03 10:32:04 +02:00
Simon Hausmann
9e4b067f38 Provide sixtyfps::Window by reference in the C++ interpreter API 2021-08-03 10:32:04 +02:00
Simon Hausmann
341387c8d0 Provide sixtyfps::Window by reference in the generated C++ API 2021-08-03 10:32:04 +02:00
Simon Hausmann
29f5853332 Provide sixtyfps::Window by reference in the Rust API
This also removes Clone from the Window again, to avoid having to face
the question: Does cloning a window duplicate it on the screen?
2021-08-03 10:32:04 +02:00
Simon Hausmann
23da97bc75 minor cleanup
Rename window_ to window_rc for the private window member in the generated C++ struct.
2021-08-03 10:32:04 +02:00
Simon Hausmann
66891a299c Start a new sixtyfps::Window API for Rust, C++, the interpreters and JS
The generated component now provides access to a Window type
via the window() accessor function.

This is part of #333
2021-08-03 10:32:04 +02:00
Simon Hausmann
cb76186b59 Remove stray line 2021-08-01 09:34:36 +02:00
Simon Hausmann
52aee8d366 Another minor reduction in generated code
Further build on b3529d1b75 and move the
strong/weak reference dance into the API crate out of the generated
code.

Saves ~21k llvm lines on the printer demo (debug).

It's also possible to move the as_pin_ref() bit, but that didn't
really give any savings overall.
2021-08-01 09:34:36 +02:00
Simon Hausmann
b3529d1b75 Rust: Speed up compilation times of generated code
The binding setup functions (set_binding, set_animated_binding, etc.)
are taking the binding basically as an `impl Fn() -> T`, which means
each call site creates a new copy. The bodies of these can be quite big.
Since most of our uses follow the pattern of just capturing the
samereduce the number of copies needed parameter, we can reduce the
number of copies needed by providing wrappers.

With rustc 1.54.0 on my mbp and debug, the build time of

    touch ../ui/printerdemo.60
    cargo rustc

goes from 1m:15s down to 42s, and total llvm lines goes from
2079842 down to 1134237.
2021-07-30 09:22:20 +02:00
Olivier Goffart
f38ce3c090 Fix the tests 2021-07-29 18:25:23 +02:00
Olivier Goffart
188806ef89 An empty sixtyfps! macro should compile 2021-07-29 17:50:57 +02:00
Olivier Goffart
c11d880424 Rerun the build scripts that compile .60 if the default style might have changed 2021-07-28 16:57:09 +02:00
Olivier Goffart
43e07320a5 Fix comments and naming found in review in #355 2021-07-28 16:57:09 +02:00
Olivier Goffart
7821926002 Rust: defaults to the native style when Qt is available
This requires some gymnastics to get right as the information
need to be passed to the compiler despite having no direct dependency
between the compiler and the runtime or backends.
So use a file in the build directory to tell the default style

cc: #83
2021-07-28 16:57:09 +02:00
Olivier Goffart
9ffcd34d1b Test for angle in the C++ interpreter API 2021-07-26 17:36:02 +02:00
Olivier Goffart
fae6e0b52d Document that angles are represented in degrees at run-time 2021-07-26 17:36:02 +02:00