summaryrefslogtreecommitdiff
path: root/bindgen/rust/examples/main_loop.rs
blob: a74e11c3e592f7713bafc52a87d1ed817fbcbf43 (plain)
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
use celeritas::*;

unsafe fn run_game() {
  // init
  Core_Bringup();

  // let mut cube_geo = Geo_CreateCuboid(Vec3 { x: 1.0, y: 1.0, z: 1.0 });
  // let cube = Mesh_Create(&mut cube_geo, false);

  let camera_pos = Vec3 { x: 0.0, y: 2.0, z: -3.0 };
  let pos_y = Vec3 { x: 0., y: 1.0, z: 0. };
  let camera = Camera_Create(camera_pos, vec3_normalise(vec3_negate(camera_pos)), pos_y, 45.0);
  SetCamera(camera);
  // let camera = Camera_Create(camera_pos, vec3_normalise(vec3_negate(camera_pos)), VEC3_Y, 45.0);
  // SetCamera(cam);  // update the camera in RenderScene

  let whatever = Vec3 { x: 1.0, y: 1.0, z: 1.0 };
  let sun = DirectionalLight { direction: whatever, ambient: whatever, diffuse: whatever, specular: whatever };
  SetMainLight(sun);

  // Skybox skybox = Skybox_Create(faces, 6);
  let skybox = Skybox_Create(face_paths, 6);

    while !ShouldExit() {
      Frame_Begin();



      Frame_End();
    }
}

fn main() {
    println!("Running from Rust!");

    unsafe {
        run_game();
    }
}