if you want to give a K a graphics interface, you really need to make some choices about how it should work, both in terms of getting an API/format that is convenient for K and one that is reasonably mechanically sympathetic
iKe uses a big data structure describing the scene to draw, which has some advantages and disadvantages. if you want an imperative API, it means your programs are going to be imperative. Should drawing be raster or scalar? Both? Paletted colors, or packed? Support for shaders? If so, what does a shader look like?
do you want something completely general, or do you want something that will have an aesthetic style to it
iKe has a minimal set of simple drawing operations, which are enough for many interesting things, but not always in the most convenient or efficient way, and some stuff would be a huge pain
@ngn you pass strings to js? how about passing k values, wouldn't that be easier on the k-side? i used to encode canvas api calls in a k-dict. but you could use a list as well, e.g.: draw(fillRect;10;10;100;200)
On the js side, some of the canvas api is a function call, while others are assignments. i did this: if(typeof(z[s])==="function")z[s](...a);else z[s]=a
@ngn if the K is just spitting out big chunks of JS, most of the code is going to be JS, which kinda defeats the point of using K, no? It's a problem which requires serious thought and design effort.
you need to design an API, not just pass the buck to a pre-existing one built haphazardly with a different language and type system in mind
@JohnE wouldn't it be the same if there's a layer of helper functions that accept k args and turn them into js strings, for instance square:{"ctx.fillRect(",(","/$x,y,z,z),");"}
now, what helper functions should that layer have to make it more convenient for game dev? - i don't know..