chore: renamed the resources directory to res

This commit is contained in:
lisk77 2025-07-26 01:22:42 +02:00
parent 05a4679f38
commit 913f200a63
22 changed files with 1273 additions and 1105 deletions

View file

@ -3,9 +3,9 @@ a free and open source games framework
> [!WARNING]
> This project is in early development and is not yet ready for use.
>
>
> It could be potentially used to make something very basic in a very hacky way, but it is not a good experience.
>
>
> Installation is manual as of right now but if it reaches an acceptable state I will publish the crate on crates.
>
> There is a plan for a project creation tool that will automate the project setup process.
@ -20,7 +20,7 @@ project
│ build.rs
│ crates
│ └── comet
│ resources
│ res
│ └── shaders
│ └── textures
│ └── sounds
@ -29,15 +29,15 @@ project
```
```toml
# Cargo.toml
# Cargo.toml
# ...
[dependencies]
comet = { path = "path/of/the/comet/crate" }
comet = { path = "path/of/the/comet/crate" }
# ...
```
```rust
// main.rs example
// main.rs example
use comet::prelude::*;
struct GameState {}
@ -50,17 +50,17 @@ impl GameState {
// This function will be called once before the event loop starts
fn setup(app: &mut App, renderer: &mut Renderer2D) {}
// This function will be called every tick
// This function will be called every tick
fn update(app: &mut App, renderer: &mut Renderer2D, dt: f32) {}
fn main() {
fn main() {
App::new() // Generate a basic 2D app
.with_preset(App2D) // Pre-registers the `Transform2D` component in the scene
.with_title("Comet App") // Sets the window title
.with_icon(r"resources/textures/comet_icon.png") // Sets the window icon
.with_icon(r"res/textures/comet_icon.png") // Sets the window icon
.with_size(1920, 1080) // Sets the window size
.with_game_state(GameState::new()) // Adds a custom game state struct
.run::<Renderer2D>(setup, update) // Starts app with the given
.run::<Renderer2D>(setup, update) // Starts app with the given
}
```
@ -75,41 +75,41 @@ use std::path::PathBuf;
fn main() -> Result<()> {
// Watch resource directories for changes
println!("cargo:rerun-if-changed=resources/materials/*");
println!("cargo:rerun-if-changed=resources/objects/*");
println!("cargo:rerun-if-changed=resources/textures/*");
println!("cargo:rerun-if-changed=resources/shaders/*");
println!("cargo:rerun-if-changed=resources/data/*");
println!("cargo:rerun-if-changed=resources/sounds/*");
println!("cargo:rerun-if-changed=resources/fonts/*");
println!("cargo:rerun-if-changed=res/materials/*");
println!("cargo:rerun-if-changed=res/objects/*");
println!("cargo:rerun-if-changed=res/textures/*");
println!("cargo:rerun-if-changed=res/shaders/*");
println!("cargo:rerun-if-changed=res/data/*");
println!("cargo:rerun-if-changed=res/sounds/*");
println!("cargo:rerun-if-changed=res/fonts/*");
let profile = env::var("PROFILE")?;
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?);
let target_dir = manifest_dir.join("target").join(&profile);
let dest_resources_dir = target_dir.join("resources");
let dest_resources_dir = target_dir.join("res");
std::fs::create_dir_all(&dest_resources_dir)?;
let mut copy_options = CopyOptions::new();
copy_options.overwrite = true;
copy_options.copy_inside = true;
let resource_folders = vec![
"resources/materials/",
"resources/objects/",
"resources/textures/",
"resources/shaders/",
"resources/data/",
"resources/sounds/",
"resources/fonts/",
"res/materials/",
"res/objects/",
"res/textures/",
"res/shaders/",
"res/data/",
"res/sounds/",
"res/fonts/",
];
let resource_paths: Vec<PathBuf> = resource_folders
.iter()
.map(|p| manifest_dir.join(p))
.collect();
copy_items(&resource_paths, &dest_resources_dir, &copy_options)?;
Ok(())