SFML community forums

Help => Window => Topic started by: Hundrea on February 18, 2013, 03:57:11 am

Title: video mode thingy
Post by: Hundrea on February 18, 2013, 03:57:11 am
hi i'm new to sfml/c++ can some one explain how
 sf::VideoMode desktop = sf::VideoMode::getDesktopMode();
 
  works? Hows doe it make an constructor equal an function?
Title: Re: video mode thingy
Post by: Josh on February 18, 2013, 04:37:32 am
If you check out the docs, getDesktopMode()'s definition is:

static VideoMode getDesktopMode ()

Initialising desktop like this invokes the copy constructor (Not the default constructor or the assignment operator), using the sf::VideoMode object returned by getDesktopMode() as the object to copy.
Title: Re: video mode thingy
Post by: Hundrea on February 18, 2013, 07:44:11 pm
ok, i understood 0.1% of what you said but thats sound like a valid answer so im good:P
Title: Re: video mode thingy
Post by: Nexus on February 18, 2013, 08:11:23 pm
You should read a C++ book before starting, otherwise this will happen all the time ;)
Be careful, a lot of literature teaches bad practice. A good book would be the C++ Primer (not Primer Plus), or Thinking in C++ (which is a free e-book).

SFML really requires a solid understanding of the basics in C++, and it will cost you much more time when you begin directly with SFML, instead of learning C++ properly before. So, invest a few months reading only C++ theory and develop things in the console, so that you have a good fundament to start later with game development.

I know it sounds discouraging, but trust me, you will be thankful if you develop a game and don't have to lookup essential C++ concepts all the time.
Title: Re: video mode thingy
Post by: eXpl0it3r on February 18, 2013, 08:20:04 pm
For books, I usually link people to this StackOverflow question (http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). ;)