1
SFML projects / Re: 2D Game Engine Made Using SFML 2.1 - Open Source
« on: June 03, 2017, 01:07:47 pm »
Well,
in my opinion, you are using too many maps, expecially in your input manager. It kills performance. I suggest you to use array (normal or std::array) or std::vector for that and use input code (i mean e.g. sf::Keyboard::A, event.key.code) as an array index. It gives you guaranteed O(1) time look-up.
Gold rule "Always pass objects by const reference". In many functions (in all of them i think) you are sending std::string by value. Performance killed again. Send it by (const) reference or by value and std::move from them. It concerns all non-primitive things.
A lot of static variables, which means they are not within class they belong to. Possible cache misses.
Using 1-dimensional array to represent 2 dimenions? Good one
As you are coding in C++11, consider using smart pointers and move semantics.
In some constructors you are missing member initializer lists.
Is there a reason to use FILE and fread instead of std::fstream and malloc instead of new?
Keep coding and good luck
in my opinion, you are using too many maps, expecially in your input manager. It kills performance. I suggest you to use array (normal or std::array) or std::vector for that and use input code (i mean e.g. sf::Keyboard::A, event.key.code) as an array index. It gives you guaranteed O(1) time look-up.
Gold rule "Always pass objects by const reference". In many functions (in all of them i think) you are sending std::string by value. Performance killed again. Send it by (const) reference or by value and std::move from them. It concerns all non-primitive things.
A lot of static variables, which means they are not within class they belong to. Possible cache misses.
Using 1-dimensional array to represent 2 dimenions? Good one
imageValue = tileData[(blockPosition.y*tileHeader->tileBlock.x)+blockPosition.x];
As you are coding in C++11, consider using smart pointers and move semantics.
In some constructors you are missing member initializer lists.
Is there a reason to use FILE and fread instead of std::fstream and malloc instead of new?
Keep coding and good luck