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

Author Topic: Extreme Speed loss  (Read 5119 times)

0 Members and 1 Guest are viewing this topic.

Krypt0n

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Extreme Speed loss
« Reply #15 on: May 04, 2012, 06:17:22 pm »
Don't create them dynamically, there's no need to.

No, I meant this:
Code: [Select]
for(int i=0;i<5;++i)
for(int j=0;j<5;++j)
mRooms.push_back(new Room(10,10,10*i,10*j));
How am I able to do this without pointers?


Topic related:
The fps drop really nerves me. if noone knows how to fix this, I'll switch to sdl

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Extreme Speed loss
« Reply #16 on: May 04, 2012, 06:28:38 pm »
I also meant this ;)

Just create a temporary object:
std::vector<Room> mRooms;
// ...
mRooms.push_back(Room(10,10,10*i,10*j));

Or with a named object:
Room room(10,10,10*i,10*j);
mRooms.push_back(room);
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: