Step 2 - Open Window
The first step in building a graphical program is to open a window. We can then draw onto this. In order to see the picture, we need to also keep the window around for a few seconds before the program ends.
-
Add a call to open a window that we can draw onto.
In SplashKit you can open a window to draw onto. To open the window you call the
OpenWindow
method, and pass it the window’s title, its width and its height. -
If the program ends after the window is open, then it wont be around for long enough for the user to see. To fix this we can use the
Delay
method. You pass it an integer argument for the number of milliseconds to delay. Try delaying for 5000 milliseconds. -
-
Compile and run your program. You should see a window open. It should be rectangular, and have the title you set. After five seconds it should close.