How proficient do I have to be at C++ before moving on to libraries like SFML & Win32?

Pages: 12
Apr 19, 2015 at 9:26pm
Hi, I'm a only a beginner, but these console applications are ugly and boring looking and eventually I want to move onto the Windows 32 API, .net, or SFML (a graphics library), which allow things like cursors,icons,graphics etc.) Should I wait until I'm advanced or until I'm what this guide ( http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list ) considers intermediate?
Apr 19, 2015 at 9:51pm
If you want to learn fast, start with SFML from the beginning and make a basic 2D platformer.
Apr 19, 2015 at 9:55pm
I find this as a neat beginners exercise to make sure you know the fundamentals of c++: http://www.cplusplus.com/articles/N6vU7k9E/

Sorry to preach, but you might wanna take a peek into the SDL2 library, and LazyFoo's tutorials. It does essentially everything that SFML can do, it's well respected with a long history, and its used in plenty of games.
Apr 19, 2015 at 10:05pm
"Sorry to preach, but you might wanna take a peek into the SDL2 library"

A lot of people have written that SDL is more like C and SFML is more like C++.

See :
http://www.quora.com/Which-API-do-you-prefer-and-why-SDL-2-or-SFML
http://www.reddit.com/r/gamedev/comments/1tsz5w/sfml_21_vs_sdl2/

"If you want to learn fast, start with SFML from the beginning"

Books written about Win32 programming and SFML programming, recommend being proficient in C++.
Last edited on Apr 19, 2015 at 10:09pm
Apr 19, 2015 at 11:30pm
The easiest way to become proficient in any programming language is to try and make something with it. For C++ I recommend making a 2D platformer in SFML.
Apr 20, 2015 at 3:15pm
i just started learning sfml last week, and i havent finished C++ yet, im still in polymorphism, virtual functions.

i can say that, you can now start learning sfml for 2D games
Apr 20, 2015 at 8:49pm
Not that much.

Win32 I would highly recomend avoiding if you want to keep your sanity, even if you are an experienced programmer (actually, I would advise you to stay away from it even more if you are an experienced programmer, I worry about your health, and your blood pressure would be going places). At least this was true back in the day, I guess they now have a C++ API? If so it might be better, but I'm not familiar with it.

As for SFML, the library is great and it can be used even if you only know the basics of C++. The great thing about C++ is that things like operator overloading and the RAII are pretty damn good at making sure you don't need to know specific details about how things work to use them. Read the manual and you should be fine.

but these console applications are ugly and boring looking

You are just writing ugly and boring ones, believe me.
Apr 21, 2015 at 4:40pm
"I would highly recomend avoiding if you want to keep your sanity, even if you are an experienced programmer (actually, I would advise you to stay away from it even more if you are an experienced programmer, I worry about your health, and your blood pressure would be going places)"

Is it really that bad? It could be interesting, and there doesn't seem to be a lot hate towards it on this forum like with assembly.
Apr 21, 2015 at 5:20pm
The Windows API is designed for C and doesn't fit will into C++'s methodologies. Not only that, it limits you to Windows - generally we encourage writing cross-platform portable code that compiled and runs on as many systems as possible, and using the Windows API means you can't achieve that goal.
Apr 21, 2015 at 6:04pm
"The Windows API is designed for C and doesn't fit will into C++'s methodologies."

What about any of the other Microsoft Libraries like MFC or .net? Are they closer to C++ or easier than Win32?
Apr 21, 2015 at 6:27pm
I personally have not used MFC or .NET - if I ever need to develop something that will only run on Windows, then I will definitely use whatever libraries and Windows API functions make my life easier. But so far I have never needed to do that - I am always writing cross-platform portable code.

GitHub for Windows and GitHub for Mac are great examples of when it makes sense to not write cross-platform portable code - they specialize for their target operating environment and take advantage of cool things that are only available on those operating systems.

For the most part though, you should try to avoid restricting yourself to a specific platform. The general case is that your code will need to work on as many platforms as it can, and you can't get that with the Windows API, MFC, etc.

.NET is interesting because of Mono, however I still like to avoid it out of personal preference.
Apr 21, 2015 at 6:29pm
From my (very humble) experience I can say, that most of people that know how to program in windows API advice to learn win32 before learning MFC or ATL.
Apr 21, 2015 at 6:39pm
"For the most part though, you should try to avoid restricting yourself to a specific platform. The general case is that your code will need to work on as many platforms as it can, and you can't get that with the Windows API, MFC, etc."

I was convinced that software companies who release their software for the three main operating systems (Mac, Linux, and PC) write the program three times, each time with code specific to the OS it was designed for.
Apr 21, 2015 at 7:15pm
tapir2 wrote:
I was convinced that software companies who release their software for the three main operating systems (Mac, Linux, and PC) write the program three times, each time with code specific to the OS it was designed for.
That's the worst case scenario - it is an absolute nightmare. Instead, a large majority of the code is the same for all platforms, and only small parts of the code need to be changed between systems. Through the use of C's preprocessor directives you can detect the platform the code is being compiled for and conditionally enable the appropriate blocks of code for it.
Apr 22, 2015 at 1:07am
The SFML website has a tutoiral on how to integrate sfml into a win32 interface, so it's possible to use both to create a program.

http://en.sfml-dev.org/forums/index.php?topic=13957.0
http://www.sfml-dev.org/tutorials/1.6/graphics-win32.php
Last edited on Apr 22, 2015 at 1:20am
Apr 22, 2015 at 1:52am
I never said it wasn't. I don't understand what point you are trying to make.
Apr 22, 2015 at 1:57am
Putting stuff on a timeline, you should learn stuff in this way (IMO):

1. Basic program flow (int main(), #includes, calling functions e.g. printf(), ...)
2. Variables and constants (int a; char b; a = 0; b = 'c';)
3. Arrays (int a[3] = {0,1,2}; int b = a[0];}
4. More program flow (if, while, for, do/while)
5. Custom Functions (void foo();)
6. Structures and Classes (struct; class; operators, too?)
7. Virtual member functions (virtual void foo();)
8. Libraries

If you feel comfortable with it, you can learn that stuff *while* learning libraries, too.
It'll probably be much harder, so as long as you don't reach *AT LEAST* point 6, stick to console programming.

-- Now, now, if you plan on using SFML, please don't create a win32 window to associate with it.
SFML is widely known for being a crossplatform library, and you're killing 80% of the SFML team's job doing that.
Also, it's a lot easier to use a RenderWindow. --

Side note: Especially for SFML which uses the sf namespace, namespace knowledge is a plus.
Last edited on Apr 22, 2015 at 1:59am
Apr 22, 2015 at 2:07am
@SGH
- Why printf? That's a C thing, not a C++ thing.
- Why arrays? The general consensus in the C++ community is that arrays are generally a bad idea, and std::vector should be taught before arrays.
Apr 22, 2015 at 2:33am
.
SFML is widely known for being a crossplatform library, and you're killing 80% of the SFML team's job doing that


That's a good point. But it says on the wxwidgets wiki regarding SFML, "SFML is a multimedia C++ library more suited for when you're writing games and such and want custom-everything and no convenient general-purpose UI elements" https://wiki.wxwidgets.org/WxWidgets_Compared_To_Other_Toolkits#SDL

So SFML isn't really suited for making GUI applications compared to Win32 API. The reason I wanted to learn a GUI library in addition to a multimedia library is to create an game editor/engine to make it easier to program and reuse code, as opposed to to starting from scratch with each new game project. Is this right?

If being crossplatform is really that important, would if be better to incorporate SFML with a cross platform GUI API like wxwidgets?
Apr 22, 2015 at 2:47am
If you want to make GUIs, I recommend Qt.
Pages: 12