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
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
/*!

Small game framework.
Currently has systems for:
- Rendering ([glium](https://github.com/tomaka/glium))
- Input ([glutin](https://github.com/tomaka/glutin))
- Physics ([nphysics](https://github.com/sebcrozet/nphysics))
- Audio ([rodio](https://github.com/tomaka/rodio))

Note: This is being used for/was created with [specific game](https://twitter.com/SHockham/status/821691014863798272) in mind so might not be ideal for use with everything.

[Example](https://github.com/shockham/caper/blob/master/examples/simple.rs) of a basis for a game:

```
extern crate caper;

use caper::types::{ RenderItemBuilder, TransformBuilder };
use caper::game::Game;
use caper::mesh::gen_cube;
use caper::imgui::Ui;
use caper::input::Key;

fn main() {
    // crate an instance of the game struct
    let mut game = Game::new();

    // define some items to be rendered
    game.add_render_item(
        RenderItemBuilder::default()
            .vertices(gen_cube())
            .instance_transforms(vec![
                TransformBuilder::default()
                    .pos((-0.5, 0.0, -5.0))
                    .build()
                    .unwrap()
            ])
            .build()
            .unwrap());

    loop {
        // run the engine update
        game.update(|_:&Ui|{ });

        // update the first person inputs
        game.input.handle_fp_inputs(&mut game.cam_state);

        // quit
        if game.input.keys_down.contains(&Key::Escape) { break; }
    }
}
```

*/

#![deny(missing_docs)]

#[macro_use]
pub extern crate glium;
#[macro_use]
extern crate derive_builder;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate lazy_static;

pub extern crate imgui;
pub extern crate ncollide;
pub extern crate nphysics3d;
pub extern crate nalgebra;
pub extern crate image;

extern crate glium_text_rusttype as glium_text;
extern crate noise;
extern crate time;
extern crate fps_counter;
extern crate bincode;
extern crate serde;
extern crate gif;
extern crate rodio;
extern crate imgui_glium_renderer;

/// Module for utility functions for textures
#[macro_use]
pub mod texture;
/// A module for rendering items
pub mod renderer;
/// Utility functions and macros
pub mod utils;
/// Module for input handing
pub mod input;
/// Module for dealing with shaders
pub mod shader;
/// Module for procedurally generated meshes
pub mod mesh;
/// Rendering post processing effects
pub mod posteffect;
/// All of the caper types
pub mod types;
/// Simple collision detection
pub mod collision;
/// Module for saving and loading data
pub mod persist;
/// Module represent another way of creating a game
pub mod game;
/// Module for the lighting system
pub mod lighting;
/// Module for the audio system
pub mod audio;