| 1234567891011121314151617181920 |
- $#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 size_.x_; }
- /// Return the current height.
- int GetHeight() const { return size_.y_; }
- };
|