format code

This commit is contained in:
Andrea Blankenstijn 2021-08-14 09:25:28 +02:00
parent 151c502472
commit 3570cf301a
15 changed files with 44 additions and 45 deletions

View file

@ -22,7 +22,9 @@ private:
void _handle_rendering() override
{
const auto now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
const auto now = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now().time_since_epoch())
.count();
const uint8_t r = 255 * (now % cycle_r / (float)cycle_r); // NOLINT
const uint8_t g = 255 * (now % cycle_g / (float)cycle_g); // NOLINT
const uint8_t b = 255 * (now % cycle_b / (float)cycle_b); // NOLINT

View file

@ -26,8 +26,7 @@ concept WidgetType = std::derived_from<T, bwidgets::Widget>;
template<WidgetType W>
void run_example(
const std::function<void(W*, std::shared_ptr<bwidgets::Font>,
int, int)>& setup,
const std::function<void(W*, std::shared_ptr<bwidgets::Font>, int, int)>& setup,
int w = 3, int h = 3)
{
std::atexit(lib_exit);

View file

@ -15,9 +15,8 @@ namespace bwidgets
class Texture;
[[nodiscard]] auto aa(const Color&, int, float) noexcept -> Color;
[[nodiscard]] auto filled_circle(const Color&, int resolution,
Renderer*, int aa_pixels = 3)
-> std::shared_ptr<Texture>;
[[nodiscard]] auto filled_circle(const Color&, int resolution, Renderer*,
int aa_pixels = 3) -> std::shared_ptr<Texture>;
void set_pixels_color(
Texture*,
const std::function<uint32_t(const SDL_Point&, const SDL_PixelFormat*)>&);

View file

@ -30,8 +30,7 @@ namespace bwidgets
bool _operate_on_colors;
template<Numeric N>
auto _operate(N operand,
const std::function<N(N, N)>& operator_) const noexcept
auto _operate(N operand, const std::function<N(N, N)>& operator_) const noexcept
{
Color c(sdl_type, _operate_on_alpha, _operate_on_colors);
if (_operate_on_alpha) {
@ -56,8 +55,8 @@ namespace bwidgets
public:
SDL_Color sdl_type;
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a,
bool op_on_alpha = false, bool op_on_colors = true) noexcept
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a, bool op_on_alpha = false,
bool op_on_colors = true) noexcept
: _operate_on_alpha(op_on_alpha),
_operate_on_colors(op_on_colors),
sdl_type({r, g, b, a})