EGE
is an easy-to-use C++ graphics library for the Windows platform, built upon Windows' GDI/GDI+ interfaces. It provides features like graphics rendering and keyboard/mouse event handling. Known for its user-friendly API, it is widely favored by beginners. xege-ffi
offers Rust FFI bindings for EGE
, enabling the usage of EGE
in Rust. xege
is a Rust-style safe wrapper around xege-ffi
, allowing Rust developers to utilize EGE
more conveniently.
EGE
employs a state machine mechanism in its implementation. Consequently, most graphics context types are neither Send
nor Sync
, meaning they cannot be used across threads.
EGE
offers powerful drawing capabilities, enabling you to create a wide variety of graphical applications, whether GUI programs or game engines.
use xege::*;
fn main() {
let mut xege = initgraph(1000, 800, Init::NoSysDPI).unwrap();
xege.setbkcolor(color::DARKGRAY);
xege.setcolor(color::BLACK);
xege.setfillcolor(color::CYAN);
xege.clear();
xege.enable_aa(true);
const TEXTS: [&str; 10] = [
"Hello, World!",
"你好,世界!",
"こんにちは世界",
"안녕하세요 세계!",
"Привет мир!",
"مرحبا بالعالم!",
"Γεια σου κόσμε!",
"नमस्ते दुनिया!",
"∑(π²) ≠ ∞",
"←↑→↓ ↖↗↘↙",
];
let mut path = Path::new();
for (i, &s) in TEXTS.iter().enumerate() {
path.addtext(
30f32,
10f32 + i as f32 * 40f32,
s,
"黑体",
30f32,
FontStyle::Black,
);
}
path.outline(Option::<Mat3<f32>>::None, 0.0);
xege.drawpath_at(&path, 16.0, 16.0);
xege.fillpath_at(&path, 15.0, 15.0);
loop {}
}
xege
is licensed under the MIT License.