I spent a few hours trying to figure out how to create and draw into graphical windows in Inform 7 for my next project.
I thought I’d post my example here in case anyone else wants to do something similar.
The example below requires the following extensions to be installed (1 requires 2; 2 requires 3-5):
- Simple Graphical Windows by Emily Short version 15/160929
- Flexible Windows by Jon Ingold version 15/170131
- Alternative Startup Rules by Dannii Willis version 1/140516
- Glulx Text Effects by Emily Short version 5/140516
- Glulx Entry Points by Emily Short version 10/160919
Here is the code (I used Inform v1.68.1).
The story title is "Graphical Windows".
The story author is "Bill Maya".
The story headline is "A Non-Interactive Experiment".
Include Simple Graphical Window by Emily Short.
Figure of Antarctic is the file "Stielers-Handatlas-1891-Antarctic.jpg".
Figure of Miskatonic-1907 is the file "Miskatonic-Tunguska-Expedition-1907.jpg".
Figure of MIskatonic-1926 is the file "Miskatonic-Outer-Tibet-Expedition-1926.jpg".
Figure of Miskatonic-1930 is the file "Miskatonic-Antarctic-Expedition-1930.jpg".
Figure of HP-Lovecraft is the file "HP-Lovecraft-1934.jpg".
Figure of Clemente-Onelli is the file "Clemente-Onelli.png".
Figure of Alice-Wilson is the file "Alice-Wilson.png".
Figure of Cystoidea is the file "Hunstformen-der-Natur-Cystoidea.jpg"
Map Room is a room.
The map window is a graphics g-window spawned by the main window.
The position of the map window is g-placeabove.
The scale method of the map window is g-proportional.
The measurement of the map window is 75.
The 1907-expedition window is a graphics g-window spawned by the map [graphics] window.
The position of the 1907-expedition window is g-placeright.
The scale method of the 1907-expedition window is g-proportional.
The measurement of the 1907-expedition window is 25.
The 1926-expedition window is a graphics g-window spawned by the 1907-expedition window.
The position of the 1926-expedition window is g-placebelow.
The scale method of the 1926-expedition window is g-proportional.
The measurement of the 1926-expedition window is 65.
The 1930-expedition window is a graphics g-window spawned by the 1926-expedition window.
The position of the 1930-expedition window is g-placebelow.
The scale method of the 1930-expedition window is g-proportional.
The measurement of the 1930-expedition window is 50.
When play begins:
close the graphics window; [Since we're not using this window]
open the map window;
open the 1907-expedition window;
open the 1926-expedition window;
open the 1930-expedition window;
draw Figure of Antarctic in map window;
draw Figure of Miskatonic-1907 in 1907-expedition window;
draw Figure of Miskatonic-1926 in 1926-expedition window;
draw Figure of Miskatonic-1930 in 1930-expedition window;
draw Figure of HP-Lovecraft in the map window at x 50 and y 135 scaled to width 140 and height 170;
draw Figure of Clemente-Onelli in the map window at x 50 and y 315 scaled to width 120 and height 190;
draw Figure of Alice-Wilson in the map window at x 50 and y 500;
draw Figure of Cystoidea in the map window at x 630 and y 30 scaled to width 275 and height 400;
focus main window.
Here is the result.
Not bad for a few hours work. I particularly wanted to see if I could overlay images over one another (the image on the left is made up of five separate images positioned and scaled individually).
Here is a link to download the Inform 7 project for anyone who is interested - inform7-graphical-windows.zip