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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! # Gust
//! Gust is a **graphical library** written in Rust by myself (Alexandre Fourcat)
//! Nothing really big or incredible but I inspired myself of SFML and kiss3D
//! The idea behind it it's to make the 2019 GGJ with this motor
//! This project is based on learning purpose and abstract everything that put me in pain
//! when I was trying to do computer graphics.
//! Here is some gust code
//! ```no_run
//! extern crate gust;
//! extern crate glfw;
//!
//! use gust::sprite::Sprite;
//! use gust::window::Window;
//! use gust::{Vector,Point,Key};
//! use gust::event;
//! use gust::event::{EventHandler,Events,Event};
//! use std::rc::Rc;
//! use gust::color::Color;
//! use gust::texture::{Texture};
//! use gust::draw::{Drawer,Movable};
//! use gust::draw::Drawable;
//!
//! fn main()
//! {
//! let mut window = Window::new(gust::WIDTH, gust::HEIGHT, "Hello");
//! let tex_leave = Rc::new(Texture::new("examples/texture/Z.png"));
//! let tex_dirt = Rc::new(Texture::new("examples/texture/Dirt.png"));
//! let event_handler = EventHandler::new(&window);
//! let mut sprite = Sprite::from(&tex_dirt);
//! let mut leave = Sprite::from(&tex_leave);
//!
//! leave.set_position(Point::new(300.0, 300.0));
//! window.set_clear_color(Color::new(0.0, 0.0, 1.0));
//! window.enable_cursor();
//! window.poll(None);
//! leave.set_scale(Vector::new(0.5, 0.5));
//! leave.set_origin_to_center().unwrap_or_else(|e| println!("{}", e));
//! while window.is_open() {
//! window.poll_events();
//! leave.rotate(1.0);
//! leave.update();
//! sprite.update();
//!
//! for event in event_handler.fetch() {
//! event_process(event, &mut window);
//! }
//!
//! window.clear();
//! window.draw(&sprite);
//! window.draw(&leave);
//! window.display();
//! }
//! }
//!
//! fn event_process(event: Event, window: &mut Window) {
//! match event.1 {
//! Events::Key(Key::Escape, _, _, _) => {
//! window.close();
//! },
//! Events::MouseButton(_, _, _) => {
//! println!("Mouse button !");
//! },
//! Events::CursorPos(x, y) => {
//! println!("x: {}, y: {}", x, y);
//! },
//! _ => { println!("Another event !") }
//! }
//! }
//! ```
extern crate freetype;
extern crate gl;
extern crate glfw;
extern crate nalgebra;
extern crate lazy_static;
extern crate alga;
extern crate image;
pub use Action;
pub use Key;
pub use MouseButton;
pub use MouseButtonLeft;
pub use MouseButtonMiddle;
pub use MouseButtonRight;
pub use Matrix4;
pub use ;
pub type Vector<T> = Vector2;
pub type Point<T> = ;
pub type Coord = Vector2;
pub static HEIGHT: u32 = 900;
pub static WIDTH: u32 = 1600;