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
//! Simple Game Utilities
//!
//! # Usage
//!
//! ```no_run
//!# const BYTES: [u8; 7] = [0,0,0,0,0,0,0];
//!# const TILESET_FILE_CONTENTS: &str = "";
//!# const TILEMAP_FILE_CONTENTS: &str = "";
//!# fn main() {
//!# use ici_files::image::IndexedImage;
//!# use simple_game_utils::prelude::*;
//!# let engine = AudioEngine::new().unwrap();
//!# let duration = 1.0;
//!# struct Graphics {
//!# }
//!# impl Graphics {
//!# fn draw_indexed_image(&self, pos: (isize,isize), img: &IndexedImage) {}
//!# }
//! let mut timing = Timing::new(240);
//! let mut timer = Timer::new_with_delay(1.0, 2.0); //timer that triggers every second after waiting 2s initially
//! let mut sound = engine.load_from_bytes(&BYTES, duration).unwrap();
//! let ici_tileset: IciTileset = ron::from_str(TILESET_FILE_CONTENTS).unwrap();
//! let tileset = ici_tileset.into_tileset().unwrap();
//! let tilemap_file: TilemapFile = ron::from_str(TILEMAP_FILE_CONTENTS).unwrap();
//! let tilemap: Tilemap<IndexedImage> = tilemap_file.into_tilemap(&tileset, (200,200)).unwrap();
//!
//! sound.play();
//! loop {
//! sound.update(&timing);
//! if timer.update(&timing) {
//! break;
//! }
//! }
//! # let graphics = Graphics{};
//! tilemap.draw(|img, pos| graphics.draw_indexed_image(pos, img));
//!# }
//! ```