I'm new to IsogenicEngine and wanted to create Textures in my JavaScript Source.
Especially in the early builds, it's nice to quickly draw a texture in JS to Test implementations etc...
You could possibly use a SmartTexture instead but I wanted to use it for a backgroundPattern and found, that this wont work with a SmartTexture.
To realize this, I have extended the IgeTexture Class and modified the image loading logic.
Important:
- - This Texture Class does not call ige.textureLoadStart() and ige.textureLoadEnd() => so if you only have DrawOnceTexture Classes the 'texturesLoaded' event won't fire!
- Make sure to adjust the canvas size before you draw onto the context.
Here is a little snipped to show how to use the DrawOnceTexture class:
- Code: Select all
var myTexture = new DrawOnceTexture()
.id('my_fancy_block')
.create(function(canvas, ctx)
{
canvas.height = 50;
canvas.width = 50;
ctx.fillStyle = '#6c6c6c';
ctx.fillRect(0, 0, 50, 50);
});
Let me know what you think about it

btw. Sorry for the bad english (i'm no native speaker)