Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement #2655 - Add more easing formulas #3812

Merged
merged 11 commits into from
Nov 3, 2023
Prev Previous commit
Next Next commit
Fix CPP code generation
  • Loading branch information
FoundationKen committed Nov 2, 2023
commit abe68205b8ec68e20184cefe282e886b85f55882
7 changes: 3 additions & 4 deletions api/cpp/cbindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,9 @@ fn gen_corelib(
"CachedRenderingData".to_owned(),
" constexpr CachedRenderingData() : cache_index{}, cache_generation{} {}".to_owned(),
);
config.export.body.insert(
"EasingCurve".to_owned(),
" constexpr EasingCurve() : tag(Tag::Linear), cubic_bezier{{0,0,1,1}} {}
constexpr explicit EasingCurve(EasingCurve::Tag tag, float a, float b, float c, float d) : tag(tag), cubic_bezier{{a,b,c,d}} {}".into()
config.export.body.insert(
"EasingCurve".to_owned(),
" constexpr explicit EasingCurve(EasingCurve::Tag tag = Tag::Linear , float a = 0, float b = 0, float c = 1, float d = 1) : tag(tag), cubic_bezier{{a,b,c,d}} {}".into()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" constexpr explicit EasingCurve(EasingCurve::Tag tag = Tag::Linear , float a = 0, float b = 0, float c = 1, float d = 1) : tag(tag), cubic_bezier{{a,b,c,d}} {}".into()
" constexpr EasingCurve(EasingCurve::Tag tag = Tag::Linear , float a = 0, float b = 0, float c = 1, float d = 1) : tag(tag), cubic_bezier{{a,b,c,d}} {}".into()

It shouldn't have been explicit, sorry to have mislead you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries...How can I test this locally? I'm not doing anything with CPP and Slint.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can run the driver test like so.

cargo test -p  test-driver-cpp

But I'm not sure this test any of the new curves since they are not in the tests but in the gallery.
To build the gallery, you need cmake:

https://github.com/slint-ui/slint/blob/master/docs/building.md#c-api-build

);
config.export.body.insert(
"LayoutInfo".to_owned(),
Expand Down
Loading