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 - bearhead

Pages: [1]
1
General / Re: Efficiency of allocating RenderWindow
« on: November 16, 2014, 08:55:24 pm »
Thanks for the answers guys. :)

2
General / Efficiency of allocating RenderWindow
« on: November 16, 2014, 06:43:30 am »
I'm quite new to C++ and SFML so please excuse my naivete.

Say I have a class WindowManager which, on construction, allocates a RenderWindow object
and keeps a pointer to it.

Now, say in a different file, I have a main function which creates a WindowManager. Then,
it does something like this:

int main(int argc, char * argv) {
    WindowManager wm();  // a RenderWindow object is allocated on the heap in the constructor
    while (wm.getRenderWindow()->isOpen) {
        sf::Event event;
        while (wm.getRenderWindow->pollEvent(event)) {
            ...
        }
    }
}
 

Here's my question:
Because I'm dereferencing the pointer to the sf::RenderWindow object stored in my WindowManager class,
will this code be significantly slower than just creating a sf::RenderWindow on the stack (as a local variable
within main())? Is it generally bad practice to dynamically allocate the sf::RenderWindow object in SFML? I fear it might be bad practice because the RenderWindow object could potentially be huge. It probably needs to store at least one byte for each pixel in the rendered window (presumably much more). The dimensions of a window could be in the tens of millions too.

I guess this also just stems from a weak understanding of heap/stack location/speed.

By the way, the reason I'm doing this in the first place is that I'm attempting to write a game engine.

3
General / Xcode 6 unknown args
« on: November 14, 2014, 03:58:33 am »
Yes, I know this has been asked before at least once. But that fix didn't work for me.

I installed SFML2.1 correctly I think.

Creating a new project with C++11 with clang and libc++ settings and building it gives this error:
clang: error: unknown argument: '-frameworksfml-system'
clang: error: unknown argument: '-frameworksfml-window'
clang: error: unknown argument: '-frameworksfml-graphics'
clang: error: unknown argument: '-frameworksfml-audio'


I'm using the latest templates. I'm on OS X 10.10.1 with Xcode 6.1. Any ideas? Previous thread(s): http://en.sfml-dev.org/forums/index.php?topic=16395.0

Pages: [1]