From 6d0de62e43ec245f8bb77d7928650bc6d467e2fd Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 5 Jan 2024 14:14:19 +0000 Subject: [PATCH] Swap raylib color palette with AKC12 --- src/Colors.zig | 4 ++++ src/Models/Alien.zig | 2 +- src/Models/Meteor.zig | 6 +++--- src/Models/Player.zig | 2 +- src/Models/Starscape.zig | 10 +++++----- src/Shared.zig | 2 +- src/ViewModels/AsteroidsViewModel.zig | 2 +- src/ViewModels/DylanSplashScreenViewModel.zig | 13 +++++++------ src/Views/AsteroidsView.zig | 12 ++++++------ src/Views/DylanSplashScreenView.zig | 3 ++- src/Views/GameOverView.zig | 17 +++++------------ src/Views/MenuView.zig | 10 ++++------ src/Views/PausedView.zig | 15 ++++----------- src/asteroids-website/src/app.postcss | 4 ++-- src/asteroids-website/src/routes/+page.svelte | 5 ++++- .../src/routes/controls.svelte | 7 ++++++- 16 files changed, 56 insertions(+), 58 deletions(-) diff --git a/src/Colors.zig b/src/Colors.zig index 6663b11..bb2f42e 100644 --- a/src/Colors.zig +++ b/src/Colors.zig @@ -53,6 +53,10 @@ pub const DefaultColors = struct { }; pub const AKC12 = struct { + pub const Transparent = raylib.Color.blank; + pub const White = raylib.Color.white; + pub const Black = raylib.Color.black; + pub const Red = Color{ .Base = raylib.Color.init(194, 75, 110, 255), .Dark = raylib.Color.init(167, 49, 105, 255), diff --git a/src/Models/Alien.zig b/src/Models/Alien.zig index cbff5eb..a7d5ea8 100644 --- a/src/Models/Alien.zig +++ b/src/Models/Alien.zig @@ -43,7 +43,7 @@ pub const Alien = struct { .radius = 10, .rotation = Shared.Random.Get().float(f32) * 360, .active = false, - .color = Shared.Color.Yellow.Base, + .color = Shared.Color.Green.Dark, .frame = Shared.Random.Get().float(f32) * 10, }; diff --git a/src/Models/Meteor.zig b/src/Models/Meteor.zig index c16da8e..9853440 100644 --- a/src/Models/Meteor.zig +++ b/src/Models/Meteor.zig @@ -124,7 +124,7 @@ pub const Meteor = struct { // Reset Frame self.frame = 0; // Reset color - self.color = Shared.Color.Blue.Base; + self.color = Shared.Color.White; // Check Collision with player based on circle radius if (raylib.checkCollisionCircles( @@ -278,7 +278,7 @@ pub const Meteor = struct { meteor.radius, ), meteor.rotation * 365, - Shared.Color.Tone.Light, + Shared.Color.White, ); } const meteorRenderImage = raylib.Image.fromTexture(meteorRenderTexture.texture); @@ -300,7 +300,7 @@ pub const Meteor = struct { raylib.Rectangle.init(player.position.x - x1, player.position.y - y1, base_size, shipHeight), raylib.Vector2.init(base_size / 2, shipHeight / 2), player.rotation, - Shared.Color.Tone.Light, + Shared.Color.White, ); } const playerRenderImage = raylib.Image.fromTexture(playerRenderTexture.texture); diff --git a/src/Models/Player.zig b/src/Models/Player.zig index 3f9e5c8..c5ad4fa 100644 --- a/src/Models/Player.zig +++ b/src/Models/Player.zig @@ -49,7 +49,7 @@ pub const Player = struct { position.y, colliderSize, ), - .color = Shared.Color.Gray.Light, + .color = Shared.Color.White, }; } diff --git a/src/Models/Starscape.zig b/src/Models/Starscape.zig index fe2c8e6..93f2bab 100644 --- a/src/Models/Starscape.zig +++ b/src/Models/Starscape.zig @@ -28,8 +28,8 @@ pub const Starscape = struct { @intFromFloat(star.x), @intFromFloat(star.y), star.z, - Shared.Color.Blue.Base, - Shared.Color.Yellow.Base, + Shared.Color.White, + Shared.Color.Yellow.Light, ); } } @@ -70,7 +70,7 @@ pub const Starscape = struct { 0, ), 0, - Shared.Color.Tone.Base, + Shared.Color.Yellow.Light, ); // raylib.drawTexturePro( @@ -114,7 +114,7 @@ pub const Starscape = struct { (position.y / textHeightF) * (textHeightF * 0.5), ), 0, - Shared.Color.Red.Light, + Shared.Color.Red.Base, ); raylib.drawTexturePro( @@ -136,7 +136,7 @@ pub const Starscape = struct { (position.y / textHeightF) * (textHeightF * 0.25), ), 0, - Shared.Color.Tone.Base, + Shared.Color.Yellow.Light, ); // const paralaxAngles = [_]f32{ 0.2, 0.05 }; diff --git a/src/Shared.zig b/src/Shared.zig index 9474e8c..3c071bf 100644 --- a/src/Shared.zig +++ b/src/Shared.zig @@ -15,7 +15,7 @@ const vl = @import("ViewLocator.zig"); const Views = @import("ViewLocator.zig").Views; const V = @import("./Views/View.zig").View; const VM = @import("./ViewModels/ViewModel.zig").ViewModel; -const Colors = @import("Colors.zig").DefaultColors; +const Colors = @import("Colors.zig").AKC12; const Helpers_ = @import("Helpers.zig").Helpers; const RndGen = std.rand.DefaultPrng; const Sprites = @import("Sprite.zig").Sprite; diff --git a/src/ViewModels/AsteroidsViewModel.zig b/src/ViewModels/AsteroidsViewModel.zig index d6fe88f..1955cbf 100644 --- a/src/ViewModels/AsteroidsViewModel.zig +++ b/src/ViewModels/AsteroidsViewModel.zig @@ -77,7 +77,7 @@ pub const AsteroidsViewModel = Shared.View.ViewModel.Create( // Initialization shoot inline for (0..PLAYER_MAX_SHOOTS) |i| { - shoot[i] = Shoot.init(Shared.Color.Tone.Light); + shoot[i] = Shoot.init(Shared.Color.Yellow.Dark); } // Initialization Meteors diff --git a/src/ViewModels/DylanSplashScreenViewModel.zig b/src/ViewModels/DylanSplashScreenViewModel.zig index cf4b867..15179d2 100644 --- a/src/ViewModels/DylanSplashScreenViewModel.zig +++ b/src/ViewModels/DylanSplashScreenViewModel.zig @@ -1,29 +1,30 @@ const std = @import("std"); const Shared = @import("../Shared.zig").Shared; +const Colors = @import("../Colors.zig").DefaultColors; const raylib = @import("raylib"); const RndGen = std.rand.DefaultPrng; pub const DylanSplashScreenViewModel = Shared.View.ViewModel.Create( struct { - var lastRandom: raylib.Color = Shared.Color.Green.Dark; + var lastRandom: raylib.Color = Colors.Green.Dark; pub inline fn GetRandomColor(seed: f32) raylib.Color { var rnd = RndGen.init(@as(u64, @intFromFloat(seed))); const random = rnd.random().intRangeAtMost(u8, 0, 4); switch (random) { 0 => { - return Shared.Color.Red.Dark; + return Colors.Red.Dark; }, 1 => { - return Shared.Color.Yellow.Dark; + return Colors.Yellow.Dark; }, 2 => { - return Shared.Color.Green.Dark; + return Colors.Green.Dark; }, 3 => { - return Shared.Color.Blue.Dark; + return Colors.Blue.Dark; }, else => { - return Shared.Color.Purple.Dark; + return Colors.Purple.Dark; }, } } diff --git a/src/Views/AsteroidsView.zig b/src/Views/AsteroidsView.zig index 9519fa1..d02b6fa 100644 --- a/src/Views/AsteroidsView.zig +++ b/src/Views/AsteroidsView.zig @@ -11,7 +11,7 @@ const AsteroidsViewModel = @import("../ViewModels/AsteroidsViewModel.zig").Aster const vm: type = AsteroidsViewModel.GetVM(); fn DrawFunction() Shared.View.Views { - raylib.clearBackground(Shared.Color.Tone.Dark); + raylib.clearBackground(Shared.Color.Blue.Dark); vm.starScape.Draw( vm.screenSize.x, @@ -22,7 +22,7 @@ fn DrawFunction() Shared.View.Views { raylib.drawRectangleLinesEx( raylib.Rectangle.init(0, 0, vm.screenSize.x, vm.screenSize.y), 3, - Shared.Color.Green.Light, + Shared.Color.Yellow.Dark, ); // Flash shield if player hurt @@ -102,7 +102,7 @@ fn DrawWithCamera() Shared.View.Views { ), 5 * onePixelScaled, 5, - Shared.Color.Gray.Dark.alpha(0.5), + Shared.Color.Red.Dark.alpha(0.5), ); if (vm.shieldLevel > 0) { raylib.drawRectangleRounded( @@ -133,7 +133,7 @@ fn DrawWithCamera() Shared.View.Views { 5 * onePixelScaled, 5, onePixelScaled, - Shared.Color.Gray.Dark, + Shared.Color.Red.Dark, ); const locale = Shared.Locale.GetLocale(); @@ -142,9 +142,9 @@ fn DrawWithCamera() Shared.View.Views { var scoreBuffer: [64]u8 = undefined; Shared.Helpers.DrawTextWithFontRightAligned( std.fmt.bufPrintZ(&scoreBuffer, "{s}{}", .{ locale.?.Score, vm.score }) catch locale.?.ScoreNotFound, - Shared.Color.Blue.Light, + Shared.Color.Yellow.Light, font, - onePixelScaled * 10, + onePixelScaled * 15, screenWidth - (5 * onePixelScaled), 5, ); diff --git a/src/Views/DylanSplashScreenView.zig b/src/Views/DylanSplashScreenView.zig index 92015fc..703f1eb 100644 --- a/src/Views/DylanSplashScreenView.zig +++ b/src/Views/DylanSplashScreenView.zig @@ -1,5 +1,6 @@ const std = @import("std"); const Shared = @import("../Shared.zig").Shared; +const Colors = @import("../Colors.zig").DefaultColors; const raylib = @import("raylib"); const DylanSplashScreenViewModel = @import("../ViewModels/DylanSplashScreenViewModel.zig").DylanSplashScreenViewModel; @@ -9,7 +10,7 @@ fn DrawFunction() Shared.View.Views { framesCounter += raylib.getFrameTime() * 60; - raylib.clearBackground(Shared.Color.Tone.Dark); + raylib.clearBackground(Colors.Tone.Dark); const text = Shared.Locale.GetLocale().?.Dylan_Splash_Text; const font = Shared.Font.Get(.TwoLines); diff --git a/src/Views/GameOverView.zig b/src/Views/GameOverView.zig index 7ce73fd..198f7f3 100644 --- a/src/Views/GameOverView.zig +++ b/src/Views/GameOverView.zig @@ -7,7 +7,7 @@ const GameOverViewModel = @import("../ViewModels/GameOverViewModel.zig").GameOve const vm: type = GameOverViewModel.GetVM(); pub fn DrawFunction() Shared.View.Views { - raylib.clearBackground(Shared.Color.Gray.Base); + raylib.clearBackground(Shared.Color.Black); const screenWidth: f32 = @floatFromInt(raylib.getScreenWidth()); const screenHeight: f32 = @floatFromInt(raylib.getScreenHeight()); @@ -42,13 +42,13 @@ pub fn DrawFunction() Shared.View.Views { rec2, raylib.Vector2.init(0, 0), 0, - Shared.Color.Brown.Light, + Shared.Color.White, ); } - const foregroundColor = Shared.Color.Blue.Base; - const backgroundColor = Shared.Color.Blue.Light.alpha(0.75); - const accentColor = Shared.Color.Blue.Dark; + const foregroundColor = Shared.Color.Yellow.Base; + const backgroundColor = Shared.Color.Green.Base.alpha(0.75); + const accentColor = Shared.Color.Yellow.Dark; const background_rec = raylib.Rectangle.init( startX, @@ -63,13 +63,6 @@ pub fn DrawFunction() Shared.View.Views { 10, backgroundColor, ); - raylib.drawRectangleRoundedLines( - background_rec, - 0.1, - 10, - 5, - foregroundColor, - ); const locale = Shared.Locale.GetLocale().?; diff --git a/src/Views/MenuView.zig b/src/Views/MenuView.zig index d163b5b..5b25033 100644 --- a/src/Views/MenuView.zig +++ b/src/Views/MenuView.zig @@ -26,7 +26,7 @@ fn Background(target: raylib.Vector2) void { } pub fn DrawFunction() Shared.View.Views { - raylib.clearBackground(Shared.Color.Tone.Dark); + raylib.clearBackground(Shared.Color.Blue.Dark); Shared.Music.Play(.TitleScreenMusic); @@ -54,10 +54,8 @@ pub fn DrawFunction() Shared.View.Views { ); camera.DrawWithArg(void, raylib.Vector2, Background, playerPosition); - const foregroundColor = Shared.Color.Blue.Base; - const backgroundColor = Shared.Color.Blue.Light.alpha(0.75); - _ = backgroundColor; - const accentColor = Shared.Color.Blue.Dark; + const foregroundColor = Shared.Color.Yellow.Base; + const accentColor = Shared.Color.Yellow.Dark; // Title const TitleTextSize = raylib.measureTextEx( @@ -76,7 +74,7 @@ pub fn DrawFunction() Shared.View.Views { ), titleFontsizeF, @floatFromInt(font.glyphPadding), - Shared.Color.Brown.Base, + Shared.Color.Red.Base, ); // raylib.drawText( diff --git a/src/Views/PausedView.zig b/src/Views/PausedView.zig index bceca16..eda6d79 100644 --- a/src/Views/PausedView.zig +++ b/src/Views/PausedView.zig @@ -36,13 +36,13 @@ pub fn DrawFunction() Shared.View.Views { rec2, raylib.Vector2.init(0, 0), 0, - Shared.Color.Brown.Light, + Shared.Color.White, ); } - const foregroundColor = Shared.Color.Blue.Base; - const backgroundColor = Shared.Color.Blue.Light.alpha(0.75); - const accentColor = Shared.Color.Blue.Dark; + const foregroundColor = Shared.Color.Yellow.Base; + const backgroundColor = Shared.Color.Green.Base.alpha(0.75); + const accentColor = Shared.Color.Yellow.Dark; const background_rec = raylib.Rectangle.init( startX, @@ -57,13 +57,6 @@ pub fn DrawFunction() Shared.View.Views { 10, backgroundColor, ); - raylib.drawRectangleRoundedLines( - background_rec, - 0.1, - 10, - 5, - foregroundColor, - ); const locale = Shared.Locale.GetLocale().?; diff --git a/src/asteroids-website/src/app.postcss b/src/asteroids-website/src/app.postcss index 6a725bb..1170c09 100644 --- a/src/asteroids-website/src/app.postcss +++ b/src/asteroids-website/src/app.postcss @@ -17,11 +17,11 @@ a { } html { - background-color: theme(colors.blue-dark); + background-color: theme(colors.blue-mid); background-repeat: repeat; overflow: hidden; } * { - @apply text-yellow-light; + @apply text-yellow-mid; } \ No newline at end of file diff --git a/src/asteroids-website/src/routes/+page.svelte b/src/asteroids-website/src/routes/+page.svelte index bc505d4..f5274af 100644 --- a/src/asteroids-website/src/routes/+page.svelte +++ b/src/asteroids-website/src/routes/+page.svelte @@ -319,6 +319,9 @@ } .btn { - @apply rounded bg-green-light/[.5] p-2 m-2 fill-yellow-light/[.75]; + @apply rounded bg-green-mid/[.5] p-2 m-2 fill-yellow-mid/[.75] fill-yellow-mid/[.75]; + } + .btn:hover { + @apply rounded bg-green-mid/[.5] p-2 m-2 fill-yellow-dark/[.75]; } diff --git a/src/asteroids-website/src/routes/controls.svelte b/src/asteroids-website/src/routes/controls.svelte index 3fae88d..58fc8fd 100644 --- a/src/asteroids-website/src/routes/controls.svelte +++ b/src/asteroids-website/src/routes/controls.svelte @@ -175,10 +175,15 @@ #a.down, #start.down { background-color: theme(colors.green-dark); + color: theme(colors.yellow-dark); + } + + button.down > .arrow { + border: solid theme(colors.yellow-dark); } .arrow { - border: solid theme(colors.yellow-light); + border: solid theme(colors.yellow-mid); border-width: 0 3px 3px 0; display: inline-block; padding: 3px;