Vortico

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. Thanks for the advice and the links to relevant classes. I have tried reimplementing the game loop and render calls from the implementations in your links while still using melonJS for rendering, and while there are some difficulties, it mostly works. It's still pretty hacky, so I decided to start my clean-room implementation based on what I've learned from using Pixi.js and melonJS in the last couple days, except by directly exposing `renderer.drawTexture()` classes. It's perhaps a useless activity because I'm almost certain someone has written a library to do what I'm doing, but it's taken me just a couple hours and it's mostly done now. If you're curious, the reason is because my game holds a global state elsewhere, and I'm unable to easily keep a Sprite synced with the state due to frequent and arbitrary deletion, addition, and changing of data that gives rise to certain collections of Sprites. So my Sprite alternative is to have nothing at all since Sprites would have needed to be created/destroyed upon each frame. If you're familiar with immediate-mode GUIs, my game is essentially that (except for all graphics, not just UI elements) using a simple JSON state which is synced over the network. Taking advantage of texture caching and texture sharing optimization is still possible when removing the Sprite abstraction.
  2. Is it possible to take advantage of MelonJS's WebGL renderer to make my render calls in a game loop instead of using Sprite objects and other abstractions? Something like ´╗┐function render() { ... renderer.clearColor('#000000'); renderer.drawImage(image, 0, 0, w, h, x, y, w, h); window.requestAnimationFrame(render); ´╗┐} rather than creating states, sprites, containers, etc. MelonJS's low-level renderer looks impressive, but it's hidden behind higher-level classes that I don't need. All I really need are these two functions.