mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-11 07:14:04 +09:00
adding gzip/replaced bad base64 impl with libgdx's
This commit is contained in:
@@ -6,12 +6,13 @@ Has no affiliation with OpenGL by Khronos Group
|
||||
|
||||
var GL = {};
|
||||
|
||||
// bytes should be able to handle both JSArray and Java ByteArray (toString = "[B")?
|
||||
GL.Texture = function(w, h, bytes) {
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
this.texData = bytes;
|
||||
|
||||
if (!Array.isArray(bytes)) {
|
||||
if (!Array.isArray(bytes) && !bytes.toString().startsWith("[B")) {
|
||||
throw "Texture data is not an instance of array";
|
||||
}
|
||||
};
|
||||
@@ -52,7 +53,7 @@ GL.drawTexPatternOver = function(texture, x, y, width, height) {
|
||||
var tx = xx % texture.width;
|
||||
var ty = yy % texture.height;
|
||||
var c = texture.texData[ty * texture.width + tx];
|
||||
if (c != 255) {
|
||||
if (c != -1) {
|
||||
graphics.plotPixel(x + xx, y + yy, c);
|
||||
}
|
||||
}
|
||||
@@ -71,7 +72,7 @@ GL.drawTexImageOver = function(texture, x, y) {
|
||||
for (var ty = 0; ty < texture.height; ty++) {
|
||||
for (var tx = 0; tx < texture.width; tx++) {
|
||||
var c = texture.texData[ty * texture.width + tx];
|
||||
if (c != 255) {
|
||||
if (c != -1) {
|
||||
graphics.plotPixel(x + tx, y + ty, c);
|
||||
}
|
||||
}
|
||||
@@ -93,7 +94,7 @@ GL.drawSpriteOver = function(sheet, xi, yi, x, y) {
|
||||
for (var ty = 0; ty < sheet.tileHeight; ty++) {
|
||||
for (var tx = 0; tx < sheet.tileWidth; tx++) {
|
||||
var c = sheet.texture.texData[(ty + offy) * sheet.texture.width + (tx + offx)];
|
||||
if (c != 255) {
|
||||
if (c != -1) {
|
||||
graphics.plotPixel(x + tx, y + ty, c);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user