Flappy bird #3

Merged
Hartmut merged 4 commits from robin_rottstaedt/paradiso:main into main 2023-10-10 15:54:01 +02:00
Showing only changes of commit 237102965b - Show all commits

View file

@ -54,6 +54,17 @@ struct Bitmap final {
return {.size = size, .data = {values...}}; return {.size = size, .data = {values...}};
} }
/**
* @brief creates a bitmap from RGBA Values
* @param[in] size extent of bitmap
* @param[in] data vector of RGBA values
* @return bitmap with data from this call
*/
static constexpr Bitmap from_data(Size size, std::vector<RGBA> data) noexcept {
assert(data.size() == size.height * size.width);
return {.size = size, .data = data};
}
/** /**
* @brief fills a bitmap uniformly * @brief fills a bitmap uniformly
* @param[in] color RGBA value of a color * @param[in] color RGBA value of a color
@ -87,10 +98,7 @@ struct Bitmap final {
return data[y * size.width + x]; return data[y * size.width + x];
} }
constexpr void force_change() noexcept constexpr void force_change() noexcept { change_count++; }
{
change_count++;
}
Size size{.width = 0, .height = 0}; //!< extent of bitmap Size size{.width = 0, .height = 0}; //!< extent of bitmap
std::vector<RGBA> data{}; //!< data storage std::vector<RGBA> data{}; //!< data storage