4 ms·
It's not quite that simple, though, from the sound of it - the author said he had to 'reimplement' all the canvas calls to use OGL. Fine if you're familiar with
by revjx 16y ago
It's not quite that simple, though, from the sound of it - the author said he had to 'reimplement' all the canvas calls to use OGL. Fine if you're familiar with it, but for those people who just want to bash out a Javascript game without having to worry about the engine, they might have trouble.
- pirko 16y agoFrom what I understand he only had to re-implement the canvas calls in the game engine. "I of course had to make some changes to the engine, but the game source code is exactly the same as for the web version."
- deleted 16y ago[deleted]
- mkilling 16y agoIf this should ever go public there will sure as hell be an abstraction layer that translates API calls to canvas or OpenGL ES, respectively
- phoboslab 16y agoSo far I only reimplemented those Canvas API functions needed for the game; the most important one being .drawImage(). What I mean by "reimplement", is providing a .drawImage function for JavaScript that works in the same way as it does in the browser, but uses OpenGL-ES behind the scenes. This reimplementation is done in native Objective C. The changes I had to make to Impact (the "HTML5" engine) are concerned with the loading of images, scaling, input and getting a reference to the canvas element and its drawing context. But I guess I could provide a dummy "document" and "getElementById" function, so that you can just write some JavaScript using Canvas and run it in the browser and on the iPhone unchanged. Note that this whole idea isn't exactly new: http://www.youtube.com/watch?v=0UN2iYrZmEY http://www.youtube.com/watch?v=0UN2iYrZmEY