mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-14 00:14:05 +09:00
some random shits
This commit is contained in:
26
assets/tvdos/gl.js
Normal file
26
assets/tvdos/gl.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
TVDOS Graphics Library
|
||||
|
||||
Has no affiliation with OpenGL by Khronos Group
|
||||
*/
|
||||
|
||||
var GL = {};
|
||||
GL.Tex = function(w, h, bytes) {
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
this.texData = bytes;
|
||||
};
|
||||
GL.drawTexPattern = function(tex, x, y, width, height) {
|
||||
for (var yy = 0; yy < height; yy++) {
|
||||
for (var xx = 0; xx < width; xx++) {
|
||||
var tx = xx % tex.width;
|
||||
var ty = yy % tex.height;
|
||||
var c = tex.texData[ty * tex.width + tx];
|
||||
graphics.plotPixel(x + xx, y + yy, c);
|
||||
}
|
||||
}
|
||||
};
|
||||
GL.drawTexImage = function(tex, x, y) {
|
||||
GL.drawTexPattern(tex, x, y, tex.width, tex.height);
|
||||
};
|
||||
Object.freeze(GL);
|
||||
Reference in New Issue
Block a user