From 8dd5ab1546e05e67fab8ac047810bf1b588acc28 Mon Sep 17 00:00:00 2001 From: josh Date: Wed, 24 Jan 2024 00:32:07 -0500 Subject: [PATCH] Implement Color Palletes --- include/JGL/JGL.h | 181 +++++++++++++++++++++++++++++++++++++++++++--- main.cpp | 4 +- src/JGL/JGL.cpp | 14 +++- 3 files changed, 182 insertions(+), 17 deletions(-) diff --git a/include/JGL/JGL.h b/include/JGL/JGL.h index 52a4cb8..5f37fda 100644 --- a/include/JGL/JGL.h +++ b/include/JGL/JGL.h @@ -26,19 +26,176 @@ namespace JGL { int b; }; namespace Colors { - static const Color3 BrightRed {255, 0, 0}; - static const Color3 BrightGreen { 0, 255, 0}; - static const Color3 BrightBlue { 0, 0, 255}; - static const Color3 White {255, 255, 255}; - static const Color3 Black { 0, 0, 0}; - static const Color3 Gray {128, 128, 128}; - static const Color3 DarkGray {192, 192, 192}; - static const Color3 LightGray { 64, 64, 64}; - static const Color3 Maroon {}; - static const Color3 Fuchsia {}; - static const Color3 Lime {}; - static const Color3 Olive {}; + namespace Primary { + static const Color3 Red {255, 0, 0}; + static const Color3 Green { 0, 255, 0}; + static const Color3 Blue { 0, 0, 255}; + static const Color3 White {255, 255, 255}; + static const Color3 Black { 0, 0, 0}; + static const Color3 Gray {128, 128, 128}; + static const Color3 DarkGray {192, 192, 192}; + static const Color3 LightGray { 64, 64, 64}; + static const Color3 Yellow {255, 255, 0}; + } + using namespace Primary; + namespace Reds { + static const Color3 Fuchsia {}; + static const Color3 LightSalmon {255, 160, 122}; + static const Color3 Salmon {250, 128, 114}; + static const Color3 DarkSalmon {233, 150, 122}; + static const Color3 LightCoral {240, 128, 128}; + static const Color3 IndianRed {205, 92, 92}; + static const Color3 Crimson {220, 20, 60}; + static const Color3 Firebrick {178, 34, 34}; + static const Color3 DarkRed {139, 0, 0}; + } + namespace Oranges { + static const Color3 Coral {255, 127, 80}; + static const Color3 Tomato {255, 99, 71}; + static const Color3 OrangeRed {255, 69, 0}; + static const Color3 Gold {255, 215, 0}; + static const Color3 Orange {255, 165, 0}; + static const Color3 DarkOrange {255, 140, 0}; + } + namespace Yellows { + static const Color3 LightYellow {255, 255, 224}; + static const Color3 LemonChiffon {255, 250 ,205}; + static const Color3 LightGoldenrodYellow {250, 250, 210}; + static const Color3 PapayaWhip {255, 239, 213}; + static const Color3 Moccasin {255, 228, 181}; + static const Color3 PeachPuff {255, 218, 185}; + static const Color3 PaleGoldenrod {238, 232, 170}; + static const Color3 Khaki {240, 230, 140}; + static const Color3 DarkKhaki {189, 183, 107}; + } + namespace Greens { + static const Color3 LawnGreen {124, 252, 0}; + static const Color3 Chartreuse {127, 255, 0}; + static const Color3 LimeGreen {50, 205, 50}; + static const Color3 ForestGreen {34, 139, 34}; + static const Color3 DarkGreen {0, 100, 0}; + static const Color3 GreenYellow{173, 255, 47}; + static const Color3 YellowGreen{154, 205, 50}; + static const Color3 SpringGreen{0, 255, 127}; + static const Color3 MediumSpringGreen{0, 250, 154}; + static const Color3 LightGreen{144, 238, 144}; + static const Color3 PaleGreen{152, 251, 152}; + static const Color3 DarkSeaGreen{143, 188, 143}; + static const Color3 MediumSeaGreen{60, 179, 113}; + static const Color3 SeaGreen{46, 139, 87}; + static const Color3 DarkOliveGreen{85, 107, 47}; + static const Color3 OliveDrab{107, 142, 35}; + static const Color3 Lime{0, 255, 0}; + static const Color3 Olive{128, 128, 0}; + } + namespace Cyans { + static const Color3 LightCyan{224, 255, 255}; + static const Color3 Cyan{0, 255, 255}; + static const Color3 Aqua{0, 255, 255}; + static const Color3 Aquamarine{127, 255, 212}; + static const Color3 MediumAquamarine{102, 205, 170}; + static const Color3 PaleTurquoise{175, 238, 238}; + static const Color3 Turquoise{64, 224, 208}; + static const Color3 MediumTurquoise{72, 209, 204}; + static const Color3 DarkTurquoise{0, 206, 209}; + static const Color3 LightSeaGreen{32, 178, 170}; + static const Color3 CadetBlue{95, 158, 160}; + static const Color3 DarkCyan{0, 139, 139}; + static const Color3 Teal{0, 128, 128}; + } + namespace Blues { + static const Color3 PowderBlue {176, 224, 230}; + static const Color3 LightBlue {173, 216, 230}; + static const Color3 LightSkyBlue {135, 206, 250}; + static const Color3 SkyBlue {135, 206, 235}; + static const Color3 DeepSkyBlue {0, 191, 255}; + static const Color3 LightSteelBlue {176, 196, 222}; + static const Color3 DodgerBlue {30, 144, 255}; + static const Color3 CornflowerBlue {100, 149, 237}; + static const Color3 SteelBlue {70, 130, 180}; + static const Color3 RoyalBlue {65, 105, 225}; + static const Color3 MediumBlue {0, 0, 205}; + static const Color3 DarkBlue {0, 0, 139}; + static const Color3 Navy {0, 0, 128}; + static const Color3 MidnightBlue {25, 25, 112}; + static const Color3 MediumSlateBlue {123, 104, 238}; + static const Color3 SlateBlue {106, 90, 205}; + static const Color3 DarkSlateBlue {72, 61, 139}; + } + + + namespace Purples { + static const Color3 Lavender {230, 230, 250}; + static const Color3 Thistle {216, 191, 216}; + static const Color3 Plum {221, 160, 221}; + static const Color3 Violet {238, 160, 221}; + static const Color3 Orchid {218, 112, 214}; + static const Color3 Fuchsia {255, 0, 255}; + static const Color3 Magenta {255, 0, 255}; + static const Color3 MediumOrchid {186, 85, 211}; + static const Color3 MediumPurple {147, 112, 219}; + static const Color3 BlueViolet {138, 43, 226}; + static const Color3 DarkViolet {148, 0, 211}; + static const Color3 DarkOrchid {153, 50, 204}; + static const Color3 DarkMagenta {139, 0, 128}; + static const Color3 Purple {128, 0, 128}; + static const Color3 Indigo {75, 0, 130}; + } + namespace Pinks { + static const Color3 Pink {255, 129, 203}; + static const Color3 LightPink {255, 182, 193}; + static const Color3 HotPink {255, 105, 180}; + static const Color3 DeepPink {255, 20, 147}; + static const Color3 PaleVioletRed {219, 112, 147}; + static const Color3 MediumVioletRed {199, 21, 133}; + } + namespace Whites { + static const Color3 Snow {255, 250, 250}; + static const Color3 Honeydew {240, 255, 240}; + static const Color3 MintCream {245, 255, 250}; + static const Color3 Azure {240, 255, 255}; + static const Color3 AliceBlue {240, 248, 255}; + static const Color3 GhostWhite {248, 248, 255}; + static const Color3 WhiteSmoke {245, 245, 245}; + static const Color3 SeaShell {255, 245, 238}; + static const Color3 Beige {245, 245, 220}; + static const Color3 OldLace {253, 245, 230}; + static const Color3 FloralWhite {255, 250, 240}; + static const Color3 Ivory {255, 255, 240}; + static const Color3 AntiqueWhite {250, 240, 215}; + static const Color3 Linen {250, 240, 230}; + static const Color3 LavenderBlush {255, 240, 245}; + static const Color3 MistyRose {255, 228, 255}; + } + namespace Grays { + static const Color3 Gainsboro {220, 220, 220}; + static const Color3 LightGray {211, 211, 211}; + static const Color3 Silver {192, 192, 192}; + static const Color3 DimGray {105, 105, 105}; + static const Color3 LightSlateGray {119, 136, 153}; + static const Color3 SlateGray {112, 128, 144}; + static const Color3 DarkSlateGray {47, 79, 79}; + } + namespace Browns { + static const Color3 CornSilk {255, 248, 220}; + static const Color3 BlanchedAlmond {255, 235, 205}; + static const Color3 Bisque {255, 228, 196}; + static const Color3 NavajoWhite {255, 222, 173}; + static const Color3 Wheat {254, 222, 179}; + static const Color3 BurlyWood {222, 184, 135}; + static const Color3 Tan {210, 180, 140}; + static const Color3 RosyBrown {188, 143, 143}; + static const Color3 SandyBrown {244, 164, 96}; + static const Color3 GoldenRod {218, 165, 32}; + static const Color3 Peru {205, 133, 63}; + static const Color3 Chocolate {210, 105, 30}; + static const Color3 SaddleBrown {139, 69, 19}; + static const Color3 Sienna {160, 82, 45}; + static const Color3 Brown {164, 42, 42}; + static const Color3 Maroon {128, 0, 0}; + } } + struct HSV { float hue; float saturation; diff --git a/main.cpp b/main.cpp index 077888c..a4e29d6 100644 --- a/main.cpp +++ b/main.cpp @@ -43,8 +43,8 @@ void display() { glEnd(); JGL::FillRect2D(JGL::Colors::White, {0, 0}, {128, 128}); - JGL::OutlineRect2D(JGL::Colors::BrightRed, {0, 0}, {128, 128}, 4); - JGL::DrawPixel2D(JGL::Colors::BrightGreen, {0, 0}); + JGL::OutlineRect2D(JGL::Colors::Red, {0, 0}, {128, 128}, 4); + JGL::DrawPixel2D(JGL::Colors::Green, {0, 0}); glBegin(GL_TRIANGLES); glColor3f(0.0f, 0.0f, 1.f); // Blue diff --git a/src/JGL/JGL.cpp b/src/JGL/JGL.cpp index 7fbd24c..cd1f007 100644 --- a/src/JGL/JGL.cpp +++ b/src/JGL/JGL.cpp @@ -3,11 +3,21 @@ // #include #include +#include "J3ML/LinearAlgebra/Transform2D.h" namespace JGL { Vector2 ScreenToViewport(const Vector2 &v) { // TODO: Implement (CORRECT!!!) matrix transformation + + //Transform2D transform; + + //transform = transform.Translate(1.f, 1.f); // Center + //transform = transform.Scale(0.5f, 0.5f); // Scale by half + //transform = transform.Scale(viewportWidth, viewportHeight); // Scale by screen size + + //return transform.Transform(v); + float x = v.x / 600.f; float y = v.y / 600.f; @@ -69,6 +79,4 @@ namespace JGL glVertex2f(vp_pos.x, vp_pos.y); glEnd(); } - -} - +} \ No newline at end of file