I figured as much Bill, at least its not assembler code on a board! :D I'm happy anyway... I have a working SDL2 wrapper that is providing some good stuff, I am currently wrapping the functions from the SDL2_fgx library as it has anti-aliased rendering functions which is initially why I went for your cairo wrapper but I don't know cairo half as well as I know SDL2, and OpenGL some as well... learning J, FFI, Cairo was too much so I have re-focussed on just SDL2, next is SDL_ttf for font rendering.
I am porting an unfinished proof-of-concept game I started wiring in C way back,m if I can finish even one level in J... J makes sense for games... the starfield alone is just an array of (x,y,type,speed) tuples at the end of the day. I think games in J is a perfect opportunity to pull some more hair out. http://seancharles.xyz/posts/2019-10-06-all-at-c.html Thanks for everything. Sean. On Mon, 30 Nov 2020 at 09:48, bill lam <[email protected]> wrote: > I don't think cdcb can help you to implement event loop or similar > functions. cdcb is very restricted. the callback must happen within the > context of the call that passed the callback address. Theoretically > external codes can invoke the callback, but since J is single threaded and > has no event loop, therefore callback has no chance of being called. If you > run J in a separate thread, you will be responsible to handle cross thread > communication. > > On Mon, Nov 30, 2020, 5:22 PM emacstheviking <[email protected]> wrote: > > > I found the Lab on cdcallback and followed it, I did the qsort version > and > > it all works as described but applying it to my SDL application I got > this > > as soon as the timer kicks in, I tried different timer values to ensure > it > > was related: > > > > timerid:1 > > |stack error: sdl_renderpresent > > | sdl_renderpresent appr > > > > My callback is as simple as they come as I wanted to remove any doubts > > about cross-thread corruption, I assumed therefore that this > implementation > > would not cause any great upset: > > > > cdcallback =: 3 : 0 > > 0 > > ) > > > > So I think that cdcallback only works when in the same thread (did I miss > > that in the lab?) i.e. the main thread as obviously id SDL is creating a > > fork() call somewhere then there is likely to be some issue with stacks, > > environments etc etc etc > > > > I will dig a little more but the stack error means the stack was > exhausted, > > typically due to recursion. I checked the J source code for EVSTACK > ("stack > > error") and it seemed reasonable so I am guessing that the SDL context > > switch derailed the J engine in its tracks. > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
