-
Notifications
You must be signed in to change notification settings - Fork 418
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
Declarative programming of Drawables #3055
Comments
Definitely an approach, but possibly a bit too complex and not really what we're after (which is tight coupling with the existing drawable tree, rather than creating a shadow/virtual tree). I think it's best we further outline our requirements before discussing this further, but the approach in #3041 seems closer to what we want, which is a lightweight (reflection based) method of adjusting existing classes for user customisation. |
Based on my development experience in xaml, one of the biggest problem is to correctly handle re-calculating complex expressions. Due to the difference nature between game and UI, I think declarative calculation won't get acceptable performance unless you are fully experienced about optimizing functional programming.
Code generation will probably be in fact necessary because of performance. Personally, I don't suggest to learn from web too much, because JS type system is totally a mess, and it's performance is still not good even used react-like stuff. |
Additional words: |
Note that we cannot do any kind of JIT code generation, or iOS will cease to function. |
20 progress bars for osu!framework is very different from 20 progress bars drawn with Windows GDI. Re-rendering logic can be optimized to work only on parts of the tree that changed. Not to mention that things like progress bars would probably use transforms, which means less re-rendering.
|
WPF progress bar isn't Windows GDI one, which performs better. |
I went ahead and wrote a basic implementation of this in a separate repository. The name "ofreact" is temporary until it is merged into the framework repository or rejected. There is an included example class and a YAML component syntax that will become OML if this is merged (note that it is quite different to what is described in #3056.) peppy:
I can understand that this feature is probably overly complex compared to #3041, but implementing OML is only one of the goals among implementing the base framework for writing Drawables in a declarative manner. I don't think it's necessarily bad to be complex if we can achieve the goal of both OML and other things described in this issue. huoyaoyuan:
Performance is a primary consideration in my implementation. Expression trees are cached and used as much as possible (with fallback to reflection if without JIT). All objects used in rendering are designed to be lightweight. Other things like inlining, ref structs, etc. Overall, the rendering is designed to not do much, and I did many benchmarkings on this. Please tell me your opinion about this approach, and if I should continue my work on the implementation or not. |
It's very hard for us to look over a huge o!f system right now, so you may not get a response @phosphene47 . However in principle if there's demonstrable use-cases, we're generally not against it. This seems pretty cool in general from the little I've looked at it, and all the better if it helps with implementing OML which it seems like it does. |
This is a different approach to implementing #30
I am proposing an API to compose
Drawable
components in a declarative manner, inspired by React.DrawableNode
s which will be wrapped as aDrawable
.DrawableNode
types and the declarative API. "Props" types are POCO and designed to be serializable.Full GistGist is outdatedThe text was updated successfully, but these errors were encountered: