~starkingdoms/starkingdoms

ref: ea95cf279b1c21687826debb5db825fa057e6d3b starkingdoms/starkingdoms-client/src/lib.rs -rw-r--r-- 1.3 KiB
ea95cf27 — core new rendering infrastructure beginnings 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use bevy_ecs::event::Events;
use bevy_ecs::schedule::Schedule;
use bevy_ecs::world::World;
use egui::Context;
use tracing::info;
use crate::ecs::Camera;
use crate::input::MouseWheelEvent;
use crate::rendering::Renderer;
use crate::rendering::ui::UiRenderable;

#[cfg(target_arch = "wasm32")]
#[path = "wasm/mod.rs"]
pub mod platform;
#[cfg(not(target_arch = "wasm32"))]
#[path = "native/mod.rs"]
pub mod platform;

pub mod ecs;
pub mod input;
pub mod rendering;


// Hi, you've found the real main function! This is called AFTER platform-specific initialization code.
pub fn start() {
    info!("Hello, world! StarKingdoms.TK v{} says hello, running on {}", env!("CARGO_PKG_VERSION"), if cfg!(target_arch = "wasm32") { "wasm" } else { "native" });

    info!("Creating the ECS world...");
    let mut world = World::new();
    
    world.insert_resource::<Events<MouseWheelEvent>>(Events::default());
    world.insert_resource(Camera {
        x: 0.0,
        y: 0.0,
        zoom: 1.0,
    });
    
    let mut start_schedule = Schedule::default();
    // Add startup things here
    // Caution: This will run before there are things on-screen
    start_schedule.run(&mut world);
    
    let mut update_schedule = Schedule::default();
    // Add things to run every frame here
    // Caution: This will run once before there are things on screen
    
}