Using doubles in WPF but floats in Unity?
I keep running up against the problem of WPF components needing properties to be of type double but the same components in the Noesis Unity integration need floats. Due to how C# is structured I am unable to see a way to coerced floats into doubles and vice versa at runtime without writing #if NOESIS everywhere and defining everything twice. Is there a recommended way to get around this limitation?
-
sfernandez
Site Admin
- Posts: 3008
- Joined:
Re: Using doubles in WPF but floats in Unity?
Hello,
As described here we recommend to define a Float type to handle the double/float difference between WPF and Noesis only once:
Could that work for you?
As described here we recommend to define a Float type to handle the double/float difference between WPF and Noesis only once:
Code: Select all
#if NOESIS
using Float = System.Single;
#else
using Float = System.Double;
#endif
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<Float> e);
private void UpdateColor(Float r, Float g, Float b, Float a);
- ai_enabled
- Posts: 231
- Joined:
- Contact:
Re: Using doubles in WPF but floats in Unity?
Hello!
I'm maintaining a fork of "NoesisGUI.Managed" Github repository where I've changed most of the public API to use double instead of float among some other related changes (so WPF applications' code is compatible without any changes).
https://github.com/AtomicTorchStudio/Managed
Regards!
I'm maintaining a fork of "NoesisGUI.Managed" Github repository where I've changed most of the public API to use double instead of float among some other related changes (so WPF applications' code is compatible without any changes).
https://github.com/AtomicTorchStudio/Managed
Regards!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
Re: Using doubles in WPF but floats in Unity?
Hi, thank you both for the answers.
I didn't see that documentation when going through the docs site. Very useful, thank you!
I'll check out the linked GitHub repro, looks interesting.
I didn't see that documentation when going through the docs site. Very useful, thank you!
I'll check out the linked GitHub repro, looks interesting.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest