3 个版本
0.1.3 | 2023 年 5 月 8 日 |
---|---|
0.1.1 | 2023 年 4 月 24 日 |
0.1.0 | 2023 年 4 月 23 日 |
#688 in 图形 API
用于 appy
33KB
656 行
glapp
OpenGL 元窗口和上下文创建。
Rust 生态系统中的窗口和图形上下文创建流程目前正在经历一种寒武纪式的爆炸,因此,在处理不同的底层库和工具链时,保持灵活性是很有好处的。
我创建了 Glapp,作为一种“元库”,它封装了不同的底层库,每个库都有其相应的优势,这取决于平台和情况。
目标是使您编写的代码能够100%地从一种平台转移到另一种平台。无需根据平台对主函数进行破坏或重命名,glapp 会处理这些。它还应该尽可能简单易用。一个简单的例子如下
use glapp::*;
#[glapp_main]
fn main(mut app:App) {
app.title("Testing Glapp");
app.run(|window,event|{
match event {
AppEvent::Open=>{
// The OpenGL context is created and made current.
},
AppEvent::Render=>{
// This is where we render our scene.
},
// ... see docs for more events, e.g. input and such ...
}
});
}
应理解的是,Glapp 在这些库的功能方面提供了一种“最低共同点”。如果您想进行更细粒度的控制,请直接使用相应的库。
库
Glapp 可以与以下底层库一起工作。作为功能启用它们
sdl
- Simple DirectMedia Layer 是一个用 C 编写的跨平台开发库。SDL 正式支持 Windows、macOS、Linux、iOS 和 Android。SDL 自 1998 年以来一直存在,经过彻底的实战测试。glutin
- Glutin 是一个具有强大动力和深厚社区根基的纯 Rust 库。
依赖关系
~1–17MB
~197K SLoC