-
-
Notifications
You must be signed in to change notification settings - Fork 642
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
[Feature request] Allow supplying a custom renderer #1139
Comments
this is definitely a good idea, and an easy one to do, but I'm not sure I understand how it would help with #1136 ? |
Then we could make a drop-in replacement for the melonJS renderer for React Native. We could use a lib like GCanvas or use the native canvas API on Android/native canvas API on IOS. I'm not sure what is the fastest option here. We could also keep it inside a WebView but I get a feeling we could see some benefits by using native components over HTML ones |
so this one is done ! the way it works :
To give a (very minimalist) example: // create a custom renderer extending the default canvas one with one `isCustom` property
class CustomRenderer extends me.CanvasRenderer {
constructor(options) {
super(options);
this.isCustom = true;
}
}
// call video init, specifying the custom renderer
me.video.init(800, 600, {parent : "screen", scale : "auto", renderer : CustomRenderer});
this has not been heavily tested, as the current test case doest not go further than extending the Canvas Renderer, add a "custom" property to it, and verify that the property has been set once the renderer has been properly created. There might be some tweaking to be done later in terms of API, but at least there is enough here for anyone that is will to create a React Native or any other custom renderer. I will therefore close this one, as creating an actual custom renderer should not be part of the "generic" framework. |
also created a topic on the forum: https://melonjs.discourse.group/t/custom-renderer/46 |
Is your feature request related to a problem? Please describe.
Supporting custom renderers could make transitioning to 3d easier (as most of the burden of the implementation details would be on the rendering plugin), it also would make it easy to build custom renderers for things like OpenGL or other device APIs so people could get the most optimization and flexibility out of melonJS if they wanted to. This would also help us complete #1136
Describe the solution you'd like
Some kind of standardized API about the standards that the plugins should use (like 3D vectors etc)
Describe alternatives you've considered
you could fork melonJS to add custom rendering but it would be nice to have first class support for it.
Additional context
The text was updated successfully, but these errors were encountered: