Win32 and SFML noodling

I ran into a problem that I thought would be best solved by combining a prior UI framework and SFML. There are a zillion reasons you’d want to do this – if you need any kind of UI element (button, menu, text entry, etc) with an SFML project you quickly run into this crossroad.

GTK+, the only UI framework I’m familiar with, has a C API with its own wacky OOP implementation. There is a C++ binding called GTKMM, but some of the tutorials and code samples I’ve seen are bit off-putting.

I researched Qt and didn’t find a lot of hope there. Any framework that seems to insist on using its own development environment sounds like a bad time. There are Visual Studio plugins, but I didn’t see any clear indication that they would work with Visual Studio Express 2013.

Visual Studio Express 2013 obviously has Win32 support and project wizards built in, so what about that?


This seems to work. I referenced the Win32 sample on the SFML creator’s Github repository, as well as this outdated tutorial on the SFML site itself.

A few years back I ran through a few Win32 tutorials in order to understand some demo code at work, but the stuff that gets generated with VSE2013 looks nothing like it. I’m going to have to do a lot of research if I want to keep going forward with this.

There are lots of big questions, like how do I intercept SFML events? Does the Win32-generated window get them first, and I have to intercept/interpret those and then pass them to SFML? What about timing loops (a big deal in some of the game programming I’ve been doing)? Why does the window go white when I resize it?

This entry was posted in Programming. Bookmark the permalink.

1 Response to Win32 and SFML noodling

  1. How I fixed the issue of the sfml view going white is by declaring the RenderWindow variable as a global variable and then using the create function within WinMain. Then, I put in clear() and display() statements within the WndProc WM_SIZE and WM_MOVE cases. This way whenever I resize or move the window, it renders the frame again.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s