+ hex Werte umrechnen zu Color
This commit is contained in:
parent
26a49cd79b
commit
511f04edae
@ -4,7 +4,12 @@ namespace vkvm {
|
||||
|
||||
Color::Color(unsigned char red, unsigned char green, unsigned char blue) noexcept
|
||||
: red(red), green(green), blue(blue) {
|
||||
}
|
||||
|
||||
Color::Color(unsigned int hex) noexcept {
|
||||
red = (unsigned char) ((hex >> 16 & 0xFF));//NOLINT
|
||||
green = (unsigned char) ((hex >> 8u & 0xFF));//NOLINT
|
||||
blue = (unsigned char) ((hex & 0xFF));//NOLINT
|
||||
}
|
||||
|
||||
auto Color::getRed() -> unsigned char {
|
||||
|
@ -18,6 +18,8 @@ namespace vkvm {
|
||||
public:
|
||||
Color(unsigned char red, unsigned char green, unsigned char blue) noexcept;
|
||||
|
||||
explicit Color(unsigned int hex) noexcept;
|
||||
|
||||
auto getRed() -> unsigned char;
|
||||
|
||||
auto getGreen() -> unsigned char;
|
||||
|
@ -77,7 +77,7 @@ namespace vkvm {
|
||||
if (reg->keyboardBuffer_index_write == sizeof(reg->keyboardBuffer)) {
|
||||
reg->keyboardBuffer_index_write = 0;
|
||||
}
|
||||
reg->keyboardBuffer[reg->keyboardBuffer_index_write++] = keyCode.getValue();
|
||||
reg->keyboardBuffer[reg->keyboardBuffer_index_write++] = keyCode;
|
||||
unlockSharedMemory();
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ TEST_CASE("Colors") {
|
||||
vkvm::setPixel(13, 13, vkvm::red);//NOLINT
|
||||
vkvm::setPixel(14, 14, vkvm::blue);//NOLINT
|
||||
vkvm::setPixel(15, 15, vkvm::Color(66, 77, 88)); //NOLINT
|
||||
vkvm::setPixel(16, 16, vkvm::Color(0xFFFFFF));//NOLINT
|
||||
|
||||
SECTION("RGB") {
|
||||
REQUIRE(vkvm::getPixel(10, 10) == vkvm::black);//NOLINT
|
||||
@ -18,6 +19,7 @@ TEST_CASE("Colors") {
|
||||
REQUIRE(vkvm::getPixel(13, 13) == vkvm::red);//NOLINT
|
||||
REQUIRE(vkvm::getPixel(14, 14) == vkvm::blue);//NOLINT
|
||||
REQUIRE(vkvm::getPixel(15, 15) == vkvm::Color(66, 77, 88));//NOLINT
|
||||
REQUIRE(vkvm::getPixel(16, 16) == vkvm::white);//NOLINT
|
||||
}
|
||||
|
||||
SECTION("TwoColors") {
|
||||
@ -28,6 +30,7 @@ TEST_CASE("Colors") {
|
||||
REQUIRE(vkvm::getPixel(13, 13) == vkvm::black);//NOLINT
|
||||
REQUIRE(vkvm::getPixel(14, 14) == vkvm::black);//NOLINT
|
||||
REQUIRE(vkvm::getPixel(15, 15) == vkvm::black);//NOLINT
|
||||
REQUIRE(vkvm::getPixel(16, 16) == vkvm::white);//NOLINT
|
||||
|
||||
}
|
||||
|
||||
@ -39,6 +42,7 @@ TEST_CASE("Colors") {
|
||||
REQUIRE(vkvm::getPixel(13, 13) == vkvm::Color(85, 85, 85));//NOLINT
|
||||
REQUIRE(vkvm::getPixel(14, 14) == vkvm::Color(85, 85, 85));//NOLINT
|
||||
REQUIRE(vkvm::getPixel(15, 15) == vkvm::Color(77, 77, 77));//NOLINT
|
||||
REQUIRE(vkvm::getPixel(16, 16) == vkvm::white);//NOLINT
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user