forked from Hartmut/paradiso
MVP for a Pong game
This commit is contained in:
parent
14343e7fd0
commit
e9d0de8cdd
17 changed files with 517 additions and 109 deletions
|
@ -60,6 +60,7 @@ struct Bitmap final {
|
|||
* @return reference to itself
|
||||
*/
|
||||
constexpr auto fill(const RGBA& color) noexcept {
|
||||
change_count++;
|
||||
std::fill(data.begin(), data.end(), color);
|
||||
return *this;
|
||||
}
|
||||
|
@ -71,6 +72,7 @@ struct Bitmap final {
|
|||
* @return reference to pixel data at position
|
||||
*/
|
||||
constexpr RGBA& pixel(std::integral auto x, std::integral auto y) {
|
||||
change_count++;
|
||||
return data[y * size.width + x];
|
||||
}
|
||||
|
||||
|
@ -85,8 +87,14 @@ struct Bitmap final {
|
|||
return data[y * size.width + x];
|
||||
}
|
||||
|
||||
constexpr void force_change() noexcept
|
||||
{
|
||||
change_count++;
|
||||
}
|
||||
|
||||
Size size{.width = 0, .height = 0}; //!< extent of bitmap
|
||||
std::vector<RGBA> data{}; //!< data storage
|
||||
std::uint64_t change_count{};
|
||||
};
|
||||
} // namespace paradiso
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue