Link Search Menu Expand Document

Drawing

Функции


draw_image

funcX

void draw_image(string/int artFile/artId, int frame, int x, int y, bool noTransparent)
  • displays the specified PCX or FRM image in the active window created by vanilla CreateWin or sfall’s create_win script function
  • artFile/artId: path to the PCX/FRM file (e.g. art\\inven\\5mmap.frm), or its FRM ID number (e.g. 0x7000026, see specification of the FID format) optional arguments:
  • frame: frame number, the first frame starts from zero
  • x/y: offset relative to the top-left corner of the window
  • noTransparent: pass True to display an image without transparent background
  • NOTE: to omit optional arguments starting from the right, call the functions with different sfall_funcX (e.g. sfall_func4("draw_image", pathFile, frame, x, y))

draw_image_scaled

funcX

void draw_image_scaled(string/int artFile/artId, int frame, int x, int y, int width, int height)
  • displays the specified PCX or FRM image in the active window created by vanilla CreateWin or sfall’s create_win script function
  • artFile/artId: path to the PCX/FRM file (e.g. art\\inven\\5mmap.frm), or its FRM ID number (e.g. 0x7000026, see specification of the FID format) optional arguments:
  • frame: frame number, the first frame starts from zero
  • x/y: offset relative to the top-left corner of the window
  • width/height: the new width/height to scale the image to. Pass -1 to either width or height to keep the aspect ratio when scaling
  • NOTE: to omit optional arguments starting from the right, call the functions with different sfall_funcX (e.g. sfall_func4("draw_image", pathFile, frame, x, y))
  • if called without x/y/width/height arguments, the image will be scaled to fit the window without transparent background

interface_art_draw

int sfall_func4("interface_art_draw", int winType, string artFile/int artID, int x, int y)
int sfall_func4("interface_art_draw", int winType, string artFile/int artID, int x, int y)
int sfall_func5("interface_art_draw", int winType, string artFile/int artID, int x, int y, int frame)
int sfall_func6("interface_art_draw", int winType, string artFile/int artID, int x, int y, int frame, array param)
  • draws the specified PCX or FRM image in the game interface window, returns -1 on any error
  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h) this also takes the value of the flag (0x1000000) to prevent immediate redrawing of the interface window
  • artFile/artId: path to the PCX/FRM file (e.g. art\\inven\\5mmap.frm), or its FRM ID number (e.g. 0x7000026, see specification of the FID format)
  • x/y: offset relative to the top-left corner of the window

optional arguments:

  • frame: frame number, the first frame starts from zero
  • param: an array which specifies additional parameters, where: index 0 - sprite direction for multi-directional FRM index 1/index 2 - the new width/height to scale the image to. Pass -1 to use the original width/height

interface_print

int sfall_func5("interface_print", string text, int winType, int x, int y, int color)
int sfall_func5("interface_print", string text, int winType, int x, int y, int color)
int sfall_func6("interface_print", string text, int winType, int x, int y, int color, int width)
  • displays the text in the specified interface window with the current font. Use vanilla SetFont function to set the font
  • returns the count of lines printed, or -1 on any error
  • text: the text to be printed. Use the \n control character to move text to a new line (example: “Hello\nWorld!”)
  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
  • x/y: offset relative to the top-left corner of the window
  • color: the color index in the game palette. Pass 0 if the text color was previously set by vanilla SetTextColor function It can also take additional flags (via bwor) for displaying text:
    • 0x0010000 - adds a shadow to the text, the ‘textshadow’ compiler constant
    • 0x1000000 - prevents immediate redrawing of the interface window, the textdirect compiler constant (works the other way around)
    • 0x2000000 - fills the background of the text with black color, the textnofill compiler constant (works the other way around)
  • width (optional): the maximum width of the text. The text will be wrapped to fit within the specified width

iterface_overlay

sfall_func2("interface_overlay", int winType, int mode)

Alternative form: int sfall_func6("interface_overlay", int winType, 2, int x, int y, int width, int height).

Creates an additional drawing surface above the graphic layer of the specified interface window. All subsequent calls of interface_art_draw and interface_print functions will draw on it.

  • winType: the type number of the interface window (see WINTYPE_* constants in sfall.h)
  • mode: 1 - creates a new overlay surface 2 - clears the overlay area or the specified rectangle defined by the x, y, width, height arguments 0 - destroys the created overlay surface (frees up the memory allocated to the surface)

win_fill_color

int win_fill_color(int x, int y, int width, int height, int color)

Fills the rectangle area of the currently selected script window with the specified color, or clears the window with transparent (index 0) color (call the function without arguments).

  • color: the color index in the game palette (from 0 to 255)