1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-09-20 04:24:45 +00:00

Added Preset keyword.

This commit is contained in:
William Barnes 2022-04-25 13:29:12 -04:00
parent c0f5b21395
commit ea12bf28da
4 changed files with 21 additions and 2 deletions

View file

@ -42,7 +42,7 @@ CodeMirror.defineMode("qbjs", function(conf, parserConf) {
'_screenexists', '_sndclose', '_sndopen', '_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol', '_screenexists', '_sndclose', '_sndopen', '_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol',
'_title', '_trim', '_width', 'abs', 'asc', 'atn', 'chr', 'circle', 'cls', 'color', 'command', 'cos', 'cvi', 'cvl', 'exp', '_title', '_trim', '_width', 'abs', 'asc', 'atn', 'chr', 'circle', 'cls', 'color', 'command', 'cos', 'cvi', 'cvl', 'exp',
'fix', 'hex', 'input', 'inkey', 'instr', 'int', 'lbound', 'left', 'lcase', 'len', 'line', 'locate', 'log', 'ltrim', 'mid', 'mki', 'mkl', 'fix', 'hex', 'input', 'inkey', 'instr', 'int', 'lbound', 'left', 'lcase', 'len', 'line', 'locate', 'log', 'ltrim', 'mid', 'mki', 'mkl',
'oct', 'point', 'print', 'pset', 'right', 'rtrim', 'rnd', 'screen', 'shared', 'sgn', 'sin', 'sleep', 'space', 'sqr', 'str', 'swap', 'tan', 'oct', 'point', 'preset', 'print', 'pset', 'right', 'rtrim', 'rnd', 'screen', 'shared', 'sgn', 'sin', 'sleep', 'space', 'sqr', 'str', 'swap', 'tan',
'timer', 'ubound', 'ucase', 'val', 'timer', 'ubound', 'ucase', 'val',
// QBJS-specific // QBJS-specific
'alert', 'confirm', 'domadd', 'domcontainer', 'domcreate', 'domevent','domget', 'domgetimage', 'domremove', 'export', 'alert', 'confirm', 'domadd', 'domcontainer', 'domcreate', 'domevent','domget', 'domgetimage', 'domremove', 'export',

19
qb.js
View file

@ -860,6 +860,7 @@ var QB = new function() {
this.func_Point = function(x, y) { this.func_Point = function(x, y) {
var screen = _images[_activeImage]; var screen = _images[_activeImage];
var ret = 0;
if ( y == undefined ) { if ( y == undefined ) {
if (x == 0) { if (x == 0) {
ret = screen.lastX; ret = screen.lastX;
@ -873,11 +874,27 @@ var QB = new function() {
} else { } else {
var ctx = screen.ctx; var ctx = screen.ctx;
var data = ctx.getImageData(x, y, 1, 1).data; var data = ctx.getImageData(x, y, 1, 1).data;
var ret = QB.func__RGBA(data[0],data[1],data[2],data[3]); ret = QB.func__RGBA(data[0],data[1],data[2],data[3]);
} }
return ret; return ret;
}; };
this.sub_PReset = function(sstep, x, y, color) {
var screen = _images[_activeImage];
if (color == undefined) {
color = _bgColor;
}
else {
color = _color(color);
}
if (sstep) {
x = screen.lastX + x;
y = screen.lastY + y;
}
screen.lastX = x;
screen.lastY = y;
};
this.sub_Print = async function(args) { this.sub_Print = async function(args) {
// Print called with no arguments // Print called with no arguments
if (args == undefined || args == null || args.length < 1) { if (args == undefined || args == null || args.length < 1) {

View file

@ -2533,6 +2533,7 @@ if (QB.halted()) { return; }
await sub_AddQBMethod( "FUNCTION", "Mkl$", False); await sub_AddQBMethod( "FUNCTION", "Mkl$", False);
await sub_AddQBMethod( "FUNCTION", "Oct$", False); await sub_AddQBMethod( "FUNCTION", "Oct$", False);
await sub_AddQBMethod( "FUNCTION", "Point", False); await sub_AddQBMethod( "FUNCTION", "Point", False);
await sub_AddQBMethod( "SUB", "PReset", False);
await sub_AddQBMethod( "SUB", "Print", True); await sub_AddQBMethod( "SUB", "Print", True);
await sub_AddQBMethod( "SUB", "PSet", False); await sub_AddQBMethod( "SUB", "PSet", False);
await sub_AddQBMethod( "FUNCTION", "Right$", False); await sub_AddQBMethod( "FUNCTION", "Right$", False);

View file

@ -2675,6 +2675,7 @@ Sub InitQBMethods
AddQBMethod "FUNCTION", "Mkl$", False AddQBMethod "FUNCTION", "Mkl$", False
AddQBMethod "FUNCTION", "Oct$", False AddQBMethod "FUNCTION", "Oct$", False
AddQBMethod "FUNCTION", "Point", False AddQBMethod "FUNCTION", "Point", False
AddQBMethod "SUB", "PReset", False
AddQBMethod "SUB", "Print", True AddQBMethod "SUB", "Print", True
AddQBMethod "SUB", "PSet", False AddQBMethod "SUB", "PSet", False
AddQBMethod "FUNCTION", "Right$", False AddQBMethod "FUNCTION", "Right$", False