News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

SDL 3

Started by Matei, November 01, 2025, 09:49:04 AM

Previous topic - Next topic

Matei

Quote from: Matei on November 21, 2025, 11:03:44 PMfullscr=0 - the controls didn't work,

Actually they did but the image doesn't update. Edited file graphics/graph2d.c, lines 276...:

#elif SDLVER==2
  if(RGLOB_initgr==0){printf("display(): Screen not initialized\r\n"); exit(1);}
  if(SDL_UpdateWindowSurface(RGLOB_window)<0){
    printf("%s",SDL_GetError());
    exit(1);
  }
#else

Error:

QuoteWindow surface is invalid, please call SDL_GetWindowSurface() to get a new surface

Which version of xMOn@D do you have? I have 0.18.0.

Matei

https://disenchant.net/tyrquake/

Tyrquake works, but it uses "SDL_CreateRenderer()" instead of "SDL_GetWindowSurface()".

https://wiki.libsdl.org/SDL2/SDL_CreateRenderer

https://gamedev.stackexchange.com/questions/180077/in-sdl-what-is-the-difference-between-using-a-surfaces-and-a-renderer

However, unlike my game, tyrquake with SDL 2 had a very low framerate on this laptop with Fedora 14, although it worked well with X11:

https://www.miniputer.com/Acer/Aspire_3000.html

https://matei.one/gnxfed14.html

Duplode

Quote from: Matei on Yesterday at 05:03:16 PMWhich version of xMOn@D do you have? I have 0.18.0.

0.18.0 here as well.

Anyway, I found a reasonable workaround for me on the XMonad side: remove the borders of Simcar windows upon window creation. If I were to insist on having the borders, it would also have been possible to fix it by growing the window to account for the border, along the lines of what's described in this issue tracker comment.

Matei

Those red borders bother me when I try to view a video with MPlayer at full screen, but for the game just leave them:

https://wiki.libsdl.org/SDL3/SDL_GetWindowSizeInPixels

I will post the fixed graphics/forsdl3/graph2d.c file for you to test it (I can't), but I just found out there might be other problems:

https://wiki.libsdl.org/SDL2/SDL_GetWindowSizeInPixels

"This function is available since SDL 2.26.0."

So for SDL 2 I'll have to use this:

https://wiki.libsdl.org/SDL2/SDL_GetWindowSize

So I will also post file graphics/graph2d.c which I also can't test, so you should, because as mentioned above, my problems with SDL 2 in xMoNad are others - the pointer given by SDL_GetWindowSurface() and the size of the window change after the rendering starts (function display()).

Matei

Attached file graphics.tar.gz. First set the settings in xmoNAd back to where they were and try version from simcarstunts-6.2.0:

https://matei.one/idxscr.html#download

If the problems still occur, then download file attached here, put files graph2d.c from it in the game source, recompile and see what happens. You can also try with various resolutions in full screen (fullscr=1), with both SDL 3 and SDL 2 (ex.: 960x720).