Lesson 2: Where we learn about changing a windows attributes


Okay, so we've got a window under our belts--let's mess with it.

But first off, let's just mention the obvious--to put comments in a file, you can just put two foreslashes // and the rest of the text on that line is ignored. (Programmers, you can also comment off sections of code by putting /* */ around them.)

Okay, that said, we'll move on.

Let's look at all the commands you can use to change the way a window looks, and then how we can get fancier with the text in a window.

Here's our window:

#window 2:1 using the "trash" bank number of 2

These commands can appear in any order in a window.

STYLE
This is the name of the window border/graphic composite to use for this window You can find styles in the \anoxdata\graphics\interface\windows\ directory. The most commonly used style in Anachronox is "style_embrace"

style "style_embrace"


If you don't want _any_ border, you must go:

style "NULL"

So the program will know there is no border.

FONT
This command specifies the font to use. If you do not specify one, it will default to the standard old Anox font. This is super useful for dialogues, and less useful for GameFlow games, at least until you are able to place text strings at a specific location in the window. Then you could use it to print the score or messages. As it is now, it basically starts in the upper left corner of the window and word wraps to the size of the window, inside the border, like you'd think. Anyway, some fonts are "_anox10", "_anox6", "_Prochalo", and "arcfix". The last is a copy of the classic arcade machine font, which is fun to use for games. Use "font" like this:

font "_anox10"

You can find fonts in the \anoxdata\graphics\fonts directory.


BACKGROUND
This specifies what background graphic to use. It can be a BMP, PCX, PNG or TGA.
Additionally you can use the color command to display different colors / alpha as the background. Using the default color command gives you the blue background used in most of Anachronox.

background color

Okay, that covers the way a window looks, let's look at a command to title your window:

TITLE
This takes the text after it and makes it bold, and prints it before the "body". Even if you put TITLE last, it will be at the top of the window. It's often used for a character's name in Anachronox. Use it like this:

title "Character Name"


There are lots of other commands that can affect the window's size and position on the screen. Anachronox will automatically size the window to your text, and center it. If you prefer to control where it is placed or how big it is, use these commands.

POS
This allows you to specify at what X and Y coordinate on the screen to place the window. This coordinate, of course, is the upper left corner. By the way, the Anachronox screen is 640 x 480 pixels big
You would use them like this:

pos 30,30


There are similar separate commands for the size of the window.

WIDTH
This specifies a window's width. Use like this:

width 320

HEIGHT
The window's height is specified, like so:

height 200

SIZE
This specifies both width and height:

size 320,200

If no height is given, Anachronox will automatically scale the height to fit the text in it. Note: Setting a height on dialog windows can cause your text to clip.

The counter to this feature would be:

MAXHEIGHT
Specify a height beyond which the window can't extend. This is useful if you don't want the window to extend past a certain place on the screen, but you don't want to have to specify the height, or you want it to automatically size to fit the text nicely. One example is you want the window to size nicely, but not ever extend to cover the character's faces, which may be halfway down the screen.
It goes like this:

maxheight 300




Okay, that's it for this lesson. Here is an example code for you to use. Try changing, or adding different things you have learned in this lesson and see what the results are.

// This is a commented out line
#window 2:1
style "style_embrace"
font "_anox10"
title "Window Testing"
pos 30,30

body "Here's a whole bunch of character text which if you want to you can go to the next
line to type because it is looking for a quotation mark to end the string. "

body "This line will be tacked on to the end of the previous one. To generate a "
body "carriage return between lines you can use backslash n, like this. \n"
body "Now we are on a new line."


Compile Lesson2 just like you did LESSON1, and see what it does in Anox! In case you haven't figured it out, this time you need to "invoke 2:1"

Okay, that's it for this lesson. In Lesson 3, we'll learn about choices, and how to put graphics in the windows!