Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: video mode thingy  (Read 2393 times)

0 Members and 1 Guest are viewing this topic.

Hundrea

  • Newbie
  • *
  • Posts: 15
    • View Profile
video mode thingy
« 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?

Josh

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: video mode thingy
« Reply #1 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.

Hundrea

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: video mode thingy
« Reply #2 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

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: video mode thingy
« Reply #3 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: video mode thingy
« Reply #4 on: February 18, 2013, 08:20:04 pm »
For books, I usually link people to this StackOverflow question. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/