Skip to content

Commit

Permalink
Update paralax starscape effect
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanlangston committed Jan 3, 2024
1 parent 2c0482e commit 542a334
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions src/Models/Starscape.zig
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,48 @@ pub const Starscape = struct {
Shared.Color.Tone.Base,
);

// raylib.drawTexturePro(
// self.starTexture,
// raylib.Rectangle.init(
// 0,
// 0,
// textWidthF,
// textHeightF,
// ),
// raylib.Rectangle.init(
// position.x - (textWidthF / 2),
// position.y - (textHeightF / 2),
// textWidthF,
// textHeightF,
// ),
// raylib.Vector2.init(
// 0,
// 0,
// ),
// 0,
// Shared.Color.Tone.Base,
// );

raylib.drawTexturePro(
self.starTexture,
raylib.Rectangle.init(
0,
0,
textWidthF,
textHeightF,
-textWidthF,
-textHeightF,
),
raylib.Rectangle.init(
position.x - (textWidthF / 2),
position.y - (textHeightF / 2),
textWidthF,
textHeightF,
textWidthF + (screenWidth * 0.5),
textHeightF + (screenHeight * 0.5),
),
raylib.Vector2.init(
0,
0,
(position.x / textWidthF) * (textWidthF * 0.5),
(position.y / textHeightF) * (textHeightF * 0.5),
),
0,
Shared.Color.Tone.Base,
Shared.Color.Red.Light,
);

raylib.drawTexturePro(
Expand All @@ -106,15 +128,15 @@ pub const Starscape = struct {
raylib.Rectangle.init(
position.x - (textWidthF / 2),
position.y - (textHeightF / 2),
textWidthF + (screenWidth * 0.5),
textHeightF + (screenHeight * 0.5),
textWidthF + (screenWidth * 0.25),
textHeightF + (screenHeight * 0.25),
),
raylib.Vector2.init(
(position.x / textWidthF) * (textWidthF * 0.5),
(position.y / textHeightF) * (textHeightF * 0.5),
(position.x / textWidthF) * (textWidthF * 0.25),
(position.y / textHeightF) * (textHeightF * 0.25),
),
0,
Shared.Color.Red.Light,
Shared.Color.Tone.Base,
);

// const paralaxAngles = [_]f32{ 0.2, 0.05 };
Expand Down

0 comments on commit 542a334

Please sign in to comment.