mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-09-19 20:14:58 +00:00
Tamed the horizontal growth of qb-lang.js.
This commit is contained in:
parent
a982ded882
commit
62153b8001
4 changed files with 31 additions and 10 deletions
|
@ -35,15 +35,27 @@ CodeMirror.defineMode("qbjs", function(conf, parserConf) {
|
|||
// TODO: adjust for QB
|
||||
var atomWords = ['true', 'false', 'nothing', 'empty', 'null'];
|
||||
|
||||
var builtinFuncsWords = ['_acos', '_acosh', '_alpha', '_alpha32', '_asin', '_asinh', '_atan2', '_atanh', '_autodisplay', '_blue', '_blue32', '_ceil', '_continue', '_copyimage', '_cosh', '_coth', '_csch', '_d2g', '_d2r', '_delay', '_dest',
|
||||
'_display', '_fontwidth', '_freeimage', '_fullscreen', '_g2d', '_g2r', '_green', '_green32', '_height', '_hypot', '_instrrev', '_limit', '_keyclear', '_keydown',
|
||||
'_keyhit', '_loadimage', '_mousebutton', '_mouseinput', '_mousex', '_mousey', '_newimage', '_pi', '_printstring', '_printwidth',
|
||||
'_putimage', '_r2d', '_r2g', '_readbit', '_red', '_red32', '_resetbit', '_resize', '_resizewidth', '_resizeheight', '_rgb', '_rgba', '_rgb32', '_rgba32', '_round',
|
||||
'_screenexists', '_sech', '_setbit', '_shl', '_shr', '_sinh', '_source', '_sndclose', '_sndopen', '_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol', '_strcmp', '_stricmp', '_tanh',
|
||||
'_title', '_trim', '_togglebit', '_width', 'abs', 'asc', 'atn', 'beep', 'chr', 'cdbl', 'cint', 'clng', 'csng', 'circle', 'cls', 'color', 'command', 'cos', 'cvi', 'cvl', 'data', 'date', 'draw', 'exp',
|
||||
'fix', 'hex', 'input', 'inkey', 'instr', 'int', 'lbound', 'left', 'lcase', 'len', 'line', 'locate', 'log', 'ltrim', 'mid', 'mki', 'mkl',
|
||||
'oct', 'paint', 'point', 'preset', 'print', 'pset', 'right', 'rtrim', 'randomize', 'read', 'restore', 'rnd', 'screen', 'shared', 'sgn', 'sin', 'sleep', 'space', 'sqr',
|
||||
'str', 'swap', 'tan', 'time', 'timer', 'ubound', 'ucase', 'val', 'varptr', 'window',
|
||||
var builtinFuncsWords = ['_acos', '_acosh', '_alpha', '_alpha32', '_asin', '_asinh', '_atan2', '_atanh', '_autodisplay',
|
||||
'_blue', '_blue32', '_ceil', '_continue', '_copyimage', '_cosh', '_coth', '_csch', '_d2g',
|
||||
'_d2r', '_delay', '_dest', '_display', '_fontwidth', '_freeimage', '_fullscreen',
|
||||
'_g2d', '_g2r', '_green', '_green32', '_height', '_hypot',
|
||||
'_instrrev', '_limit', '_keyclear', '_keydown', '_keyhit', '_loadimage',
|
||||
'_mousebutton', '_mouseinput', '_mousex', '_mousey', '_newimage',
|
||||
'_palettecolor', '_pi', '_printstring', '_printwidth', '_putimage',
|
||||
'_r2d', '_r2g', '_readbit', '_red', '_red32', '_resetbit', '_resize', '_resizewidth',
|
||||
'_resizeheight', '_rgb', '_rgba', '_rgb32', '_rgba32', '_round',
|
||||
'_screenexists', '_sech', '_setbit', '_shl', '_shr', '_sinh', '_source', '_sndclose', '_sndopen',
|
||||
'_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol', '_strcmp', '_stricmp',
|
||||
'_tanh', '_title', '_trim', '_togglebit', '_width',
|
||||
'abs', 'asc', 'atn', 'beep',
|
||||
'chr', 'cdbl', 'cint', 'clng', 'csng', 'circle', 'cls', 'color', 'command', 'cos', 'cvi', 'cvl',
|
||||
'data', 'date', 'draw', 'exp', 'fix', 'hex', 'input', 'inkey', 'instr', 'int',
|
||||
'lbound', 'left', 'lcase', 'len', 'line', 'locate', 'log', 'ltrim', 'mid', 'mki', 'mkl',
|
||||
'oct', 'paint', 'point', 'preset', 'print', 'pset',
|
||||
'right', 'rtrim', 'randomize', 'read', 'restore', 'rnd',
|
||||
'screen', 'shared', 'sgn', 'sin', 'sleep', 'space', 'sqr',
|
||||
'str', 'swap', 'tan', 'time', 'timer', 'ubound', 'ucase',
|
||||
'val', 'varptr', 'window',
|
||||
// QBJS-specific
|
||||
'export', 'from', 'import', '_label']
|
||||
|
||||
|
|
5
qb.js
5
qb.js
|
@ -127,6 +127,7 @@ var QB = new function() {
|
|||
_rndSeed = 327680;
|
||||
_runningFlag = true;
|
||||
_sourceImage = 0;
|
||||
_initColorTable();
|
||||
GX._enableTouchMouse(true);
|
||||
GX.registerGameEvents(function(e){});
|
||||
QB.sub_Screen(0);
|
||||
|
@ -412,6 +413,10 @@ var QB = new function() {
|
|||
return tmpId;
|
||||
};
|
||||
|
||||
this.sub__PaletteColor = function(x, y) {
|
||||
_colormap[x] = _color(y);
|
||||
};
|
||||
|
||||
this.sub__PrintString = function(x, y, s) {
|
||||
// TODO: check the background opacity mode
|
||||
// Draw the text background
|
||||
|
|
1
qb2js.js
1
qb2js.js
|
@ -2833,6 +2833,7 @@ if (QB.halted()) { return; }
|
|||
await sub_AddQBMethod( "FUNCTION", "_MouseY", False);
|
||||
await sub_AddQBMethod( "FUNCTION", "_NewImage", False);
|
||||
await sub_AddQBMethod( "FUNCTION", "_Pi", False);
|
||||
await sub_AddQBMethod( "SUB", "_PaletteColor", False);
|
||||
await sub_AddQBMethod( "SUB", "_PrintString", False);
|
||||
await sub_AddQBMethod( "FUNCTION", "_PrintWidth", False);
|
||||
await sub_AddQBMethod( "SUB", "_PutImage", False);
|
||||
|
|
|
@ -2,7 +2,9 @@ Option _Explicit
|
|||
$Console:Only
|
||||
'$ExeIcon:'./../gx/resource/gx.ico'
|
||||
|
||||
' In console, after creating qb2js.exe, run: qb2js qb2js.bas > ../qb2js.js
|
||||
'1) Edit this file as needed.
|
||||
'2) Compile to EXE only.
|
||||
'3) In console, run: qb2js qb2js.bas > ../qb2js.js
|
||||
|
||||
Const FILE = 1
|
||||
Const TEXT = 2
|
||||
|
@ -3015,6 +3017,7 @@ Sub InitQBMethods
|
|||
AddQBMethod "FUNCTION", "_MouseY", False
|
||||
AddQBMethod "FUNCTION", "_NewImage", False
|
||||
AddQBMethod "FUNCTION", "_Pi", False
|
||||
AddQBMethod "SUB", "_PaletteColor", False
|
||||
AddQBMethod "SUB", "_PrintString", False
|
||||
AddQBMethod "FUNCTION", "_PrintWidth", False
|
||||
AddQBMethod "SUB", "_PutImage", False
|
||||
|
|
Loading…
Reference in a new issue