Commit graph

74 commits

Author SHA1 Message Date
Olivier Goffart
e00491811b Get rid of the context in properties/signal 2020-07-13 18:49:06 +02:00
Simon Hausmann
1f7ae1b318 Rename PathElements to PathData
as it can now consists of elements or events.
2020-07-10 13:01:05 +02:00
Olivier Goffart
055a3baf90 Remove the binding when the animation on value is finished. 2020-07-02 17:28:04 +02:00
Olivier Goffart
9d852f802e Property refactoring
The tests are working and everything seems to be back normal.
But there is still some cleanup required
2020-07-02 14:14:49 +02:00
Simon Hausmann
4e22c2839e Add the rendering primitives for rendering a path
Right now the path is limited to polygons (only LineTo elements) and only the fill color can be specified.
2020-07-01 14:58:09 +02:00
Simon Hausmann
e4ab64f858 Add a SharedArray type
This is based on the SharedString code and will allow sharing ownership
of arrays between Rust and C++.
2020-07-01 14:58:09 +02:00
Simon Hausmann
f7517f403c Make the color a valid property type
This replaces Property<u32> with Property<Color>
2020-06-26 21:46:37 +02:00
Olivier Goffart
caca0d0ba4 Put the component in a Pin<>
Removed the drop and create from the ComponentVTable:
since we are not using VBox<ComponentVTable>, this simplifies a bit
the code of the interpreter and everything else.

But there is still a lot of changes everywhere to support that the Component
is pinned.
This is just for the component. Which would be required if later we want
to access the properties as Pin<Property<_>>. But we have not yet ability
to do projections
2020-06-24 14:13:27 +02:00
Simon Hausmann
8f613685ba Expose a ComponentWindow in C++
This paves a way for a more modular API.
2020-06-17 19:15:18 +02:00
Simon Hausmann
85bf8a195a Improve EventLoop encapsulation
Hide the winit loop and extract it only in the GL renderer
2020-06-17 15:16:46 +02:00
Simon Hausmann
e1455ff4ce Move fn eventloop::run into the eventloop::EventLoop impl 2020-06-17 10:18:36 +02:00
Simon Hausmann
5711f25195 Newtype'ify the event loop
That way it'll be easier to introduce a user event later and control the
public API.
2020-06-17 10:15:03 +02:00
Simon Hausmann
2b95b344d8 Further cleanups
Move the GraphicsWindow into graphics.rs -- there's not much in that
file otherwise ;-) and now lib.rs is concise again.
2020-06-16 16:38:37 +02:00
Simon Hausmann
4922364c46 Cleanup: move the event loop code into a separate module 2020-06-16 16:26:52 +02:00
Simon Hausmann
405de0b0ca Further separation between window and the event loop
Make it possible to create the window without an event loop and allow mapping
the window later.
2020-06-16 16:09:52 +02:00
Simon Hausmann
cb0aeb0db7 Minor GenericWindow trait cleanup
The trait functions don't need to consume an Rc, it turns out.
2020-06-16 14:42:13 +02:00
Simon Hausmann
8d7395099c More main window cleanups
Fold the standalone functions of rendering and input event processing into the
generic window trait impl
2020-06-16 14:03:57 +02:00
Simon Hausmann
2fba097e81 Clean up window registration
Automatically register the weak ref in the "constructor" of the main
window and de-register on drop.
2020-06-16 13:33:16 +02:00
Simon Hausmann
0e0ace8591 Separate window from the event loop
Remove the window parameter from the run_event_loop function. Instead
the windows are kept in a global hash map, keyed and retrieved by window
id.
2020-06-16 13:06:56 +02:00
Simon Hausmann
0dd1d953aa Prepare for cleaner separation between window and event loop, part 5
Make the main window a reference counted type. That'll allow keeping
track of all windows safely in the future.
2020-06-16 13:04:43 +02:00
Simon Hausmann
3451048842 Prepare for cleaner separation between window and event loop, part 4
Make run_event_loop operate on a GenericWindow trait. It's still an impl
right now (so static dispatch), but that's just cosmetic.
2020-06-16 11:34:21 +02:00
Simon Hausmann
d3c6ae5c81 Prepare for cleaner separation between window and event loop, part 3
Make run_event_loop a standalone function that takes a mainwindow
parameter. This is in preparation for running with multiple windows.
2020-06-16 11:06:45 +02:00
Simon Hausmann
4b1f50a452 Prepare for cleaner separation between window and event loop, part 2
Move the event loop member out of MainWindow.
2020-06-16 11:03:52 +02:00
Simon Hausmann
91e7107f9e Prepare for cleaner separation between window and event loop, part 1
Move the rendering preparation, actual rendering and input processing
callbacks into standalone functions. They don't
really need to be variable parameters.
2020-06-16 11:03:49 +02:00
Simon Hausmann
0aa4d85c92 Start with data structures for animations, with a duration and basic controls 2020-06-15 18:02:23 +02:00
Olivier Goffart
e9b75d30b7 Add a bunch of deny(unsafe_code) 2020-06-12 21:04:27 +02:00
Olivier Goffart
95f63795d5 Gate the corelib::rtti module on the rtti feature 2020-06-12 21:04:27 +02:00
Olivier Goffart
30b201d946 Reduce the use of unsafe in corelib and in the rust backend 2020-06-12 19:03:15 +02:00
Olivier Goffart
907bea3d3b Layout for rust 2020-06-10 19:41:24 +02:00
Olivier Goffart
96a372e45d Grid layout in the interpreter
current imploementation is just a prototype
2020-06-10 19:40:47 +02:00
Olivier Goffart
89968e0722 Add a Slice type which can be used in FFI 2020-06-10 14:23:57 +02:00
Simon Hausmann
5bae6e01a5 Prepare for the ability to embed image data
The Image's source property used to be a string. Now it is a Resource
enum, which can either be None or an absolute file path to the image on
disk. This also replaces the internal Image type.

The compiler internally resolves the img bang expression to a resource
reference, which shall remain just an absolute path. For now the target
generator passes that through, but in the future the target generator
may choose a target specific way of embedding the data and thus
generating a different Resource type in the final code (through
compile_expression in the cpp and rust generator).

The C++ binding is a bit messy as cbindgen doesn't really support
exporting enums that can be constructed on the C++ side. So instead we
use cbindgen to merely export the type internally and only use the tag
from it then. The public API is then a custom Resource type that is
meant to be binary compatible.
2020-06-09 22:54:29 +02:00
Olivier Goffart
34931e58c0 Polishing of the documentation 2020-06-08 17:57:18 +02:00
Olivier Goffart
4b7f8e2d04 Fix building of corelib for wasm
Wasm does not have the run_return function, so use the trick with
scoped_tls to have non-static functions
2020-06-08 09:22:38 +02:00
Olivier Goffart
9fc60e104f Add another way to load .60 files from a build script 2020-06-05 13:45:38 +02:00
Olivier Goffart
7b8df5ca9d Use interior mutability for the cache
So we do not need a mutable reference to the Component
2020-06-04 14:03:30 +02:00
Olivier Goffart
e4366efb67 Do not require the component to be static to show a window 2020-06-04 13:44:40 +02:00
Olivier Goffart
a883da3281 WIP: Use a macro to generate the RTTI 2020-05-30 15:01:50 +02:00
Simon Hausmann
c4dd857e0d Add an evaluation context to property evaluations
The context is not used yet or passed on to the binding closure.
2020-05-28 09:20:11 +02:00
Simon Hausmann
bcc6c6a60a Move Color and RenderingPrimitive into abi::datastructures
This paves the way to replace RenderingInfo.
2020-05-22 16:07:06 +02:00
Simon Hausmann
230870a292 Style cleanup
Remove some where clauses that leads to less verbose signatures. Also
use impl FnFoo, which is shorter as well.
2020-05-22 16:07:06 +02:00
Simon Hausmann
d48faf711f Update cached rendering data only when there are changes
This introduces a separate rendering preparation step in the main
window. As a consequence, the component becomes a parameter and the
graphicstest example can't use the main window anymore.

The decision whether a new low-level primitive needs to be created or
not is made by comparing the last RenderingPrimitive against the new
one.

On the upside, this means that property changes are now reflected in the
graphics.
2020-05-22 16:07:06 +02:00
Olivier Goffart
83d206ea39 runtime: Add a Signal class
Not very functional yet
2020-05-20 16:13:04 +02:00
Olivier Goffart
94c58dc1c4 Add an mouse handler for the TouchArea 2020-05-20 12:03:36 +02:00
Olivier Goffart
cdeb3a4312 Import of a basic property system 2020-05-19 12:47:52 +02:00
Olivier Goffart
25bf149e13 Add a shared string that can be used in properties 2020-05-18 17:09:40 +02:00
Olivier Goffart
4988fcb543 More fix to use vtable for component. All rust code compiles 2020-05-18 11:06:31 +02:00
Olivier Goffart
686f4c9591 More work on the vtable macro to adapt the Component
This does not work yet
2020-05-18 11:04:54 +02:00
Olivier Goffart
4b19818f6c WIP: port Component to vtable 2020-05-18 11:04:54 +02:00
Simon Hausmann
6110e4952d Move item rendering related code into a separate module
.. and keep less code in the central lib.rs.
2020-05-13 10:55:13 +02:00