Initial commit - some engine bugs stopping compiling

This commit is contained in:
Will
2026-03-29 15:52:42 +01:00
commit 3d573a200e
361 changed files with 332759 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
extern crate glfw;
extern crate glad_gl;
use glfw::{Action, Context, Key};
use glad_gl::gl;
fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
let (mut window, events) = glfw.create_window(300, 300, "[glad] Rust - OpenGL with GLFW", glfw::WindowMode::Windowed)
.expect("Failed to create GLFW window.");
window.set_key_polling(true);
window.make_current();
gl::load(|e| glfw.get_proc_address_raw(e) as *const std::os::raw::c_void);
while !window.should_close() {
glfw.poll_events();
for (_, event) in glfw::flush_messages(&events) {
handle_window_event(&mut window, event);
}
unsafe {
gl::ClearColor(0.7, 0.9, 0.1, 1.0);
gl::Clear(gl::COLOR_BUFFER_BIT);
}
window.swap_buffers();
}
}
fn handle_window_event(window: &mut glfw::Window, event: glfw::WindowEvent) {
match event {
glfw::WindowEvent::Key(Key::Escape, _, Action::Press, _) => {
window.set_should_close(true)
}
_ => {}
}
}