For me, I have settled for being able to stop the event loop, edit the code
then resume the event loop where I left off and that's working well for me.

basically I have u (for UI!) -routines
  uprep''
  ugo 0 means when SDL_QUIT is received, leave everything up, ugo 1 will
call sdl_destroywindow and sdl_quit
  uend''

and some basic run./stop code:

uend=: 3 : 0
sdl_freesurface sfc
sdl_destroyrenderer^:(appr>0) appr
sdl_destroywindow^:(appw>0) appw
sdl_quit''
smoutput 'sdl shut down'
'appw appr'=: 0 0
)

ugo =: 3 : 0
sdlprep SCREEN_X_MAX;SCREEN_Y_MAX
urun''
uend^:y ''
)

On Tue, 1 Dec 2020 at 07:25, Thomas McGuire <[email protected]> wrote:

> I was glad to see some renewed interest in SDL2 and thank you to Raul
> Miller for the suggestion of setting timer to run an event loop. I haven’t
> had the chance to try Bill Lam’s suggestion of creating a tight event loop
> under Jconsole yet.
>
> I have attached my code for a simple example that:
>  opens a window,
> displays the toucan.bmp that comes with J,
> and then allows you to quit by pressing the close window control on the
> displayed window.
>
> The only gotcha at this point is that a subsequent rerun under Jqt, the
> event system in SDL2 doesn’t register any events. So the app will hang and
> the window stays open. I have to quit Jqt entirely and restart to rerun the
> application properly. This is minimally annoying from a debugging stand
> point. Jqt comes back up quickly enough after a shut down and coding using
> a dll library can cause its share of hanging the entire Jqt interface when
> mistakes in the dll wrapper are made.
>
> I presume I am running into threading/Jqt state issues or perhaps the call
> to SDL_Quit is not running like I think it is. At any rate for my purposes
> I am pretty happy with the result. It has been enhancing my understanding
> of Graphics/Game programming issues while I continue to work in J.
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to