Skip to content

Commit dec08f7

Browse files
Moved a function lncvrt made to funcs.rs
bro didnt notivce the other file that yk had the strff it in so ihe put it in main.rs cuz he stupid
1 parent 18d5cc4 commit dec08f7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/funcs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use macroquad::prelude::*;
2+
use image::ImageReader;
23

34
use crate::types::*;
45

@@ -475,4 +476,10 @@ macro_rules! impl_lua_fields {
475476
}
476477
}
477478
};
479+
}
480+
481+
pub fn get_resized_rgba_bytes(path: &str, size: u32) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
482+
let img = ImageReader::open(path)?.decode()?.to_rgba8();
483+
let resized = image::imageops::resize(&img, size, size, image::imageops::Lanczos3);
484+
Ok(resized.into_raw())
478485
}

src/main.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::{cell::Cell, collections::HashMap, rc::Rc};
33
use game::{loading::load_level, parsing::parse_level_download_response};
44
use macroquad::prelude::*;
55
use miniquad::conf::Icon;
6-
use image::ImageReader;
76
use std::convert::TryInto;
87

98
use gr_rodio::rodio_raw::OutputStream;
@@ -19,12 +18,6 @@ use types::*;
1918
mod game;
2019
use game::*;
2120

22-
fn get_resized_rgba_bytes(path: &str, size: u32) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
23-
let img = ImageReader::open(path)?.decode()?.to_rgba8();
24-
let resized = image::imageops::resize(&img, size, size, image::imageops::Lanczos3);
25-
Ok(resized.into_raw())
26-
}
27-
2821
fn window_conf() -> Conf {
2922
let small_vec = get_resized_rgba_bytes("./Resources/logo.png", 16).unwrap();
3023
let medium_vec = get_resized_rgba_bytes("./Resources/logo.png", 32).unwrap();

0 commit comments

Comments
 (0)