Skip to content

Commit 4dbc2f1

Browse files
Add the skip button to the title screen
Signed-off-by: Akaalroop Singh <akaal@akaalroop.com>
1 parent f853575 commit 4dbc2f1

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/main.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn draw_centred_text(text: &str, base_font_size: f32, y: f32, colour: Color, cen
3333
}
3434

3535
fn get_asset_path(asset: &str) -> String {
36-
if cfg!(debug_assertions) || cfg!(target_arch="wasm32") {
36+
if cfg!(debug_assertions) || cfg!(target_arch = "wasm32") {
3737
format!("assets/{}", asset)
3838
} else {
3939
let exe_path = env::current_exe()
@@ -126,6 +126,11 @@ async fn main() {
126126
.unwrap();
127127
github_icon.set_filter(FilterMode::Linear);
128128

129+
let skip_button: Texture2D = load_texture(get_asset_path("skip_button.png").as_str())
130+
.await
131+
.unwrap();
132+
skip_button.set_filter(FilterMode::Linear);
133+
129134
// Game OVER RAWHHH >:)
130135
let mut game_over = false;
131136

@@ -206,6 +211,23 @@ async fn main() {
206211
false,
207212
);
208213

214+
draw_texture_ex(
215+
&skip_button,
216+
screen_width() - get_responsive_size(32.0) * 1.5,
217+
screen_height() - get_responsive_size(32.0) * 1.5,
218+
WHITE,
219+
DrawTextureParams {
220+
dest_size: Some(vec2(get_responsive_size(32.0), get_responsive_size(32.0))),
221+
source: Some(Rect {
222+
x: 0.0,
223+
y: 0.0,
224+
w: 32.0,
225+
h: 32.0,
226+
}),
227+
..Default::default()
228+
},
229+
);
230+
209231
title_screen_frame += 1;
210232
title_screen_opacity = (title_screen_opacity - 0.0016).max(0.0);
211233
title_cat_x += screen_width() / 500.0;

0 commit comments

Comments
 (0)