Note: Dev Logs #1 through #6 covered early-stage trial and error and are available in Korean only. Starting with this post, I’ll be writing in English to reach a broader audience.
Hi, I'm Eren. I'm currently building a custom game engine from scratch, and in this post, I’d like to share how I implemented the window system.
This is a crucial step before diving into rendering—having a stable window lifecycle and event loop is essential for properly initializing GPU resources and hooking them up to the renderer.
Window Management in Rust – Using winit
In the Rust ecosystem, the go-to library for window creation and event handling is winit
. It's widely adopted and has become the de facto standard for GUI and game development in Rust. For instance, Bevy—a popular Rust game engine—also uses winit
under the hood.
My window lifecycle implementation is built on top of winit
, and the source code is available here:
Source:
github.com/erenengine/eren/blob/main/eren_window/src/window.rs
Key Features
Here’s what the current window system supports:
✔️ Asynchronous GPU Initialization
The system supports asynchronous GPU setup, making it easier to integrate with future rendering modules without blocking the main thread.
✔️ Full WebAssembly (WASM) Support
The window system works seamlessly in web environments. It automatically creates a <canvas>
element and manages the event loop properly—even inside the browser.
✔️ Cross-Platform Compatibility
It runs smoothly on Windows, macOS, and Linux, as well as in browsers via WASM.
You can try out a basic WASM test here:
Test URL: erenengine.github.io/eren/eren_window/examples/test_window.html
(Note: The page may appear blank, but a canvas and an event loop are running behind the scenes.)
What’s Next?
The next step is adding full user input support:
-
Keyboard input
-
Mouse input (click, movement, scroll)
-
Touch and multi-touch gestures
-
Gamepad input (via an external library)
For gamepad support, I plan to use gilrs
, which is a reliable cross-platform input library for handling controllers in Rust projects.
Final Thoughts
Now that the window system is in place, the next major milestone will be initializing GPU resources and integrating them with the renderer—this is where actual rendering can finally begin.
Building everything from the ground up has been both challenging and incredibly rewarding. I’ll continue documenting the journey through these dev logs.
Thanks for reading! Stay tuned for more updates—and happy coding!
– Eren