cykod / Quintus

HTML5 Game Engine
http://html5quintus.com
GNU General Public License v2.0
1.41k stars 401 forks source link

Separate rendering engine/code #84

Closed JaredSartin closed 3 years ago

JaredSartin commented 10 years ago

Forgive me for not knowing the code well enough, but is there a clear place in the code where a renderer is defined?

I am looking to use Pixi for rendering, but am really wary about the major framework (Phaser) that uses it. Quintus is more than enough, aside from having Pixi/webgl support.

For that matter, if there is a clean spot to add/change/remove renderers, I am sure work could be done to get threejs in here too!

cykod commented 10 years ago

There's not a clean abstraction - you'll most likely need to make changes to the following spots:

  1. Q.setup - https://github.com/cykod/Quintus/blob/master/lib/quintus.js#L1306 - setting up the rendering context
  2. Override Stage.render - https://github.com/cykod/Quintus/blob/master/lib/quintus_scenes.js#L870 - any pre-rendering changes
  3. Sprite.render - https://github.com/cykod/Quintus/blob/master/lib/quintus_sprites.js#L544 - setting up the transform for rendering
  4. Sprite.draw - https://github.com/cykod/Quintus/blob/master/lib/quintus_sprites.js#L605 - doing the rendering
JaredSartin commented 10 years ago

Thanks for the information. I will look into those areas. If I can cleanly extract rendering and allow for renderer choice, would this be a direction you would like quintus to go?

On Monday, February 3, 2014, Pascal Rettig notifications@github.com wrote:

There's not a clean abstraction - you'll most likely need to make changes to the following spots:

  1. Q.setup - https://github.com/cykod/Quintus/blob/master/lib/quintus.js#L1305 - setting up the rendering context
  2. Override Stage.render - https://github.com/cykod/Quintus/blob/master/lib/quintus_scenes.js#L745 - any pre-rendering changes
  3. Sprite.render - https://github.com/cykod/Quintus/blob/master/lib/quintus_sprites.js#L544- setting up the transform for rendering
  4. Sprite.draw - https://github.com/cykod/Quintus/blob/master/lib/quintus_sprites.js#L605- doing the rendering

— Reply to this email directly or view it on GitHubhttps://github.com/cykod/Quintus/issues/84#issuecomment-34023715 .

Jared Sartin 269.364.1735 | jared.sart.in | @JaredSartin http://twitter.com/JaredSartin

cykod commented 10 years ago

Definitely - have been meaning to do a WebGL rendering engine in any case...

JaredSartin commented 10 years ago

Ok, I will do some investigation on this front.

JaredSartin commented 10 years ago

I think I have these things pulled out into a render system. There is a lot more to move around and factor out. Once I think I have it cleaned out I can then try to make a pixi render system.

JaredSartin commented 10 years ago

After splitting the rendering out into it's own system, I realized what I had done was not pretty. I had just pulled out all the rendering and lumped it all into one system. Now, this isn't too much of a problem, since it defines the methods that sprite, stage, and Q.setup call into in a global area.

My progress is https://github.com/JaredSartin/Quintus/tree/pixi - I am have not started on the pixi implementation, just trying to make sure I have gotten all of the canvas-specific rendering logic shuffled off properly.