SDL_Image Win10 WinRT UWP No VS2015 project in latest source

Greetings all,
I’m working on a side-scrolling, 2D classic style SHMUP, and even though it’s early days and still a work in progress, I’m trying to keep the code clean and as cross platform as possible, hence the reason for using SDL2.

It’s currently being developed as a Win32 app on the PC and I’d like to try porting it at this early phase to a Win 10 WinRT UWP app, just to see how that goes. I’ve set up a project in VS2015 community as per the instructions on David Ludwig’s SDL WinRT site (https://hg.libsdl.org/SDL/file/tip/docs/README-winrt.md) using the Win 10 VS2015 project and the example code in step 6A of the instructions, building a Win10 UWP app that goes full-screen with a green background.

The next step is to import the game’s Win32 source files into it but I’ve come across a problem in that I’m using SDL_Image to load PNG files but there doesn’t seem to be a VS2015 UWP project for that even in the latest source https://hg.libsdl.org/SDL_image/file/4088a517f9a5/VisualC-WinRT.

Can anyone confirm that there is just the WinRT80/81 and Win phone 80/81, VS 2013/5 files and not a Win10 UWP_VS2015 project for SDL_Image?

Note: I only intend to build this game for PC’s, because large screens and gamepad inputs are ideal for this game, (I think a touchscreen input would be unsuitable in the extreme, hence no mobile version), so technically I could just build a WinRT81 app instead.

Thank you in advance, and for the great work you are doing with this library :smiley:

Matt

I can confirm that MSVC project files haven’t been added for SDL_Image + UWP. I can see if I can find some time over the next couple of days to put some together, but I make no guarantees.

If you desperately need something in the meantime, I’d highly recommend taking a look at Sean Barrett’s excellent, single-file stb_image library (available at https://github.com/nothings/stb), possibly in conjunction with Daniel Gibson’s SDL+stb_image wrapper at https://github.com/DanielGibson/Snippets/blob/master/SDL_stbimage.h. The performance of the loader will probably be a bit slower, however the integration into a project should be pretty straight-forward: include each library’s file into your app’s project, then read the top of each lib’s file for further instructions.

Cheers,
– David L.

Thank you for those links David. I was looking to ditch SDL_Image anyway as I only wanted to load in PNGs and needed a simple PNG loader function that I could drop right into my image loader classes. I did try LodePNG http://lodev.org/lodepng/ which did decode the PNG perfectly, but I had problems making a SDL texture out of the pixel data.

Best, Matt.

MattRobinson wrote:

Thank you for those links David. I was looking to ditch SDL_Image anyway as I only wanted to load in PNGs and needed a simple PNG loader function that I could drop right into my image loader classes. I did try LodePNG http://lodev.org/lodepng/ which did decode the PNG perfectly, but I had problems making a SDL texture out of the pixel data.

If it helps, the SDL_stbimage library (fixed link: https://github.com/DanielGibson/Snippets/blob/master/SDL_stbimage.h ) has functions to load images to SDL_Textures (STBIMG_LoadTexture, for example).

Cheers,
– David L.

Thanks for linking my lib :slight_smile:

Regarding the performance, I did some tests a while ago (stb_image vs
libpng/libjpeg(turbo)) and for png decoding stb_image was between 0% and
40% slower than libpng (which is used by SDL_Image) - the performance
difference was bigger with bigger images. It was faster than LodePNG in
any case. For JPEG the performance was between libjpeg and
libjpeg-turbo, so it might even be faster than SDL_Image there.
More details:

Cheers,
DanielOn 04/15/2016 12:08 AM, DLudwig wrote:

If you desperately need something in the meantime, I’d highly recommend
taking a look at Sean Barrett’s excellent, single-file stb_image library
(available at https://github.com/nothings/stb), possibly in conjunction
with Daniel Gibson’s SDL+stb_image wrapper at
https://github.com/DanielGibson/Snippets/blob/master/SDL_stbimage.h The
performance of the loader will probably be a bit slower, (…)

If you are trying to use the full SDL_Image I found that the “Retarget Solution” feature can make the project work for UWP development, but you have to start with the right project, not all of them can be retargeted (tested in visual studio 2019 and SDL Image 2.0.5).

If you want to retarget the solution start with the “WinRT81_VS2013” project, I suggest cloning that folder possibly otherwise your UWP project will replace whatever is in there.

It’s not necessarily that simple though, you will have to manually fix the webp project since it has updated and the source files are wrong… you can just delete all the source files, add the src folder which will add all the files, and then delete the .rc files to get that build to work (My advice: don’t bother trying to organize the source tree since you will just have to do this again later when it updates). You may have to take similar steps for other external libs, I found that for libpng I was able to just clone that folder with the old folder name it was looking for to make it work, but ymmv and it depends on what is updated.

I had to tinker with the output paths for each, there is a nifty value you can use there that will include the platform, and also had to fix the references for each project after adding each UWP project to my project. You may have to also fiddle with the include paths or place SDL wherever its looking for those include files.

I would share my project file but I think that since I messed with all the output and intermediate directories that its no longer quite standard. I did find someone else shared their project file here but it’s not very up to date: https://github.com/uspgamedev/ugdk-sdlimage

I would say just use NuGet but you will find that none of the offerings there contain the DLLs for every platform, so if you want to target ARM I think you have to build it yourself. I don’t like NuGet but perhaps it would be nice if there were official SDL offerings there, but I have the same issue with the Microsoft Angle library provided there, since its missing ARM support.

Hi qufighter,
Three years :smile: wow!

Since my original post I’ve ditched WinRT altogether and instead use a complete 64bit Linux tool-chain with GCC, SDL2 and Vulkan. At some point I’m going to test my game engine source on Windows 10 as a desktop app, but I’m not really concerned with that at the moment as I’ve been using Linux (first Ubuntu, now Fedora) for my personal computing and game dev system for two years now and have no reason to use Windows at all.

(I know about WSL but I’m not interested, if you want to use Linux, install Linux for free, why keep on using Windows?!?!?)

Thanks for the info though! :+1: