Crates.io | tiny-game-framework |
lib.rs | tiny-game-framework |
version | 0.0.163 |
source | src |
created_at | 2024-05-10 21:57:16.737576 |
updated_at | 2024-06-23 21:32:59.320489 |
description | Tiny game framework for creating games! |
homepage | |
repository | https://github.com/Felipe-Guimaraes-Teodoro/GAME-FRAMEWORK |
max_upload_size | |
id | 1236375 |
size | 2,240,691 |
Warning: this version is unchecked and - most likely - messed up. Future updates SHALL fix this.
As of now, the crate aims to prioritize simplicity.
use tiny_game_framework::{
glam::{vec2, vec3, vec4, Vec4},
gl::{Clear, COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT},
EventLoop,
Renderer,
Cuboid,
};
fn main() {
let resolution = vec2(800., 800.);
let mut el = EventLoop::new(resolution.x as u32, resolution.y as u32);
let mut renderer = Renderer::new();
let c = Cuboid::new(vec3(600., 600., 600.0), vec4(1.0, 1.0, 1.0, 1.0)).mesh();
renderer.add_mesh("c", c).unwrap();
el.window.set_cursor_mode(glfw::CursorMode::Disabled);
while !el.window.should_close() {
el.update();
renderer.camera.mouse_callback(el.event_handler.mouse_pos.x, el.event_handler.mouse_pos.y, &el.window);
renderer.camera.input(&el.window, &el.window.glfw);
renderer.camera.update(renderer.camera.pos);
let frame = el.ui.frame(&mut el.window);
frame.text("hello, world!");
unsafe {
Clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
renderer.draw(&el);
el.ui.draw();
}
}
}