1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-17 14:34:25 +03:00
inform7/resources/Documentation/Examples/CornerOfNoAndWhere.txt

46 lines
1.4 KiB
Plaintext
Raw Normal View History

Example: * Corner of No and Where
Location: Longer extracts of Inform 6 code
RecipeLocation: The Status Line
Index: Status line with centered text, the hard way
Description: A status line which has only the name of the location, centered.
For: Z-Machine
2019-02-05 02:44:07 +02:00
Making major changes to display features, such as the construction of the status line, sometimes requires that we rely on Inform 6 in bulk; here is how we might produce the Trinity-style status line, with the location centered at the top center of the screen.
Note that this example _only_ works if the Settings for it are set to the Z-machine story file format: it does not work on the default Glulx setting, which has a different screen arrangement.
2019-02-05 02:44:07 +02:00
{*}"Corner of No and Where"
2024-03-19 23:14:26 +02:00
2019-02-05 02:44:07 +02:00
No is a room. Where is west of No.
2024-03-19 23:14:26 +02:00
2019-02-05 02:44:07 +02:00
Rule for constructing the status line:
print the location in the center of the status line;
rule succeeds.
2024-03-19 23:14:26 +02:00
2019-02-05 02:44:07 +02:00
To print the location in the center of the status line:
(- PrintCenteredStatus(); -).
2024-03-19 23:14:26 +02:00
2019-02-05 02:44:07 +02:00
Include (-
2024-03-19 23:14:26 +02:00
2019-02-05 02:44:07 +02:00
Array printed_text --> 64;
2024-03-19 23:14:26 +02:00
2019-02-05 02:44:07 +02:00
[ PrintCenteredStatus i j;
@set_cursor 1 0;
i = 0->33;
spaces(i);
@output_stream 3 printed_text;
print (name) location;
@output_stream -3;
j = (i - (printed_text-->0))/2;
@set_cursor 1 j;
print (name) location;
spaces j-1;
2019-02-05 02:44:07 +02:00
];
2024-03-19 23:14:26 +02:00
2019-02-05 02:44:07 +02:00
-)
2024-03-19 23:14:26 +02:00
2019-02-05 02:44:07 +02:00
Test me with "w / e".
2024-03-19 23:14:26 +02:00
In fact, as we've already seen, many extra modifications to the display behaviour are possible using Basic Screen Effects.