We're using Nim and the sdl2_nim binding library to access sdl2 and sdl2_gpu. GPU_Init is invoked to create the screen target and this successfully creates the underlying window and everything works fine.
However, by default the window has no title or icon. We tried to use the code below to access the underlying window so we could call SDL functions for setting the title and icon. This works on Linux but on Windows it generates a fatal SIGSEGV exception when it accesses target.context:
let target = init(uint16 gameWidth, uint16 gameHeight, uint32 windowFlags)
if target == nil:
raise newException(Exception, "Failed to init SDL!")
if target.context != nil:
let window = getWindowFromId(target.context.windowID)
window.setWindowTitle(title)
if iconFilename.len > 0:
let iconSurface = loadSurface(iconFilename)
window.setWindowIcon(iconSurface)
freeSurface(iconSurface)
My guess is that the binding wrapper struct for the Target object may be out of date and missing certain fields that cause the context field to be misaligned. We're going to review the bindings to see if we can find anything missing, but if you can suggest any solutions that would be great! Thanks!
I'm working on this with @avahe-kellenberger AND THERE IS ONLY 32 HOURS LEFT IN THE GAME JAM HELP!
We're using Nim and the
sdl2_nim
binding library to access sdl2 and sdl2_gpu.GPU_Init
is invoked to create the screen target and this successfully creates the underlying window and everything works fine.However, by default the window has no title or icon. We tried to use the code below to access the underlying window so we could call SDL functions for setting the title and icon. This works on Linux but on Windows it generates a fatal SIGSEGV exception when it accesses
target.context
:My guess is that the binding wrapper struct for the
Target
object may be out of date and missing certain fields that cause thecontext
field to be misaligned. We're going to review the bindings to see if we can find anything missing, but if you can suggest any solutions that would be great! Thanks!I'm working on this with @avahe-kellenberger AND THERE IS ONLY 32 HOURS LEFT IN THE GAME JAM HELP!