forked from deltaphc/raylib-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfont.rs
38 lines (37 loc) · 1.17 KB
/
font.rs
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
extern crate raylib;
use raylib::prelude::*;
fn main() {
let w = 800;
let h = 450;
let rust_orange = Color::new(222, 165, 132, 255);
let ray_white = Color::new(255, 255, 255, 255);
let (mut rl, thread) = raylib::init().size(w, h).title("Logo").build();
rl.set_target_fps(60);
let font = rl
.load_font(&thread, "static/alagard.png")
.expect("couldn't load font");
while !rl.window_should_close() {
// Detect window close button or ESC key
let mut d = rl.begin_drawing(&thread);
d.clear_background(ray_white);
d.draw_rectangle(w / 2 - 128, h / 2 - 128, 256, 256, rust_orange);
d.draw_rectangle(w / 2 - 112, h / 2 - 112, 224, 224, ray_white);
d.draw_text_ex(
&font,
"rust",
Vector2::new((w / 2 - 69) as f32, (h / 2 + 18) as f32),
50.0,
1.0,
rust_orange,
);
d.draw_text_ex(
&font,
"raylib",
Vector2::new((w / 2 - 44) as f32, (h / 2 + 48) as f32),
50.0,
1.0,
rust_orange,
);
// rl.take_screenshot(&thread, "logo.png");
}
}