-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'webview-editor-refactor' into main
- Loading branch information
Showing
13 changed files
with
205 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Created by Syl on 08/09/2024. | ||
// | ||
|
||
#ifndef MOSTLY_HARMLESS_COLOUR_H | ||
#define MOSTLY_HARMLESS_COLOUR_H | ||
#include <cstdint> | ||
namespace mostly_harmless::gui { | ||
/** | ||
* \brief Convenience struct representing a colour. | ||
*/ | ||
struct Colour final { | ||
/** | ||
* Constructs a colour from an ARGB hex colour, in the format `0xAARRGGBB` - for example, fully opaque red would be `0xFFFF0000` | ||
* \param argb The hex code for the desired colour. | ||
*/ | ||
explicit Colour(std::uint32_t argb); | ||
/** | ||
* Constructs a colour from individual (0 to 255) rgb args. In this overload, alpha defaults to 255. | ||
* \param r_ The 0 to 255 value for red. | ||
* \param g_ The 0 to 255 value for green. | ||
* \param b_ The 0 to 255 value for blue. | ||
*/ | ||
Colour(std::uint8_t r_, std::uint8_t g_, std::uint8_t b_); | ||
/** | ||
* Constructs a colour from individual (0 to 255) argb args. | ||
* \param a_ The 0 to 255 value for alpha (255 being fully opaque) | ||
* \param r_ The 0 to 255 value for red. | ||
* \param g_ The 0 to 255 value for green. | ||
* \param b_ The 0 to 255 value for blue. | ||
*/ | ||
Colour(std::uint8_t a_, std::uint8_t r_, std::uint8_t g_, std::uint8_t b_); | ||
std::uint8_t a, r, g, b; | ||
}; | ||
} // namespace mostly_harmless::gui | ||
#endif // MOSTLY_HARMLESS_COLOUR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule choc
updated
7 files
+5 −4 | gui/choc_DesktopWindow.h | |
+34 −11 | gui/choc_WebView.h | |
+6 −4 | network/choc_HTTPServer.h | |
+2 −2 | tests/choc_tests.h | |
+164 −0 | tests/choc_webserver_example.h | |
+87 −0 | tests/choc_webview_example.h | |
+5 −69 | tests/main.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Created by Syl on 08/09/2024. | ||
// | ||
#include <mostly_harmless/gui/mostlyharmless_Colour.h> | ||
namespace mostly_harmless::gui { | ||
Colour::Colour(std::uint32_t argb) { | ||
a = static_cast<std::uint8_t>((argb >> 24) & 0xFF); | ||
r = static_cast<std::uint8_t>((argb >> 16) & 0xFF); | ||
g = static_cast<std::uint8_t>((argb >> 8) & 0xFF); | ||
b = static_cast<std::uint8_t>(argb & 0xFF); | ||
} | ||
|
||
Colour::Colour(std::uint8_t r_, std::uint8_t g_, std::uint8_t b_) : a(static_cast<std::uint8_t>(255)), r(r_), g(g_), b(b_) { | ||
} | ||
|
||
Colour::Colour(std::uint8_t a_, std::uint8_t r_, std::uint8_t g_, std::uint8_t b_) : a(a_), r(r_), g(g_), b(b_) { | ||
} | ||
} // namespace mostly_harmless::gui |
Oops, something went wrong.