Tag Info

New answers tagged

0

map<Key, Value> (and it's mates) holds Value, well, by value. If you try to give it an instance of derived class to hold as value, most likely "slicing" will occur. More about slicing: http://stackoverflow.com/q/274626/1125702 std::unique_ptr<Component> seems exactly what you want. It manages lifetime and memory of owned object. By convention, ...


1

SFML2 allows arithemic operations on sf::Time, like substracting or comparing timestamps. It will be more reliable and consistent to compare elapsed time with desired delay, rether than counting down, especially integer of milliseconds(?). Things like repeated shots are easier (imo) to implement, if you treat fire delays as locks, i.e. next bullet will not ...


0

Subtract the elapsed time for the current frame from the timer's current value. When the timer value goes zero or negative, you know time's up. Assuming SFML 2.0, you can do: sf::Time elapsed = clock.restart(); timer.value -= elapsed.asMilliseconds(); ...or elapsed.asSeconds(), or .asMicroseconds(), as you like; whatever units your timer uses.


1

Collision doesn't need to care about tiles at all. If a tile is just a shape of lines, your "tile collision" is really just collision against those specific lines. You can also use collision against arbitrary shapes defined by mathematical functions - like curves - which are represented by tiles. Tile collision in this case means determining which tiles the ...


2

Here is a link on how mix openGL code with the SFML, are you sure that the GLFW feature that you are looking for, aren't on the sfml already, because in my experience there is no reasone for mix up this two library.



Top 50 recent answers are included