146 lines
6.5 KiB
HTML
146 lines
6.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Pop-up messages and questions</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body background="images/back.gif">
|
|
<!--START-->
|
|
|
|
<h3>Pop-up messages and questions</h3>
|
|
|
|
A number of other functions exist to pop up messages, questions, a menu with choices,
|
|
or a dialog in which the player can enter a number, a string, or indicate a color
|
|
or file name:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>show_message(str)</b></tt>
|
|
Displays a dialog box with the string as a message.<br>
|
|
<tt><b>show_message_ext(str,but1,but2,but3)</b></tt>
|
|
Displays a dialog box with the string as a message and up to three buttons.
|
|
But1, but2 and but3 contain the button text. An empty string means that the
|
|
button is not shown. In the texts you can use the & symbol to indicate
|
|
that the next character should be used as the keyboard shortcut for this
|
|
button. The function returns the number of the button pressed (0 if the
|
|
user presses the Esc key).<br>
|
|
<tt><b>show_question(str)</b></tt>
|
|
Displays a question; returns true when the user selects yes and false otherwise.<br>
|
|
<tt><b>get_integer(str,def)</b></tt>
|
|
Asks the player in a dialog box for a number. str is the message.
|
|
def is the default number shown.<br>
|
|
<tt><b>get_string(str,def)</b></tt>
|
|
Asks the player in a dialog box for a string. str is the message.
|
|
def is the default value shown.<br>
|
|
<tt><b>message_background(back)</b></tt>
|
|
Sets the background image for the pop-up box for any of the functions above.
|
|
back must be one of the backgrounds defined in the game. Unfortunately,
|
|
alpha values are not taken into account. However, if the left-bottom pixel
|
|
has an alpha value of 0, all pixels with that color will be considered transparent.<br>
|
|
<tt><b>message_alpha(alpha)</b></tt>
|
|
Sets the alpha translucence for the pop-up box for any of the functions
|
|
above. alpha must lie between 0 (completely translucent) and 1 (not translucent)
|
|
(only for Windows 2000 or later).<br>
|
|
<tt><b>message_button(spr)</b></tt>
|
|
Sets the sprite used for the buttons in the pop-up box. spr must be a
|
|
sprite consisting of three images, the first indicates the button when
|
|
it is not pressed and the mouse is far away, the second indicates the
|
|
button when the mouse is above it but not pressed and the third is the
|
|
button when it is pressed. Unfortunately,
|
|
alpha values are not taken into account. However, if the left-bottom pixel
|
|
has an alpha value of 0, all pixels with that color will be considered transparent.<br>
|
|
<tt><b>message_text_font(name,size,color,style)</b></tt>
|
|
Sets the font for the text in the pop-up box. (This is a normal Windows font,
|
|
not one of the font resources you can out in your game!) style indicates
|
|
the font style (0=normal, 1=bold, 2=italic, and 3=bold-italic).<br>
|
|
<tt><b>message_button_font(name,size,color,style)</b></tt>
|
|
Sets the font for the buttons in the pop-up box. style indicates
|
|
the font style (0=normal, 1=bold, 2=italic, and 3=bold-italic).<br>
|
|
<tt><b>message_input_font(name,size,color,style)</b></tt>
|
|
Sets the font for the input field in the pop-up box. style indicates
|
|
the font style (0=normal, 1=bold, 2=italic, and 3=bold-italic).<br>
|
|
<tt><b>message_mouse_color(col)</b></tt>
|
|
Sets the color of the font for the buttons in the pop-up box when the mouse is above it.<br>
|
|
<tt><b>message_input_color(col)</b></tt>
|
|
Sets the color for the background of the input filed in the pop-up box.<br>
|
|
<tt><b>message_caption(show,str)</b></tt>
|
|
Sets the caption for the pop-up box. show indicates whether a border must b
|
|
e shown (1) or not (0) and str indicates the caption when the border is shown.<br>
|
|
<tt><b>message_position(x,y)</b></tt>
|
|
Sets the position of the pop-up box on the screen. Use -1, -1 to center the box.<br>
|
|
<tt><b>message_size(w,h)</b></tt>
|
|
Fixes the size of the pop-up box on the screen. If you choose -1 for the
|
|
width the width of the image is used. If you choose -1 for the height the
|
|
height is calculated based on the number of lines in the message.<br>
|
|
<tt><b>show_menu(str,def)</b></tt>
|
|
Shows a popup menu. str indicates the menu text. This consists of the
|
|
different menu items with a vertical bar between them. For example,
|
|
str = 'menu0|menu1|menu2'. When the first item is selected a 0 is returned, etc.
|
|
When the player selects no item, the default value def is returned.<br>
|
|
<tt><b>show_menu_pos(x,y,str,def)</b></tt>
|
|
Shows a popup menu as in the previous function but at position x,y on the screen.<br>
|
|
<tt><b>get_color(defcol)</b></tt>
|
|
Asks the player for a color. defcol is the default color. If the user presses
|
|
Cancel the value -1 is returned.<br>
|
|
<tt><b>get_open_filename(filter,fname)</b></tt>
|
|
Asks the player for a filename to open with the given filter. The filter has
|
|
the form 'name1|mask1|name2|mask2|...'. A mask contains the different options
|
|
with a semicolon between them. * means any string. For example: 'bitmaps|*.bmp;*.wmf'.
|
|
If the user presses Cancel an empy string is returned.<br>
|
|
<tt><b>get_save_filename(filter,fname)</b></tt>
|
|
Asks for a filename to save with the given filter. If the user presses
|
|
Cancel an empy string is returned.<br>
|
|
<tt><b>get_directory(dname)</b></tt>
|
|
Asks for a directory. dname is the default name. If the user presses
|
|
Cancel an empy string is returned.<br>
|
|
<tt><b>get_directory_alt(capt,root)</b></tt>
|
|
An alternative way to ask for a directory. capt is the caption to be show. root is
|
|
the root of the directory tree to be shown. Use the empty string to show the whole
|
|
tree. If the user presses Cancel an empy string is returned.<br>
|
|
<tt><b>show_error(str,abort)</b></tt>
|
|
Displays a standard error message (and/or writes it to the log file).
|
|
abort indicates whether the game should abort.<br>
|
|
</blockquote>
|
|
|
|
<!--END-->
|
|
</body>
|
|
</html>
|
|
|
|
<!-- KEYWORDS
|
|
messages
|
|
message buttons
|
|
showing menus
|
|
menus
|
|
file selector
|
|
directory selector
|
|
folder selector
|
|
color selector
|
|
dialogs
|
|
|
|
show_message()
|
|
show_message_ext()
|
|
show_question()
|
|
get_integer()
|
|
get_string()
|
|
message_background()
|
|
message_button()
|
|
message_alpha()
|
|
message_text_font()
|
|
message_button_font()
|
|
message_input_font()
|
|
message_mouse_color()
|
|
message_input_color()
|
|
message_position()
|
|
message_size()
|
|
message_caption()
|
|
show_menu()
|
|
show_menu_pos()
|
|
get_color()
|
|
get_open_filename()
|
|
get_save_filename()
|
|
get_directory()
|
|
get_directory_alt()
|
|
show_error()
|
|
|
|
--> |