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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - cheesesteak

Pages: [1]
1
General / Virtual final functions?
« on: February 19, 2014, 07:27:06 pm »
Hey everybody,

while enjoying the book "SFML Game Development", I came across some code (page 58), which I really don't understand. In the header file of the class SceneNode, which publicly inherits from sf::Drawable, it says:

virtual void draw(...) const;

The reader is being recommended declare draw(...) with the C++0x final keyword, which I think makes sense. (I would also recommend the override keyword.)

Question: Why do they use the virtual keyword? I mean, draw(...) is being inherited from sf::Drawable, but that doesn't require the use of virtual, does it? Furthermore, virtual implies that the function is designed to be overridden, which clearly isn't the case (as implied by final)...

Is this an error or do I just not understand what's going on?

2
General / SFML and std::cout
« on: February 08, 2014, 05:19:08 pm »
Good evening everybody!

I just started reading "SFML Game Development". So far I like both the book and SFML! I have one question, though:

Whenever I program in C++ and something doesn't work, I print the involved values using std::cout. I noticed that this doesn't work with SFML:

if (!this->mTexture.loadFromFile("res/plane.png"))
{
        std::cout << "Texture plane.png couldn't be loaded.";
}

When I intentionally remove plane.png, recompile the program and then run it in terminal mode, I only get to see SMFL's error message, not my string.

Is it generally impossible to use std::cout in combination with SFML? If so, what can be used alternatively?

Thank you!

Pages: [1]