1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-11 06:45:59 +00:00

split graph.cpp into 6 files: graph, graph-player, graph-wall, graph-item, graph-monster, and animations

This commit is contained in:
Zeno Rogue
2025-08-17 12:17:20 +02:00
parent ebaeb9d7f0
commit fc81777e29
8 changed files with 4378 additions and 4333 deletions

View File

@@ -27,6 +27,26 @@ EX int SDL_GetTicks() {
#endif
#endif
#if HDR
template<class T>
class span {
T *begin_ = nullptr;
T *end_ = nullptr;
public:
explicit span() = default;
explicit span(T *p, int n) : begin_(p), end_(p + n) {}
T *begin() const { return begin_; }
T *end() const { return end_; }
};
template<class Map, class Key>
hr::span<const shiftmatrix> span_at(const Map& map, const Key& key) {
auto it = map.find(key);
return (it == map.end()) ? hr::span<const shiftmatrix>() : hr::span<const shiftmatrix>(it->second.data(), it->second.size());
}
#endif
EX long double sqr(long double x) { return x*x; }
EX ld round_nearest(ld x) { if(x > 0) return int(x+.5); else return -int(.5-x); }