dgashby's Forum Posts

  • 3 posts
  • Hi Ben,

    I've been working on integrating a couple of games with an AngularJS based web app. You're right in that there isn't much info around about this, so most of what I've learnt is just from trial and error.

    I start by exporting the game as an HTML 5 Normal Style game, then I pick out the bits that we need, the images, c2runtime.js, and data.js. I also tweak the c2runtime.js to correct the path to data.js as we have these in sub-folders for each game.

    Within the page controller I use the angular-load plugin to load the c2runtime.js. I also copy most of the content for the c2canvasdiv from the HTML 5 webapp index.html to the AngularJS page template.

    We wanted to enforce authentication prior to the user starting the game, and we also wanted to store information entered by the user into the game against their profile so if they returned they could pick up where the left off. I did this by implementing some custom actions that talk to our AngularJS services.

    Sorry I haven't included any specific code examples but hopefully this gives you a few ideas on how to move forward.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just wondering if anyone has a solution for the above request, i.e. how to make the canvas fill a responsive div without using an iframe?

    We've got a single page app implemented using AngularJS and don't wan the canvas taking up the entire screen but it still needs to be able to access AngualrJS services from a custom action. We've got all the AngularJS integration working fine, I just need to tidy up the layout.

  • When I export to HTML 5 using the Normal style and then try to integrate the HTML with an AngularJS application everything works fine the first time the page containing the game is loaded, however when I navigate away from the page and then back to the page (using AngularJS routes) the c2runtime fails with the following error:

    c2runtime.js:2284 WebGL: INVALID_OPERATION: bindTexture: object not from this context.

    Which is this piece of code:

    	GLBatchJob.prototype.doSetTexture = function ()
    	{
    		this.gl.bindTexture(this.gl.TEXTURE_2D, this.texParam);
    	};
    [/code:3pa1kfpc]
    
    If I reload the page rather than navigating using the links in our application then all works fine again.
    
    I'm not sure if this is a bug with Construct2 or if I'm doing something wrong.  The game needs to be integrated with our AngularJS application as it it using AngularJS services and authentication mechanisms to fetch game history.  I contemplated posting this as a bug however a Capx by itself won't demonstrate the problem so I've posted in this more general forum instead in case others have come across the same problem and found a solution.
  • 3 posts