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
extern crate alloc;
use alloc::sync::Arc;
use core::{
marker::PhantomData,
sync::atomic::{AtomicBool, Ordering},
};
pub mod beryllium {
use super::*;
use fermium::*;
unsafe fn get_error_unchecked() -> String {
let mut out = String::new();
let mut p: *const u8 = SDL_GetError().cast();
while *p != 0 {
out.push(*p as char);
p = p.add(1);
}
out
}
mod gl_window;
use gl_window::*;
mod initialization;
use initialization::*;
pub struct Sdl {
init: Arc<Initialization>,
}
impl Sdl {
pub fn init() -> Self {
Self { init: Arc::new(Initialization::new()) }
}
pub fn create_gl_window(
&self,
title: &str,
location: Option<[i32; 2]>,
size: [i32; 2],
) -> GlWindow {
GlWindow::new(self.init.clone(), title, location, size)
}
}
}