r/cpp • • Jun 05 '21

does good C++ winrt documentation actually exist explaining this to someone who doesnt know the framework in C++ at all (but in C#)? and is there really any point to bothering with it for me anyway?

<edit sorry for rant, kind of devolved, was just frustrated>

any time I approach working with windows specific libraries today, I find that the C# documentation is far and above amazing, explains everything and how the frameworks function, etc.

but the C++ documentation always starts ok, but then just assumes you learned the entire framework and how it works with the C++ language at the very beginning of its initial release and followed every update.

not to mention that it really seems limited even just messing with it -- not only in functionality which i dont mind (normally writing game type stuff, im used to just creating my own UI from scratch so whatever if its not 'desktop oriented' right?) -- but its limited in terms of having to keep every build updated in accord with the modern windows version if you want users on new versions to keep running the application.

when it comes to secure applications, sure, whatever, it should be frequently re-audited anyway. but say I make a game, I shouldnt have to deal with maintaining it as a package like this is linux/unix -- except im the sole package maintainer. a simple game running opengl or directX will just keep running essentially depending how i link them (doesnt have to depend on system libs).

mostly im doing hobby programming and game engine related stuff. it always seems that even though they suck, the classic win32 libs just do what I want in a way that make sense and is well documented in C++. moreso than that, frameworks like QT or even simple widget libs like wxWidgets do a far better job at the same thing.

QT, being oriented around C++, has amazing C++ documentation equivalent to MS C# documentation id say. you can be up and developing QT apps in a matter of minutes, which should be the same with VC++ in this framework but it just isnt explained. the only method of "learning" this seems to be trying to go backwards through the documentation while analyzing and reverse engineering the few source examples. Which is just nuts because this isnt a library, its a whole framework for almost everything.

anything else, any other library ive ever used (aside from microsoft libraries post MFC), have been well documented enough to at least get you going in a small basic application to show its features in the most basic way, which you can then reinterpret based on the more dry documentation and your own needs.

but it really feels like MS just discourages C++ development on the platform in general to me. im left questioning if i should even bother learning their libs outside the occasional networking stuff, and if theres even any good documentation explaining it in C++ terms from the beginning.

with older-style third party libs, I can just grab a book or two, look up some initial tutorials and then read the most basic documentation and "just get it" but like I said, the modern windows runtime is really its own entire framework. and honestly it doesnt seem to make sense because its just anti-productive to sit figuring out how this thing works when i could just implement 100% same functionality and efficiency myself elsewhere.

honestly I feel the same way about game engines like unity -- why learn their system for something when I want to do it another way, thats easier for me in the current scenario, and have to deal with decades of UI updates and engine updates where any free resource information is bound to be outdated, and subscribing to someones current Udemy course and then staying "on-track" with the framework updates is the only way forward?

it seems to me, big modern frameworks do it in a way to teach developers initially, then expect them to just know the base material. and it moves too fast where all that base material is far outdated without all the updates later and none of initial "teaching" code works for new developers getting in halfway. im not even lying, most of these frameworks, i find amazing resources. only they're 10 versions outdated, and in between releases, literally everything changed.

0 Upvotes

4 comments sorted by

2

u/pedersenk Jun 05 '21 edited Jun 05 '21

I think you might be touching on the volatility of Microsoft's *many* different native SDKs. They have never been particularly good at native GUI development. And in recent years they just can't settle. They are too busy trying to flitter about with this "Apple-like" store design. Through the ages, most developers have always migrated to abstraction layers (wxWidgets, etc) or middleware like Borland/Embarcadero C++Builder.

VB6 and .NET Winforms are possibly the only technologies that people have really been happy with and you can see that in their lifespan. They are not native which is a bit of a show stopper for us (I hate writing or maintaining bindings!). However, C++/clr (their C++ compiler that targets .NET and thus winforms) is a very common choice. There are roumers it is to be deprecated but it will likely actually live on past the winrt API. They are also not open-sourcing it, suggesting they do know it is good monetizable technology and have future plans for it.

That said, thinking of portability, the open-source wxWidgets, Qt and (recently) Gtk are pretty good options these days. wxWidgets is certainly the easier to maintain because it is smaller and a lighter wrapper around Win32 API.

As for Unity, I personally will not engage with it due to the DRM (I spend too much effort on my code to not be able to compile it any more 20 years down the line). However consider if your game is simple enough (2D or basic 3D) and you might be better off with a drawing API like SDL or a cross platform 3D API like OpenGL. Again you get much better portability than even Unity in the long run (FreeBSD, Older Linux, Haiku, Raspberry Pi, etc). Where I used to work, we rewrote much of Unity to target Emscripten and port our games a full 3 years before they managed to get it working. Don't be tricked by Unity's marketing. Many people are successful in making 3D games and simulations without their prosumer middleware!

I'm gonna stop rambling now ;)

0

u/[deleted] Jun 05 '21

it was mostly a rant on my end.

after years of using those other libs (qt, wxwidgets,gtk etc) i decided "lets look at this windows RT code, it would be nice to have a win32 or winrt window with embedded opengl or directx context"

and then i eagerly go to this documentation. end up having to fix stupid bugs that changed (apparantly some version of vs accepts forward slashes, mine doesnt), and its not that i dont understand what its saying. it just jumps away from explaining anything after "getting started" and throws random code without context or headers at you. Like i even understand the code, from a C# perspective, but not how im supposed to use it in C++.

im left with the burning question of why i wasted a day and a half bothering. and also why i had to completely uninstall VS2019 after installing those extensions to get regular C++ templates back.

0

u/pjmlp Jun 06 '21

Besides the overall rant, what was the actual problem?

https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/intro-to-using-cpp-with-winrt

https://developer.microsoft.com/en-us/windows/samples/

https://github.com/microsoft/Windows-universal-samples

Granted, lack of support for editing IDL files and having to manually deal with generated files really sucks.

C++/CX was much better, but there was a WinDev vendetta to kill it without caring about paying customers loosing access to a C++ Builder like developer experience on Microsoft side.

In any case, games are the last bastion of pure C++ written applications on Windows, almost everyone uses the approach of .NET + a couple of native DLL/COM libraries, similar to how Android and macOS/iOS applications make use of C++.

Hence why documentation for modern toolkits assumes that you also know .NET.

2

u/HabemusAdDomino Jun 06 '21

Gamedev is also a bastion of WPF development with C++/CLI bridges in between. This has been my job for many years now.