Various improvments.

This commit is contained in:
Brad Nelson
2022-11-18 23:42:03 -08:00
parent e9181479fc
commit e8bb29eff7

View File

@ -638,17 +638,11 @@ $ffffff value color
: box ( x y w h -- ) color fillcolor! rawbox ;
JSWORD: window { w h }
if (context.canvas.width !== w ||
context.canvas.height) {
context.canvas.width = w;
context.canvas.height = h;
}
context.canvas.width = w;
context.canvas.height = h;
~
JSWORD: viewport@ { -- w h }
if (globalObj.write) {
return [1, 1];
}
return [context.width, context.height];
~
@ -845,6 +839,10 @@ JSWORD: rawFillText { a n x y -- }
~
: fillText ( a n x y ) color fillcolor! rawFillText ;
JSWORD: textWidth { a n -- w }
return context.ctx.measureText(GetString(a, n)).width;
~
JSWORD: mouse { -- x y }
return [context.mouse_x, context.mouse_y];
~
@ -853,6 +851,10 @@ JSWORD: button { -- b }
return context.mouse_b;
~
JSWORD: random { n -- n }
return Math.floor(Math.random() * n);
~
forth definitions web
: bye 0 terminate ;