| 123456789101112131415161718192021222324 |
- $#include "AreaAllocator.h"
- /// Rectangular area allocator.
- class AreaAllocator
- {
- public:
- /// Construct with given width and height.
- AreaAllocator(int width, int height);
-
- /// Construct with given width and height, and set the maximum it allows to grow.
- AreaAllocator(int width, int height, int maxWidth, int maxHeight);
-
- /// Reset to given width and height and remove all previous allocations.
- void Reset(int width, int height);
-
- /// Try to allocate an area. Return true if successful, with x & y coordinates filled.
- bool Allocate(int width, int height, int& x, int& y);
-
- /// Return the current width.
- int GetWidth() const;
-
- /// Return the current height.
- int GetHeight() const;
- };
|