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.


Messages - cheesesteak

Pages: [1]
1
General / Re: Virtual final functions?
« on: February 19, 2014, 08:43:42 pm »
That does make a lot of sense, I don't know what is wrong with me these days...  :-X  ;)

Thank you very much!

2
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?

3
General / Re: SFML and std::cout
« on: February 08, 2014, 07:35:56 pm »
You need to output std::flush to std::cout to see anything.
Thank you very much, that worked!
Or std::endl, which is more commonly used since people usually want to terminate their messages with a line break ;)
Thank you, too. Normally I use std::endl. If I had done so this time, this question would not have been necessary! However, std::endl works because it calls std::flush implicitly. Thanks to both of you!

4
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]
anything