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

Pages: [1]
1
Graphics / Large arrays of sprites crashing
« on: July 29, 2014, 02:41:22 pm »
While playing with multidimensional arrays of sprites, I began having unexpected crashing. After poking at it for a bit, I discovered that having an array of sprites over 7000 or so crashes my program immediately. Oddly, this behavior is completely reproducible on another machine, but the number of sprites required to crash is a few hundred higher.

The sprites are empty, with no data assigned.

With high working values, I see that this code is only taking about 25MB of ram, so I can't figure why I'm having issues.

SFML Version is the "GCC 4.7 MinGW (DW2) - 32 bits" version of SFML 2.1, latest stable.

I just noticed that my compiler version is GCC 4.8.1 rather than 4.7. Could this be the issue?

EDIT: Just rolled back to 4.7.2, and it's not the issue.
Also forgot to give my OS. Oops...

OS: Windows 7 S1 Professional 64-bit

I'll see if I can try to recreate on linux here in a bit.

The code to produce is the following:

int main(){

        sf::RenderWindow window(sf::VideoMode(200, 200), "Test");
        sf::Texture textures[10];

        sf::Sprite sprites[7200]; //setting this to 7100 still runs
        sprites[0].setTexture(textures[0]);

        while (window.isOpen()){
                sf::Event event;

                while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

                window.clear();
                window.draw(sprites[0]);
                window.display();
        }

        return 0;
}

2
Graphics / Looking for the proper way to tile an animated sprite
« on: April 10, 2014, 05:08:04 pm »
Pretty much what the title says, just looking for the proper way to tile an animated sprite.

I have a 4 frame image I'm looking to tile as a background, stored as a 16x64 png.

As is, I can animate a single instance of it just fine, using sprite.setTextureRect(). However, I'm not sure of the proper way to repeatedly tile the sprite across the background.

Also, I'm using JSFML if it makes a difference.

Any suggestions?

Pages: [1]