Advertisement

Skinning a Windows Dialog in a Game

Started by February 27, 2025 11:47 PM
2 comments, last by wdolson 9 hours, 9 minutes ago

We are developing a non-real time game (turn based) that has tons and tons of data the player needs to deal with. The game is written in Windows API with DirectX. There is a large map as the main screen and a lot of pop up windows to deal with various tasks the player needs to do.

Currently all the pop up windows are coded with DirectX and practically every pixel and letter is hand coded. We need to rework a number of the windows (per request of the publisher) and the bit by bit technique is too labor intensive. We don't need the timing boost DirectX gives you so I wrote a program to convert one of the pop ups to a Windows API modal dialog.

It works with a little slow down, but tolerable, but changing a dialog is vastly faster than the old technique. However now it comes to skinning the dialog to fit in with the theme of the game, I'm running into problems.

All I really need is to load a bit map for a background image and then change the colors of the controls to fit with the theme. I found this

https://web.archive.org/web/20240119093934/https://www.codeproject.com/Articles/1257/Using-Skins-Without-MFC

but it is for a skinned dialog app and I have not been able to get it to work in the dialog in our app. It runs OK, creates the bitmap, etc, but never shows.

I'm coming from the IT world. Game programming is sort of a sideline for me. I've done a lot of MFC programming in my day job. I work with the Prof-UIS library and skinning with that is fairly easy, I have an option for different themes in that program the user can select. But I've never skinned a Win API application. I've worked with Win API, but never tried any graphics with it.

Now they are talking about coding a sidebar off the main map with the theme. Again it would be easy with Prof-UIS. That toolkit has many tools for creating a bar and then inserting a dialog into it. Everything is automatically themed with whatever the selected theme is.

I saw on here someone asked about mixing Win API and MFC and the only answer to do that would be to create an MFC DLL that the API program uses. That would probably be possible with the popups turned into dialogs, but not with the sidebar.

It looks like Windows API programming is becoming a lost art. I've found resources that point to companies that went out of business or lead to dead links. Code Project, one of the best resources for this kind of thing is now gone. The articles can sometimes be accessed through a search engine into codeproject.com, but the downloads aren't there anymore. Archive.org also has the old articles up with iffy download links.

I'm open to whatever gets me there. I can do an API dialog of MFC if I can get that to work with the main program being an API program. Any suggestions?

The search term is “owner draw
There was a time long ago that I thought this was a good idea also.
Cut my teeth early on with Charles Petzold: Programming Windows 95 which was a great reference for WIN32.
Had almost everything custom drawing except the menu bar.
It certainly is do-able. Here are some thirteen-year-old examples.

Should you? Probably not.
It's one thing to start from fresh with a particular approach.
But to shoe-horn something in because the existing system is ‘too much work’ is asking for trouble.
Anyway, if I were forced to go this approach again, Charles Petzold books is where I'd turn.

Dev careful. Pixel on board.
Buckle up. Everything will be revealed.

Advertisement

Starting over isn't going to happen. The primary programmer has been working on this game something like 60 hours a week for several years.

I wrote a utility that can take the pop up code in the original game and convert it to a Windows API dialog. Just skinning is the remaining problem.

Advertisement