1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-09-19 20:14:58 +00:00

Implemented _Cosh, _Sinh.

This commit is contained in:
William Barnes 2022-04-26 20:29:34 -04:00
parent eb31ea367a
commit f12cef7bfb
4 changed files with 23 additions and 3 deletions

View file

@ -35,11 +35,11 @@ CodeMirror.defineMode("qbjs", function(conf, parserConf) {
// TODO: adjust for QB
var atomWords = ['true', 'false', 'nothing', 'empty', 'null'];
var builtinFuncsWords = ['_alpha', '_alpha32', '_atan2', '_autodisplay', '_blue', '_blue32', '_continue', '_copyimage', '_delay', '_dest', '_dest',
var builtinFuncsWords = ['_alpha', '_alpha32', '_atan2', '_autodisplay', '_blue', '_blue32', '_continue', '_copyimage', '_cosh', '_d2r', '_delay', '_dest', '_dest',
'_display', '_fontwidth', '_freeimage', '_green', '_green32', '_height', '_instrrev', '_limit', '_keyclear', '_keydown',
'_keyhit', '_loadimage', '_mousebutton', '_mouseinput', '_mousex', '_mousey', '_newimage', '_pi', '_printstring', '_printwidth',
'_putimage', '_red', '_red32', '_resize', '_resizewidth', '_resizeheight', '_rgb', '_rgba', '_rgb32', '_rgba32', '_round',
'_screenexists', '_sndclose', '_sndopen', '_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol',
'_putimage', '_r2d', '_red', '_red32', '_resize', '_resizewidth', '_resizeheight', '_rgb', '_rgba', '_rgb32', '_rgba32', '_round',
'_screenexists', '_sinh', '_sndclose', '_sndopen', '_sndplay', '_sndloop', '_sndpause', '_sndstop', '_sndvol',
'_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',
'oct', 'paint', 'point', 'preset', 'print', 'pset', 'right', 'rtrim', 'rnd', 'screen', 'shared', 'sgn', 'sin', 'sleep', 'space', 'sqr', 'str', 'swap', 'tan',

12
qb.js
View file

@ -163,6 +163,10 @@ var QB = new function() {
return destImageId;
};
this.func__Cosh = function(x) {
return (Math.exp(x)+Math.exp(-x))/2;
};
this.sub__Delay = async function(seconds) {
await GX.sleep(seconds*1000);
};
@ -471,6 +475,10 @@ var QB = new function() {
return true;
};
this.func__Sinh = function(x) {
return (Math.exp(x)-Math.exp(-x))/2;
};
this.sub__SndClose = function(sid) {
GX.soundClose(sid);
};
@ -882,6 +890,10 @@ var QB = new function() {
y0 = screen.lastY + y0;
}
if (borderColor == undefined) {
borderColor = fillColor;
}
var pixelStack = [[Math.floor(x0), Math.floor(y0)]];
while (pixelStack.length) {

View file

@ -2500,6 +2500,8 @@ if (QB.halted()) { return; }
await sub_AddQBMethod( "FUNCTION", "_Blue", False);
await sub_AddQBMethod( "FUNCTION", "_Blue32", False);
await sub_AddQBMethod( "FUNCTION", "_CopyImage", False);
await sub_AddQBMethod( "FUNCTION", "_Cosh", False);
await sub_AddQBMethod( "FUNCTION", "_D2R", False);
await sub_AddQBMethod( "SUB", "_Delay", True);
await sub_AddQBMethod( "FUNCTION", "_Dest", False);
await sub_AddQBMethod( "SUB", "_Dest", False);
@ -2525,6 +2527,7 @@ if (QB.halted()) { return; }
await sub_AddQBMethod( "SUB", "_PrintString", False);
await sub_AddQBMethod( "FUNCTION", "_PrintWidth", False);
await sub_AddQBMethod( "SUB", "_PutImage", False);
await sub_AddQBMethod( "FUNCTION", "_R2D", False);
await sub_AddQBMethod( "FUNCTION", "_Red", False);
await sub_AddQBMethod( "FUNCTION", "_Red32", False);
await sub_AddQBMethod( "FUNCTION", "_Resize", False);
@ -2536,6 +2539,7 @@ if (QB.halted()) { return; }
await sub_AddQBMethod( "FUNCTION", "_RGBA32", False);
await sub_AddQBMethod( "FUNCTION", "_Round", False);
await sub_AddQBMethod( "FUNCTION", "_ScreenExists", False);
await sub_AddQBMethod( "FUNCTION", "_Sinh", False);
await sub_AddQBMethod( "SUB", "_SndClose", False);
await sub_AddQBMethod( "FUNCTION", "_SndOpen", False);
await sub_AddQBMethod( "SUB", "_SndPlay", False);

View file

@ -2658,6 +2658,8 @@ Sub InitQBMethods
AddQBMethod "FUNCTION", "_Blue", False
AddQBMethod "FUNCTION", "_Blue32", False
AddQBMethod "FUNCTION", "_CopyImage", False
AddQBMethod "FUNCTION", "_Cosh", False
AddQBMethod "FUNCTION", "_D2R", False
AddQBMethod "SUB", "_Delay", True
AddQBMethod "FUNCTION", "_Dest", False
AddQBMethod "SUB", "_Dest", False
@ -2683,6 +2685,7 @@ Sub InitQBMethods
AddQBMethod "SUB", "_PrintString", False
AddQBMethod "FUNCTION", "_PrintWidth", False
AddQBMethod "SUB", "_PutImage", False
AddQBMethod "FUNCTION", "_R2D", False
AddQBMethod "FUNCTION", "_Red", False
AddQBMethod "FUNCTION", "_Red32", False
AddQBMethod "FUNCTION", "_Resize", False
@ -2694,6 +2697,7 @@ Sub InitQBMethods
AddQBMethod "FUNCTION", "_RGBA32", False
AddQBMethod "FUNCTION", "_Round", False
AddQBMethod "FUNCTION", "_ScreenExists", False
AddQBMethod "FUNCTION", "_Sinh", False
AddQBMethod "SUB", "_SndClose", False
AddQBMethod "FUNCTION", "_SndOpen", False
AddQBMethod "SUB", "_SndPlay", False