Fix some Typenames
Add Sound to RD7 Namespace
Add Line to Render2
Fix scrollbar dragging
This commit is contained in:
2024-06-30 15:43:48 +02:00
parent 570d7f17fb
commit 410d6bf919
8 changed files with 64 additions and 17 deletions

View File

@ -25,10 +25,10 @@
#include <string>
#include <vector>
#define UNPACK_RGBA(col) (uint8_t)(col >> 24), (col >> 16), (col >> 8), (col)
#define UNPACK_BGRA(col) (uint8_t)(col >> 8), (col >> 16), (col >> 24), (col)
#define UNPACK_RGBA(col) (unsigned char)(col >> 24), (col >> 16), (col >> 8), (col)
#define UNPACK_BGRA(col) (unsigned char)(col >> 8), (col >> 16), (col >> 24), (col)
inline uint32_t RGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) {
inline unsigned int RGBA8(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255) {
return (r | g << 8 | b << 16 | a << 24);
}
@ -132,7 +132,7 @@ class RGBA {
/// @param g
/// @param b
/// @param a
RGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255)
RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255)
: m_r(r), m_g(g), m_b(b), m_a(a) {}
/// @brief Construct
/// @param r
@ -201,7 +201,7 @@ class RGBA {
return (luminance() >= 0.5);
}
uint8_t m_r = 0, m_g = 0, m_b = 0, m_a = 0;
unsigned char m_r = 0, m_g = 0, m_b = 0, m_a = 0;
};
std::string RGBA2Hex(unsigned int c32);
/// @brief Convert RGB to Hex
@ -214,6 +214,6 @@ std::string RGB2Hex(int r, int g, int b);
/// @param color
/// @param a
/// @return Color32
uint32_t Hex(const std::string &color, uint8_t a = 255);
unsigned int Hex(const std::string &color, unsigned char a = 255);
} // namespace Color
} // namespace RenderD7

View File

@ -58,7 +58,7 @@ class R2Base {
Image::Ref img; //< Image Reference
Sprite::Ref spr; //< Sprite Reference
// 0 = skip, 1 = rect, 2 = tri, 3 = text,
// 4 = image, 5 = sprite
// 4 = image, 5 = sprite, 6 = Line
int type; //< Command Type
bool lined = false; //< Draw Lined Rect/Tri
// Text Specific
@ -97,6 +97,8 @@ class R2Base {
RD7TextFlags flags = 0, R7Vec2 tmb = R7Vec2());
void AddImage(R7Vec2 pos, Image::Ref img);
void AddSprite(Sprite::Ref spr);
void AddLine(R7Vec2 pos_a, R7Vec2 pos_b, RD7Color clr, int t = 1);
void AddLine(R7Vec2 pos_a, R7Vec2 pos_b, unsigned int clr, int t = 1);
private:
const float default_text_size = 0.5f;

View File

@ -23,6 +23,7 @@
#include <renderd7/smart_ctor.hpp>
#include <string>
namespace RenderD7 {
/** Sound Class */
class Sound {
public:
@ -49,3 +50,4 @@ class Sound {
/// \param chnl Channel of the sound
int chnl;
};
} // namespace RenderD7