Skip to content

Commit cae752a

Browse files
Made the bg move with the camera in the editor
good job me
1 parent 1275b2b commit cae752a

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/main.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,20 +1777,22 @@ async fn main() {
17771777

17781778
GameState::Editor => {
17791779
// Draws the background
1780-
draw_texture_ex(
1781-
&default_bg,
1782-
0.0,
1783-
0.0,
1784-
cc_1001,
1785-
DrawTextureParams {
1786-
dest_size: None,
1787-
source: None,
1788-
rotation: 0.0,
1789-
flip_x: false,
1790-
flip_y: false,
1791-
pivot: None
1792-
}
1793-
);
1780+
for i in -1..2 {
1781+
draw_texture_ex(
1782+
&default_bg,
1783+
(i * 1920) as f32 - (cam_pos_x % 1920.0),
1784+
0.0,
1785+
cc_1001,
1786+
DrawTextureParams {
1787+
dest_size: None,
1788+
source: None,
1789+
rotation: 0.0,
1790+
flip_x: false,
1791+
flip_y: false,
1792+
pivot: None
1793+
}
1794+
);
1795+
}
17941796

17951797
// Draws the ground
17961798
for i in -1..screen_width() as i32 / 160 + 2 {

0 commit comments

Comments
 (0)