Cocoon tries to be as HTML5 compliant as possible but sometimes, as we have full control over the JS environment, we see opportunities to add cool features that are not directly available in the standard APIs. In this case we have added a very simple extension function to Canvas+ XMLHttpRequest object to be able to […]
Category with articles explaining the Canvas+ special features.
Canvas+ has some special API that are exclusive of this webview engine and that are not available in the other engines. Some of this features can also be accomplished with Cordova or a Cordova plugin and are just legacy. App Device Different methods to have acceso to the device information. Dialog Methods to access the dialog/prompt […]
Canvas+ uses POT (Power Of Two) textures by default in 2d contexts. This is very useful for performance improvements, especially on mobiles with old GPUs. But it can waste memory on games that don’t use packed or 2^n textures. In Canvas+ you can allow NPOT textures in Canvas2D contexts (they were already supported in WebGL). […]
Another Canvas+ exclusive feature available on version 2.1 and higher we have added the “cocoonLazyLoad” boolean property to Image objects (we have also added a duplicate called “idtkLoadDisposed” for retro compatibility with Construct2). When the property is set to true, the image is not loaded until it’s used in a render operation. Engines that load […]
This new Canvas+ exclusive feature exposes the “setMaxMemory” utility method. When the max memory threshold is set, Cocoon checks the total amount of texture sizes (images and canvases). When the runtime memory size reaches the max memory threshold, Cocoon disposes of the least recently used textures until the memory fits the threshold. It disposes of […]
Texture reducer is a Canvas+ exclusive feature. When your game targets all resolutions you need huge textures for iPad retina like devices and small textures for small mobile devices. A game developer has many ways to handle this: Create different asset packages, HD and normal. Good solution but bigger app size. Scale down HD resources. […]
ScreenCanvas is a canvas+ specific high performance canvas. In canvas+ you can create 2 types of canvas: A standard canvas renders everything to an internal drawing buffer (render to texture). At the end of the frame the texture is drawn to the screen buffer. A screencanvas doesn’t create any internal drawing buffers. It renders directly […]