I currently have SFML up and running, but I am using Visual C++ Express so I have access to windows API and have been trying to learn both. SFML has been easier to learn for me, but I'm willing to put in the effort to learn Windows API.
I am starting to think that I should focus on learning one or the other for now.
I was wondering, as far as graphics and program speed go, which would be the better choice. I'm currently leaning towards Windows API because it has more tools to communicate with other programs and the desktop, but I just wanted other people's opinions. Any program speed issues may sway me in either way.
WinAPI is an old behemoth of an API that could take years to even see everything it has to offer. That being said, it can be pretty confusing at first. Microsoft feels the need to type def every variable out there so just looking at code without documentation is near impossible. If anything, I would follow the tutorial on MSDN and read the docs for each thing you use, then go back to SFML.
They're apples and oranges. Which one you should learn depends entirely on what you want to do.
SFML is a crossplatform multimedia library.
WinAPI is a platform specific SDK.
SFML will make it much easier to do common tasks and will work on various different platforms, but is restricted to do things that it supports.
WinAPI will only work on Windows, but is pretty much totally unrestricted. That is... nearly anything that can be done in a Windows program can be done through WinAPI.
The wider scope of WinAPI also makes it more difficult to use. SFML can have a much simpler interface because it doesn't give you as many options -- it can make assumptions about what you're going to do and "fill in the blanks" for things used most commonly. WinAPI has to be much more verbose because it can't assume anything.
EDIT:
To see what I mean... here is some code to compare.
Creating a window in SFML:
1 2 3 4 5 6 7 8
int main()
{
sf::RenderWindow wnd( sf::VideoMode( 640, 480 ), "Window Title" );
// done. The window is now visible, and 'wnd' is our handle to it
// note that this ALSO automatically sets up an OpenGL context for you, and binds it
// to this window.
}
Creating a window in WinAPI:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
int WINAPI WinMain(HINSTANCE inst,INSTANCE previnst, LPSTR cmdline, int show)
{
WNDCLASSEX wc = {0};
wc.cbSize = sizeof(WNDCLASSEX);
wc.wndProc = pointer_to_your_wndproc_function; // body of this function omitted for brevity
wc.hInstance = inst;
wc.lpszClassName = TEXT("MyProgram");
RegisterClassEx( &wc );
HWND wnd = CreateWindowEx( 0,
TEXT("MyProgram"),
TEXT("Window Title"),
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
x, y, 640, 480,
NULL, NULL, inst, NULL );
}
One advantage of the Windows API is that it is exposed at a relatively low level, so it can be used in a variety of programming languages. It does take a while to get your legs under you, but you quickly learn that most of the "verbose" code like that above is simply "boiler plate". You can keep it in template files and simply fill in the details as needed.
I'm in agreement with codeFoil, if you really want to comprehend the Windows OS i'd recommend picking up Windows via C/C++ 5th edition, excellent book I've learned so much about the underlying system.