-
Notifications
You must be signed in to change notification settings - Fork 1
Your First Window
Our first example using dgt is very simple:
import dgt;
void main()
{
WindowConfig config;
Window window = Window("Your First Window", 800, 600, config);
}
Paste that into your app.d file and run it. A window should pop up but almost immediately close.
Programmers experienced in D or a similar language may find the above snippet intuitive, but others may find the code less obvious.
import dgt; tells D to take all of the structures and functions from the D Game Toolkit and allow you to use them.
void main() is where the program starts executing.
WindowConfig config; creates a default window configuration. Later if we want to create a resizable, borderless, or fullscreen window we can come back here.
Window window = Window("Your First Window", 800, 600, config); is the meat of this small program. "Your First Window" is the window title. 800 is the window width in pixels and 600 is the window height. Lastly, config tells your window the configuration which informs things like the initial state of the window.