JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Alpha.hpp
Go to the documentation of this file.
1// Copyright 2024-2025 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include <cstdint>
8
9namespace jngl {
12class Alpha {
13public:
17 explicit Alpha(float alpha);
18
20 static Alpha u8(uint8_t alpha);
21
23 [[nodiscard]] uint8_t u8() const;
24
26 float getAlpha() const;
28 void setAlpha(float);
29
30private:
31 float alpha;
32};
33
34} // namespace jngl
Object representing only the Alpha Channel in an RGBA color, 0 meaning invisible, 1 fully visible.
Definition Alpha.hpp:12
uint8_t u8() const
0...255
float getAlpha() const
0.0f ... 1.0f
static Alpha u8(uint8_t alpha)
Alpha(float alpha)
void setAlpha(float)
0.0f ... 1.0f
JNGL's main namespace.