Simon Hausmann
8675cfb183
Fix animation driver to deal with freed animations
...
Just skip over those entries.
2020-06-25 08:58:13 +02:00
Simon Hausmann
459a8e3b25
Clean up property and animation associated
...
Set up everything in the construction function of property animation
instead of constructing it and setting up stuff afterwards in Property.
2020-06-25 08:42:27 +02:00
Simon Hausmann
8be058d563
Clean up property binding interface
...
The trait functions that allowing a binding (animation) to intercept a
new value or binding is not needed anymore since the generated code is
supposed to cover all call sites and pass the appropriate animation at
that point.
2020-06-25 08:26:14 +02:00
Simon Hausmann
e7ba02c85a
Fix animation of properties by value in the Rust generator
...
Don't require an evaluation context when setting up an animated value.
We can find out what the current value is inside evaluate.
2020-06-25 08:20:37 +02:00
Simon Hausmann
3a5ebd86e0
Prepare to connect Property with PropertyAnimation
...
This patch replaces the 'install()' approach for property animations
with explicit set_animated_value() and set_animated_binding() functions
in Property -- to be called from generated code.
This requires a little dance-around for the time being that
PropertyAnimation is designed to act automatically on value transitions,
but that can be removed later without changing the interface.
Also the animation details are copied right away. This is sub-optimal,
we should somehow keep a reference to the properties or get notified
when they change, for example perhaps through a simple property binding.
2020-06-24 17:54:25 +02:00
Simon Hausmann
ab697ab71d
Parse animation declarations into the object tree
...
So
animate x { ... }
is basically a short-hand for
PropertyAnimation {
...
}
<magically associated that animation with x whenever x is changed>
We could also support a shared animation syntax in the future:
blah := PropertyAnimation { ... }
animate x with blah;
animate y with blah;
This patch also adds a primitive PropertyAnimation struct, which will be
used by the generated code to collect the values specified in the .60
markup.
2020-06-24 17:43:48 +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
197a900331
Fix drop for PropertyAnimation
...
Get rid of the constructor function, stick to Default and provide a
setter for the duration instead.
2020-06-23 13:56:10 +02:00
Simon Hausmann
90766f0f82
Simplify PropertyAnimation
...
Remove the animation_driver member and fetch it on-demand instead.
2020-06-23 13:51:26 +02:00
Simon Hausmann
4f761960f0
Remove stray debug output
2020-06-23 13:40:52 +02:00
Simon Hausmann
688f111563
Added simple linear property animation class
2020-06-23 13:27:09 +02:00
Simon Hausmann
d99972a77a
Simplify animation driver handling
...
Instead of passing it through the event loop, make it accessible as a
thread local variable.
2020-06-23 13:03:35 +02:00
Olivier Goffart
32c230e840
Property: small refactor to improve reasoning about the safety
...
Improve the safety by explicitly borrowing both inner and the value
and putting all the (non-ffi) unsafe in only two functions
2020-06-23 11:41:41 +02:00
Olivier Goffart
4ee86a9bef
Add a generic T to Binding and PropertyImpl
...
(This also removes one heap allocation per binding)
2020-06-23 11:16:11 +02:00
Simon Hausmann
264dfa3148
Add support for animations to Property<T>
...
This is done by extending the Binding trait to allow intercepting any
newly set values or bindings and reporting back to the property.
2020-06-22 20:01:07 +02:00
Simon Hausmann
5762f5b065
Small naming cleanups
...
* Renamed PropertyNotify::notify to register_current_binding_as_dependency
as the implementor doesn't actively notify anybody, it merely results
in registering the currently evaluating binding as a dependency.
Also fixed the docs that I added a short while ago -- I got it the
wrong way around :)
* Renamed CURRENT_PROPERTY to CURRENT_BINDING to reflect that this is
about the currently evaluating binding (that'll become a dependency to
notify)
2020-06-22 19:27:15 +02:00
Simon Hausmann
7694337181
Simplify the animation driver API
...
By making the duration a "property" of the Animated trait, we can reduce
the API surface.
2020-06-22 19:27:15 +02:00
Olivier Goffart
f8b7989c0b
Access the properties in the parent component of a repeated element
...
This required some refactoring of the EvaluationContext structure to include the parent context
2020-06-22 14:38:38 +02:00
Simon Hausmann
f98b18d327
Fix animation integration into the event loop
...
* Allow closing the window even when animations are still running (*facepalm*)
* Remember to update animations with each frame (*facepalm again*)
2020-06-20 16:24:17 +02:00
Simon Hausmann
db6b130570
Prepare for animations as temporary bindings
...
By allowing the binding of a property to be a reference-counted trait
object, instead of just a plain function pointer.
2020-06-20 16:24:17 +02:00
Simon Hausmann
072bff1871
Introduce the animation driver in the event loop
...
This re-applies commit 1ef269305e
but with
an Rc<RefCell<>> to make the borrow checker happy :-)
2020-06-20 16:24:17 +02:00
Olivier Goffart
56a75a69e5
Move the repeater part that is specific to rust within the rust lib
2020-06-19 10:06:13 +02:00
Olivier Goffart
dd3097e23c
Fixup
2020-06-17 20:27:18 +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
9df888578f
Expose a ComponentWindow type in Rust
...
This comes with a factory function that re-directs to the backend and a
run member function to replace
sixtyfps_runtime_run_component_with_gl_renderer. For now it's all still
hidden in the generated run() method.
2020-06-17 19:15:18 +02:00
Simon Hausmann
d78c93bfee
Revert "Integrate the animation driver into the event loop"
...
This reverts commit 1ef269305e
. Breaks the
wasm build, to be fixed later.
2020-06-17 18:58:32 +02:00
Simon Hausmann
c0e3f6c250
Fix build
...
The parent commit erroneously removed the trait, which was because of a
local conflict with further changes.
2020-06-17 18:52:49 +02:00
Simon Hausmann
9df8b5da1a
Add some documentation for the PropertyNotify trait
2020-06-17 18:49:10 +02:00
Olivier Goffart
54f81d4d29
C++ Only link against the backend library
...
For some raison, not all symbols gets exported,
add some dummy code which seems to do the trick
2020-06-17 18:38:47 +02:00
Olivier Goffart
8f0520f2be
Repeater in the viewer
2020-06-17 15:43:57 +02:00
Simon Hausmann
1ef269305e
Integrate the animation driver into the event loop
2020-06-17 15:16:46 +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
Olivier Goffart
096fd7bbb4
Repeater in C++
2020-06-17 14:39:33 +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
Olivier Goffart
d7fe69ff74
Lookup the index from a repeater expression
2020-06-16 17:23:38 +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
Olivier Goffart
6122f91fba
Begin with the generation of rhe repeater (rust only for now)
2020-06-16 13:47:02 +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