Commit graph

259 commits

Author SHA1 Message Date
Simon Hausmann
727c9a19f7 Add basic text item support
This needs more work, but gets something onto the screen at least.
2021-01-14 08:53:13 +01:00
Olivier Goffart
9050c29305 Don't use the window through the eventloop module 2021-01-14 08:53:13 +01:00
Olivier Goffart
16f5a03c14 Run cargo fmt 2020-12-18 10:29:15 +01:00
Olivier Goffart
dfa25b96f7 Rename SharedArray to SharedVector 2020-12-18 10:26:07 +01:00
Olivier Goffart
0d2d48be4f Rename "signal" to "callback" 2020-12-18 09:51:01 +01:00
Olivier Goffart
63a0d9308b Bump version 2020-12-14 08:49:54 +01:00
Simon Hausmann
87e0cc7d85 Fix resource embedding doing a wasm build of a project using the sixtyfps! macro
We need to embed resources in wasm builds. Unfortunately we can't detect
that we're called by say wasm-pack and "TARGET"/"HOST" only works inside
build.rs. So instead, to keep things simple, this change always embeds
the image resources when targeting Rust.

The `SIXTYFPS_EMBED_RESOURCES` environment variable can be used to
override this anywhere for any language.

Fixes #130
2020-12-10 15:09:32 +01:00
Simon Hausmann
624113b0a2 Change the sixtyfps_build compiler configuration API
Don't expose the internal type but create a public wrapper with the
builder pattern. That makes it easier to change defaults and it hides
internals like the callback futures.
2020-12-10 14:22:14 +01:00
Simon Hausmann
c72c2a58ff Fix Rust docs about generated API 2020-12-09 16:48:02 +01:00
Olivier Goffart
77dc3a2ca9 Update the version in the README and doc as we prepare the release 2020-12-09 15:34:41 +01:00
Olivier Goffart
125ec13f24 Bump version numbers
Note: this does not update the documentation yet
2020-12-07 15:41:29 +01:00
Olivier Goffart
9d2d3e43eb Update rystc_version 2020-12-07 11:37:47 +01:00
Simon Hausmann
26cb05724e Implement Clone for sixtyfps::Weak 2020-12-03 14:41:25 +01:00
Simon Hausmann
23d54b1b89 Improve similarity of testing APIs between C++ and Rust
Let send_mouse_click also take a component reference, like in C++.
2020-12-03 13:35:10 +01:00
Simon Hausmann
4670854500 Remove as_ref from the public API of the generated Rust component
This was only needed in our tests.
2020-12-03 13:31:58 +01:00
Simon Hausmann
47152eee89 Remove the sixtyfps::Component trait
It is not needed anymore
2020-12-03 09:16:20 +01:00
Simon Hausmann
83191c82cc Remove ComponentHandle and ComponentWeakHandle 2020-12-03 08:13:40 +01:00
Simon Hausmann
4f412dcde4 Fix up the docs of the sample component for the new wrapping API 2020-12-03 08:13:40 +01:00
Simon Hausmann
7047856d4e Replace FooRc with Foo and without ComponentHandle in examples and tests 2020-12-03 08:13:24 +01:00
Simon Hausmann
dd64226dc1 Implement sixtyfps::Weak
This is the counter-part to the strongly referencing type the compiler
generates for components.
2020-12-03 08:13:15 +01:00
Simon Hausmann
ff1d752bc6 First step towards a wrapping public component API without ComponentHandle
For now the compiler also generates FooRc next to Foo, which wraps a
strong reference (VRc) to Foo.

This is an intermediate step and at the end of the series FooRc should
replace Foo and sixtyfps::ComponentHandle.
2020-12-03 08:13:15 +01:00
Olivier Goffart
8b10414451 Parse signal return type
(currently does nothing with it)
2020-12-01 18:47:49 +01:00
Olivier Goffart
2d016dffda Print the diagnostics in stderr for files which do not have span information 2020-12-01 12:10:43 +01:00
Olivier Goffart
19458eb2e6 sixtyfps-macro: recompile when the style changes 2020-12-01 12:10:43 +01:00
Simon Hausmann
2472eb51f0 Add the plaster font to plaster theme of the slide puzzle
For regular builds this is done by adding Rust API that allows
registering a font, and for the web the font is installed into the
browser using JavaScript API.

This is an initial approach to just add this ability. It might make
sense to introduce a syntax in the `.60` file to allow for the
registration of fonts and letting the compiler generate code that
performs this embedding and registration automatically.
2020-11-27 14:29:56 +01:00
Olivier Goffart
8a64f10e84 Remove ComponentVtable::input_event
And the custom handling of the mouse grabber
2020-11-24 16:23:37 +01:00
Simon Hausmann
fa95064363 Fix resource embedding across component boundaries
When referencing an image a repeated element and were targeting a
configuration that requires resource embedding, then that image would
not embedded.

This was due to the fact that we didn't recurse into sub-components in
the resource collection phase and the generators made a per-component
embedding decision. The field responsible for that was also not
propagated to sub-components.

This patch addresses these two bugs by cleaning up the entire mechanism:

The compiler first generates the new ResourceReference::AbsolutePath for
all img!"foo.png" expressions. If the compiler is configured to embed
resources, then the embed_resources pass will traverse all
sub-components and expressions in them to change them to
ResourceReference::EmbeddedData with a unique integer id. Simultaenously
all the resources to be embedded get also collected in the root
component, so that the build script as well as the generator can take
care of dependency handling and actual resource embedding.
2020-11-23 13:47:16 +01:00
Olivier Goffart
2e60afec39 Run cargo fmt 2020-11-23 12:08:23 +01:00
Olivier Goffart
596b740b62 Rename ARGBColor to RgbaColor 2020-11-23 11:47:47 +01:00
Olivier Goffart
20b4d8826b Make the extra documentation page a bit more visible 2020-11-23 10:55:05 +01:00
Olivier Goffart
32f23f4c3e Add semi colon on the docs.
The run statement returns `()` so it is easier to copy/paste it if it has the semicolon
2020-11-23 10:31:34 +01:00
Simon Hausmann
89e0b57627 Rework and simplify the focus handling
Instead of determining the focus item through item tree traversal and
pointer comparison and storing the intermediate indices in the
components in the tree, remember the focus item by a pair of
VWeak<ComponentVTable, Dyn> and item_index: usize.

This speeds up determining the focus item as well as delivering events,
which can now be done directly after retrieving an ItemRef with
get_item_ref.

This also fixes the duplicate line edit focus in the 7gui cells
test case.
2020-11-20 15:33:15 +01:00
Olivier Goffart
cfa9413861 More work on the state binding for transition:
When there is a transition, turn the state property into a property of StateInfo

Not yet implemented for C++
2020-11-19 12:43:28 +01:00
Olivier Goffart
8b76114083 Recompile if a dependencies changes 2020-11-18 13:23:59 +01:00
Olivier Goffart
0672f4b3cd Expose Timer API to rust API
And use it in the puzzle demo to implement the auto play mode
2020-11-16 12:17:02 +01:00
Simon Hausmann
a2dadf8fe8 Remove the component parameter from GenericWindow::process_key_input 2020-11-11 19:16:26 +01:00
Olivier Goffart
503567d84c Update the documentation after the changes to ComponentHandle 2020-11-09 15:08:08 +01:00
Olivier Goffart
a1f1fcb3a6 Use VRc<ComponentVTable> in the rust generated code 2020-11-09 14:58:37 +01:00
Olivier Goffart
2ece3817cc Make ModelHandle a struct
Last commit broke for structures containing models, because models are not PartialEq.
So we need to implement PartialEq for ModelHandle. Which means a struct needs to
be created
2020-10-31 13:32:19 +01:00
Olivier Goffart
359f42c5f7 Prepare the compiler to be async
This will allow the online editor to load imports from URL asynchroniously later

Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
2020-10-30 15:00:04 +01:00
Olivier Goffart
263df7dc63 Remove the www from all sixtyfps.io URL 2020-10-29 11:06:06 +01:00
Olivier Goffart
d3801e26d3 Change the syntax of structures to require the struct keyword 2020-10-27 16:09:05 +01:00
Olivier Goffart
aeade826fe New runtime implementation for the box layout
Currently only horizontal layout is supported
2020-10-26 14:19:12 +01:00
Olivier Goffart
76b7f1aef6 Allow dashes in identifier
Currenly, dashes are normalized to '_'.
Dashes are not allowed at the begining of an identifier.
If an identifier with a dash is not found, we also look for identifier
without a dash and if that exist, we hint the user to use spaces.

Issue #52
2020-10-22 18:32:25 +02:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Olivier Goffart
c50b9d73d3 Document the generated C++ code 2020-10-21 11:29:25 +02:00
Olivier Goffart
45e8c94535 Some more documentation for the rust backend 2020-10-21 10:35:42 +02:00
Simon Hausmann
0c8fcb5f7a Some edits to the type mappings section of the node docs
Also use a consistent section title throughout.
2020-10-21 09:44:21 +02:00
Simon Hausmann
4f4d2b10e9 Add missing license tag 2020-10-20 18:18:24 +02:00
Simon Hausmann
e0e7aa1a91 Small typo fix
Missing letter :)
2020-10-20 18:11:01 +02:00