Sign in to follow this  
David Higa

Should i learn Win32 or UWP?(C++, Directx)


Recommended Posts

Hey Gamedev,

 

Which application programming interface(API) should i learn for graphic and heavy mathematics software? Win32 or UWP.

Is there an advantage of picking UWP over Win32 other than cross-platform?

Performance?

Future proof?

 

 

Thank You!

Edited by David Higa

Share this post


Link to post
Share on other sites

Win32 is a old, C- & COM-style, solid-proof set of APIs. It works on every of PC version supported of Windows (though obviously with some limitations), and will probably works till the end of Microsoft Windows on PC.

With Win32 APIs you are like a god in the OS: you are allowed to do quite everything, which means you are able to obtain quite every issue that exists in past, present and future in all discovered and undiscovered dimensions [cit.] of Microsoft Windows. Some of this issues can be really difficult to catch for a newbie.

Using Win32 will quite obligate you to deal with how the OS works in many different ways (which is a good thing, imo). Some (few) Win32 APIs will be more familiar if you have a POSIX development experience. You will find also tons of examples and books, both good and bad, around the web.

If you exclude any used third party library, Win32 applications do not need usually any kind of extra license to be distributed and sold.

 

UWP is kinda new, refreshed and restyled (renamed?) version of the APIs for Windows Store. It works for both PC (windows 10) and Phones (Windows 10 mobile).

UWP allows a subset of Win32 API, larger then was with W8/W8.1. This means you are less inclined to commit disasters.

You will find more friendly if you have mobile development experience. You will find less example and books around the need, but on github there is a good set of Microsoft samples.

 

If we speak about pure performance, Win32 applications are not sandboxed by default like UWP and you are allowed to use the APIs with lowest level of abstraction. However, generally speaking UWP environment is not an issue at all if we talk about performance and you could find easily to boost your application with hardware accelerated GUI elements thanks to XAML.

If we speak about DirectX, you can use the news APIs in both Win32 and UPW environments, though some restrictions apply (biggest example: swap-chain).

Edited by Alessio1989

Share this post


Link to post
Share on other sites
The decision mostly comes down to platform support. UWP lets you reach all Windows 10 based platforms -- PCs, Xbox One, SurfaceHub, even ARM-based devices like Windows Phone and Raspberry Pi (model 2 and 3, through the Windows IoT platform). Its a single, mostly-uniform API that fairly-smoothly lets you target different devices characteristics with a single application. Its also the preferred format for the Windows Store, and its the only way you can get your app on Xbox without a bigger company backing you (FYI, UWP on Xbox One is D3D11, at least for now).

Win32 works on all versions of Windows for PCs, but isn't otherwise relevent to any devices you're likely to care about or have access to. The main benefit from a platform perspective is that Windows 7 and even Windows XP are still relevant in some parts of the world, and also in some corporate environments (mostly mid-sized companies tied down for legacy reasons, or small companies who can't afford to upgrade so frequently, and lots of small mom-and-pops who don't replace anything until it breaks.)

Honestly, you probably should learn both to at least a reasonable degree. And you probably will, even if you don't want to. But you can use the information here to decide where to invest first.

Share this post


Link to post
Share on other sites

Which application programming interface(API) should i learn for graphic and heavy mathematics software? Win32 or UWP.

 

Qt

 

Qt is really cross-platform (Windows, Mac, Linux, and they are working on or have support for iOS and Android).

Qt is free, even for closed-source commercial use (ignore the website's intentional fear-mongering to make you pay for a license - it is dual-licensed under the LGPL license)

Qt is much easier to learn and use than Win32, and much easier to customize the appearance of.

Qt has a large community (check qtcentre.org) and fantastic documentation.

 

Here's a screenshot of the Qt-based program that I'm working on.

Share this post


Link to post
Share on other sites
Yes.

Learn both

Also learn the other things people are recommending, like Qt. Not knowing Qt reduces the number of jobs you're qualified for. Not knowing raw Win32 or UWP reduces the number of jobs you're qualified for. Not knowing <insert technology here> reduces the number of jobs you're qualified for.

Share this post


Link to post
Share on other sites

It depends - are you willing to lose a significant portion of your potential customer base by using a newer technology (UWP requires Windows 10 - less than 15% of the internet marketshare for PCs)?

Microsoft also tends to create abandon rarely used technology after a few years. If UWP doesn't catch on, in 5 years it might be worthless knowledge. But they can't really abandon Win32 - it's core to their platform.

Share this post


Link to post
Share on other sites

It depends - are you willing to lose a significant portion of your potential customer base by using a newer technology (UWP requires Windows 10 - less than 15% of the internet marketshare for PCs)?

Microsoft also tends to create abandon rarely used technology after a few years. If UWP doesn't catch on, in 5 years it might be worthless knowledge. But they can't really abandon Win32 - it's core to their platform.

 

15% of share (a lot more if we speaking about gamers) is not bad at all if we consider that Windows 10 was released less than a year ago.

 

When Microsoft decided to abandon a technolgy, usually it continues to work without any issue on future versions of Windows. Keep in mind that UWP on C++\CX and WinRT, are actually all based on COM and Win32. This mean you can target UWP with "pure" C++ if you want, however this need actually a lot of work and you can also use the WRL template library to mitigate that.

On Windows platform Win32 is like the CRT: they are both the meaning of life for the Windows platform itself, you cannot kill Win32 or the CRT without killing the entire Windows platform.

 

A guy called Kenny Kerr started writing a pure C++ library called "Modern" to target WinRT without C++\CX and to replace WRL. It also joined later Microsoft, so hopefully Microsoft will release in the future a complete version of "Modern" to target WINRT and create UWP application using pure C++ without the proprietary component extension (C++\CX) or the usage of WRL. A library like that would solve all kind of issues regarding targeting both UWP and Win32 desktop application.

Edited by Alessio1989

Share this post


Link to post
Share on other sites

Win32 is the actual base of entire OS, it is the native run time, that even managed runtime (entire C#) works over. C# and c++ native runtimes are interchangable for programer as well, with CppCLI modules. 

 

Though CLI should be used sparsely. It is c++ that will always get your way, though in much higher difficultly. That is why more light weight and practical layers get introduced, what is UWP as well.

Share this post


Link to post
Share on other sites

 

It depends - are you willing to lose a significant portion of your potential customer base by using a newer technology (UWP requires Windows 10 - less than 15% of the internet marketshare for PCs)?

Microsoft also tends to create abandon rarely used technology after a few years. If UWP doesn't catch on, in 5 years it might be worthless knowledge. But they can't really abandon Win32 - it's core to their platform.

 

15% of share (a lot more if we speaking about gamers) is not bad at all if we consider that Windows 10 was released less than a year ago.

 

When Microsoft decided to abandon a technolgy, usually it continues to work without any issue on future versions of Windows. Keep in mind that UWP on C++\CX and WinRT, are actually all based on COM and Win32. This mean you can target UWP with "pure" C++ if you want, however this need actually a lot of work and you can also use the WRL template library to mitigate that.

On Windows platform Win32 is like the CRT: they are both the meaning of life for the Windows platform itself, you cannot kill Win32 or the CRT without killing the entire Windows platform.

 

A guy called Kenny Kerr started writing a pure C++ library called "Modern" to target WinRT without C++\CX and to replace WRL. It also joined later Microsoft, so hopefully Microsoft will release in the future a complete version of "Modern" to target WINRT and create UWP application using pure C++ without the proprietary component extension (C++\CX) or the usage of WRL. A library like that would solve all kind of issues regarding targeting both UWP and Win32 desktop application.

 

15% - you're right, it's not bad, it was just a point. And it's likely to go up quite quickly. I hear it's a pretty solid OS, but I'm sticking with Win7 for now. You're also right about marketshare among gamers probably being higher - but that's only because it's the version of Windows that's already installed on their gaming rig (I imagine DirectX 12 might be another reason. Was there some technical reason for Microsoft not backporting DX12 to Windows 8 and 7, or is this just an "upgrade already" thing?)

As for Microsoft abandoned technology continuing to function properly on new versions of the OS - try playing an old game using DirectDraw on Windows 8 or 10. Heck, they messed with DWM in Vista and 7.

Share this post


Link to post
Share on other sites

>> try playing an old game using DirectDraw on Windows 8 or 10. 

 

and this after they promised 100% backward software compatibility for ALL DX versions 

 

can't trust MS any further than you can shoot them.

 

EDIT: note that if the hardware is not DDraw compatible, it's not MS's fault.

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

 

 

It depends - are you willing to lose a significant portion of your potential customer base by using a newer technology (UWP requires Windows 10 - less than 15% of the internet marketshare for PCs)?

Microsoft also tends to create abandon rarely used technology after a few years. If UWP doesn't catch on, in 5 years it might be worthless knowledge. But they can't really abandon Win32 - it's core to their platform.

 

15% of share (a lot more if we speaking about gamers) is not bad at all if we consider that Windows 10 was released less than a year ago.

 

When Microsoft decided to abandon a technolgy, usually it continues to work without any issue on future versions of Windows. Keep in mind that UWP on C++\CX and WinRT, are actually all based on COM and Win32. This mean you can target UWP with "pure" C++ if you want, however this need actually a lot of work and you can also use the WRL template library to mitigate that.

On Windows platform Win32 is like the CRT: they are both the meaning of life for the Windows platform itself, you cannot kill Win32 or the CRT without killing the entire Windows platform.

 

A guy called Kenny Kerr started writing a pure C++ library called "Modern" to target WinRT without C++\CX and to replace WRL. It also joined later Microsoft, so hopefully Microsoft will release in the future a complete version of "Modern" to target WINRT and create UWP application using pure C++ without the proprietary component extension (C++\CX) or the usage of WRL. A library like that would solve all kind of issues regarding targeting both UWP and Win32 desktop application.

 

15% - you're right, it's not bad, it was just a point. And it's likely to go up quite quickly. I hear it's a pretty solid OS, but I'm sticking with Win7 for now. You're also right about marketshare among gamers probably being higher - but that's only because it's the version of Windows that's already installed on their gaming rig (I imagine DirectX 12 might be another reason. Was there some technical reason for Microsoft not backporting DX12 to Windows 8 and 7, or is this just an "upgrade already" thing?)

As for Microsoft abandoned technology continuing to function properly on new versions of the OS - try playing an old game using DirectDraw on Windows 8 or 10. Heck, they messed with DWM in Vista and 7.

 

 

Biggest technical reason to not porting directly D3D12 to NT 6.x family OS was the WDDM 2.0 reservation memory model. Other secondary aspects involve DXGI and the window compositor...

 

Most DirectDraw games works fine on my Win10 rig. Only the games of the 16-bit to 32-bit era translation give sometimes issue, mostly related to wrong system capabilities enumerations due the use of small integer values to store values. For older games there is DOS-BOX.

Edited by Alessio1989

Share this post


Link to post
Share on other sites

just saying: with kb3156421 the frame-rate can be unlocked on UWP (and classic WINAPI desktop) application too on border-less mode. Here is un updated sample from Microsoft :https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/Samples/UWP/D3D12Fullscreen/src

See stdafx.h to see the needed interface and constant declarations. This also should allows adaptive synchronization like Free/Adaptyve-sync and G-Sync.

 

Finally UWP is becoming a valid target for games too..

Edited by Alessio1989

Share this post


Link to post
Share on other sites

Depends on what you want to achieve. If you want to be really good at creating apps for Windows Phone and Windows Store go for UWP! 
The real question is do you really want to do that? 

 

For games all you really need is a window - and to create an emty window for almost every plaftorm is ~200 lines of platform specific code. If you want to create UI tools for gamedevelopment - ImGui is pretty popular... What I'm trying to say is that you usually don't need the platform default UI system unless you do apps (and for me games != apps).

 

Qt is an option, but my god I hate it so much.....

Share this post


Link to post
Share on other sites

People forget that before UWP, there was the Metro/Modern application platform for Windows 8 and now it's dead. What's telling us that Microsoft is not going to come out with some new API next year and kill off UWP? I mean, it's not like the platform has been without criticism; some big name game developers are already calling for the death of the platform, and tying the platform to the Windows Store when nobody actually uses the Windows Store or knows it exists doesn't exactly capture my heart as a developer. (Not even Apple can do that on the Mac.) As much as I dread using Qt, GTK, wxWidgets or MFC, I would pinch my nose and use those for now, and then cross my fingers that Microsoft gets things right for the UWP sooner than later. I would love to use the UWP for my project but as it is right now it's a no-go.

 

On a side note, I don't get why people dislike the CX language extensions so much. The objects of the UWP class library are glorified COM objects, and the CX extensions simplifies their manipulation as well as the creation of new ones, so why not make it easy on you and use those when you deal with Microsoft APIs? It still feels very much like C++ and is so much easier and convenient than the nameless mess that you have to deal with on competing platforms to get C++ to play well with the OSs. (Namely, JNI on Android and Objective-C on Apple.)

Share this post


Link to post
Share on other sites

I spent a good few months learning UWA (but couldn't get my hands on an XBox, which was the plan), plus a Windows Phone game didn't work out with almost zero downloads (search is borked on MS' store...).

 

OpenGL was better for me too. Which Angle provided and seemed better than returning to Win32, at the time. But ultimately there was/is no incentive at all to stick with UWA, so I returned to Win32 and let my developer account expire.

 

If anyone feels the need then there's always https://developer.microsoft.com/en-us/windows/bridges/desktop

Share this post


Link to post
Share on other sites

On a side note, I don't get why people dislike the CX language extensions so much. The objects of the UWP class library are glorified COM objects, and the CX extensions simplifies their manipulation as well as the creation of new ones, so why not make it easy on you and use those when you deal with Microsoft APIs? It still feels very much like C++ and is so much easier and convenient than the nameless mess that you have to deal with on competing platforms to get C++ to play well with the OSs. (Namely, JNI on Android and Objective-C on Apple.)


If I had to guess? The syntax is very similar to Managed C++, which a lot of people aren't too fond of. I've heard multiple people I know actually refer to snippets of C++/CX code as "managed code" (which it isn't), so there could be a misconception there that you have to write UWP apps in a managed environment.

Share this post


Link to post
Share on other sites

Which application programming interface(API) should i learn for graphic and heavy mathematics software? Win32 or UWP.

Is there an advantage of picking UWP over Win32 other than cross-platform?

Performance?

Future proof?

 

Have you considered neither?

 

If you want to learn about performance, learning a bit about computer architecture, and about GPU programming, should give knowledge applicable to either platform, as well as others.

 

If you want future proof, what about using more open, or at least, already cross-platform APIs?  Depending on your needs, there are several options.

 

-- David L.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this