Skip to content

Commit

Permalink
Swap raylib color palette with AKC12
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanlangston committed Jan 5, 2024
1 parent 3930168 commit 6d0de62
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 58 deletions.
4 changes: 4 additions & 0 deletions src/Colors.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Alien.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
6 changes: 3 additions & 3 deletions src/Models/Meteor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Player.zig
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub const Player = struct {
position.y,
colliderSize,
),
.color = Shared.Color.Gray.Light,
.color = Shared.Color.White,
};
}

Expand Down
10 changes: 5 additions & 5 deletions src/Models/Starscape.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
}
Expand Down Expand Up @@ -70,7 +70,7 @@ pub const Starscape = struct {
0,
),
0,
Shared.Color.Tone.Base,
Shared.Color.Yellow.Light,
);

// raylib.drawTexturePro(
Expand Down Expand Up @@ -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(
Expand All @@ -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 };
Expand Down
2 changes: 1 addition & 1 deletion src/Shared.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ViewModels/AsteroidsViewModel.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions src/ViewModels/DylanSplashScreenViewModel.zig
Original file line number Diff line number Diff line change
@@ -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;
},
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/Views/AsteroidsView.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand All @@ -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,
);
Expand Down
3 changes: 2 additions & 1 deletion src/Views/DylanSplashScreenView.zig
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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);
Expand Down
17 changes: 5 additions & 12 deletions src/Views/GameOverView.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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,
Expand All @@ -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().?;

Expand Down
10 changes: 4 additions & 6 deletions src/Views/MenuView.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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(
Expand All @@ -76,7 +74,7 @@ pub fn DrawFunction() Shared.View.Views {
),
titleFontsizeF,
@floatFromInt(font.glyphPadding),
Shared.Color.Brown.Base,
Shared.Color.Red.Base,
);

// raylib.drawText(
Expand Down
15 changes: 4 additions & 11 deletions src/Views/PausedView.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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().?;

Expand Down
4 changes: 2 additions & 2 deletions src/asteroids-website/src/app.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
5 changes: 4 additions & 1 deletion src/asteroids-website/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
</style>
7 changes: 6 additions & 1 deletion src/asteroids-website/src/routes/controls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6d0de62

Please sign in to comment.