SDL2/Native GUI - Making a SDL2.0/WxWidgets interface

hi! sorry i don't post much, here's a bit of a rant to get me back into the swing of posting more often.

so the past ~2 months i've been on-and-off trying to tackle one problem that's been a total bitch to me: integrating an sdl2.0 context in wxwidgets. i want to create a 2d level editor for my own toy engines

i know there's a couple of good 2d level editors out there already, like tiled, gleed2d, and ogmo, but they are all still very... manual. this could be a great, or rewally awful idea, but i want a 2d editor to have a way to import entities etc in your own custom way, and to let you make your own export templates. small thing, but it'd be awesome, and it only needs to be as complex as gamemaker's room-editor dialog.

gamemaker's room editor

(with the exclusion of the "views" and "physics" tab too. seems actually kinda easy right? ..if i didn't completely swear off using electron, i'd have probably made this already...)

maybe if i had better luck with this project, it could be entirely extended into a humble open-source version of gamemaker. my engine (or end-game vision of it) accomodates that style sorta well, using Lua as a scripting language and following the same entity-based init/step/draw idea.


following the same idea shown in this->> set of tutorials, (but heavily modified so i could access sdl's renderer api which is way more flexible) i could make a super super basic image viewer.

two sweethearts

i'm proud of it! but it works in a pretty ass-backwards way, the viewport is a single bitmap, where the bitmap's pixels are replaced by the pixels in an sdl surface, which we can render to. it's pretty slow, so anything real-time (like moving/placing tiles) would look a little janky.

so instead i tried to do something else which was extremely ass-backwards, but it may have worked better.

the idea:

this... this seemed to sorta work at first, but then it didn't. that's it that's this whole blogpost i'm sorry there's not a happy ending. on creating the window and binding a renderer to the window's surface, it draws a pure white onto the screen - which is a good sign! it's not the system's default kinda-light-grey!

but, that's all it could draw. absolutely all attempts to draw images, squares, or even clear the screen with a color didn't work.

and that's it~!

that's all i really have to say. i tried to do the same thing (the surface/bitmap trick) in lua but getting lua-sdl2 to work on windows was a nightmare, so i might retry it one day when i have the energy to get out my seat and boot up my laptop.

thanks for reading! ill work on more interesting stuff soon

Go back home