Jump to content

Having issues with a hard-restart of my game


Recommended Posts

I am letting users select settings such as antialiasing on / off, canvas / webgl mode, and texture & physics-polygon resolution. To make these kick in, I am saving the desired settings to localStorage (done) and restarting the game via this function.

function restartGame() {    // Destroy the current game entity    game.destroy();        // Boot a new game entity    main();   }

main() sets up the states again in a new game object and launches boot that launches preload and so on.


This all works fine, but for one problem, when I switch from canvas to webgl renderer mode I get some screen artifacts (white quad in the bottom-right) and the screen freezes, no javascript error though.


EDIT: The problem doesn't seem to happen when going from canvas -> webgl, but also when going from canvas -> canvas. So it probably has something to do with destroying a game using a canvas renderer.


Is there a more built-in way of restarting the game, or is it possible to change renderer & antialiasing on / off without restarting?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...