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

Pages: [1]
1
Graphics / Re: Vector affecting performance in game
« on: July 01, 2016, 11:21:29 am »
Thank lots, everything is fine now. I'm still too new at this

2
Graphics / Vector affecting performance in game
« on: June 30, 2016, 06:16:04 pm »
I am trying to hold a vector of projectiles which then i would loop at the end to draw it. I tried doing so but my game immediately freeze for a second the moment i try to add a projectile in into the vector! I finally realized that its vector.push_back() that is the one causing the weak game performance. I have tried using deque, list but none of them shown any improvement in performance.

Quote
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) { // under while (window.isOpen()) {}
    if (player.canShoot) {
        player.shot();//timer related, not causing any issues
        fireball.setStartPos(player.getPos());
        fireball.start();//start animation, not causing issues

        if (pList.size() == 3) { //max 3 projectiles, pList is the vector
            pList.pop_front();
        }
        pList.push_back(fireball); //this causing issues
            
    }
}

Please help!

Pages: [1]
anything