wingl 0.1.2

A minimal opengl windows for the win32 api.
Documentation
  • Coverage
  • 40.74%
    44 out of 108 items documented0 out of 35 items with examples
  • Size
  • Source code size: 25.5 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.87 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 28s Average build duration of successful builds.
  • all releases: 26s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • TheWhiteShadow4

Wingl

Minimales Win32 Fenster mit Opengl Kontext. Entwickelt für mein Retro Game Projekt Yinera.

Die Bibliothek verwendet ausschließlich die ASCII Methoden der Windows Api. (A-Suffix)

Verwendung

use wingl::*
let window = WindowBuilder::new().with_title(c"Mein Titel")
	.with_size(Size::new(800, 600))
	.build().unwrap();

let mut window = window.make_current();
window.request_gl_version((3, 3));

gl::load_with(|ptr| window.gl_context().get_proc_address(ptr) as *const _);

...
while app_is_running
{
	window.poll();
	while let Some(ev) = window.next() {...}
	renderer.draw_next_frame();
	window.swap_buffers();
}
drop(window);

Custom Zeichenfunktion während des Event-Loops

Die Windows API verlässt den Eventloop nicht, wenn das Fenster mit der Maus verschoben oder skaliert wird. Dadurch kann der GL Kontext nicht mehr außerhalb des Eventloops neu gezeichnet werden, bzw. erst den der Benutzer die Maus wieder los lässt.

Für diesen Fall gibt es einen optionalen paint-Callback, der durch das WM_PAINT Event ausgelöst wird.

window.set_paint_callback(Box::new(move |ct: &Box<ContextTarget>|
{
	renderer.redraw_current_frame(ct.size());
}));