• Content Count

  • Joined

  • Last visited

About dotJayEss

  • Rank

Contact Methods

  • Twitter

Recent Profile Visitors

852 profile views
  1. Not sure what performance metrics you are concerned with. If it is simply fps, a common Phaser approach is to set game.time.advancedTiming = true. You can then check the game.time.fps property and write that to the screen using game.debug.text() in your render loop. Beyond that I find this little tool from Mr. Doob to be very helpful. The bottom of the readme has a simple bookmarklet approach, whereby you can add this as a bookmark in your browser and enable it as needed without needing to modify existing code or depend on any framework specific functionality.
  2. @FlashyGoblin I tried solving this for my own use case based on @ivan.popelyshev's suggestions, but I am a still a noob when it comes to webgl solutions. I ended up with a solution which is working for me. However, based on Ivan's direction above and the general intent of those modules, I don't feel it is PR worthy. Hope this helps. //Returns a region of the canvas as a base64 dataURL function extractRegion(renderer, x, y, width, height){ var sourceCanvas = renderer.extract.canvas(); var sourceContext = sourceCanvas.getContext('2d'); var extractCanvas = document.createElement('canvas'); var extractContext = extractCanvas.getContext('2d'); var imageData = sourceContext.getImageData(x, y, width, height); extractCanvas.width = width; extractCanvas.height = height; extractContext.putImageData(imageData, 0, 0); return extractCanvas.toDataURL(); }
  3. My current workaround for this issue is to bind to the contextmenu event of a wrapper div which wraps the wrapper div I pass to Phaser by id. Example DOM: <div id="wrapper"> <div id="game"> <canvas></canvas> </div> </div> I pass the id 'game' to phaser, the canvas is injected by phaser. Attaching event handlers to #game or canvas element 'oncontextmenu' does nothing. Handler is never called. Attaching event handlers to #wrapper works as expected. I would greatly appreciate any insight into why this is needed, or if I have found a bug I would gladly submit an issue/PR for a fix.
  4. I have been working with Phaser for a few months, and have started to use it in an application I am building and am running into an issue most likely tied to my ignorance of how Phaser events are implemented. I come from a web development background, and I feel my understanding of the dom and it's events are muddying my understanding of Phaser eventing. Before stepping through the input source I wanted to ask for help here to hopefully shed some light on my issue. General All events originate from the DOM, yet the DOM event is never passed for manipulation to the handler, why is this? Is there any way to get reference to the dom event in a given handler? Is there a reliable way to prevent the default behavior of an event? I am aware of the priorityID to control event priority and this has solved most of my use cases until now but it really only gives me control over bubbling and delegation. I also found the capture property on the mouse object but setting it to true does not appear to have effect on my issue. My Issue: Unable to prevent the default behavior of 'contextmenu' event in Phaser 2.4.4 My app has need to display a custom context menu over the canvas on right click, so I need to prevent the default behavior of the dom 'contextmenu' event I have tried setting a function to the game.canvas.oncontextmenu property, the function is never called and native context menu is shown I have tried selecting the canvas from the dom and adding an event listener to the contextmenu event, the handler is never raised and native context menu is shown I have even tried selecting the canvas' parent element from the dom and adding an event listener, handler is never raised and native context menu is shown I can select any element in my app phaser is unaware of and use this basic dom capability to assign the contextmenu event handler I can select the canvas or it's parent and bind to other dom events such as 'mousedown' So right now I am lost. Is there some kind of monkey patching going on with phaser and the events of dom elements it is aware of? I simply need to be able to prevent the default behavior of the 'contextmenu' dom event so the user is shown my custom menu and not the native browser context menu. Any advise or insight is greatly appreciated. Browser: Chrome, Phaser Version: 2.4.4, OSX
  5. Your Express server is not aware of how to handle the .babylon extension. You will experience this issue in pretty much any server environment as most servers will not recognize this extension and thus will not know the mime type. In your app.js you will need to add to the mime table. I haven't used express in a while, but this used to be done like this: app.mime.type['.fx'] = 'application/fx'; app.mime.type['.babylon'] = 'application/babylon'; app.mime.type['.babylonmeshdata'] = 'application/babylonmeshdata'; While the syntax may not be right it should point you in the right direction, you are looking for a way for the server to respond with the proper mime type in the header when the .babylon extension is being requested.
  6. Greetings, I have been lurking on here for a bit. I thought this would interest the community. Mozilla has released a browser based MMO called BrowserQuest leveraging HTML5 and websockets. The client and server solution is open source and available on github. Game: Source Code: