Difference between revisions of "PrintXY"

From WikiPrizm
Jump to navigationJump to search
(Edited the category and the display mode after testing.)
Line 2: Line 2:
 
'''Syscall:''' PrintXY(int x, int y, char* string, int display_mode, int text_color)
 
'''Syscall:''' PrintXY(int x, int y, char* string, int display_mode, int text_color)
  
Displays a line of homescreen-style text on the screen.
+
<del>Displays a line of homescreen-style text on the screen.</del>
 +
Draws a line of homescrene-style text in VRAM.
  
 
=== Inputs ===
 
=== Inputs ===

Revision as of 01:31, 26 November 2012

Synopsis

Syscall: PrintXY(int x, int y, char* string, int display_mode, int text_color)

Displays a line of homescreen-style text on the screen. Draws a line of homescrene-style text in VRAM.

Inputs

  • int x - The "homescreen" column of the first character of the string, 1 to 20
  • int y - The "homescreen" row, 0 to 7
  • char* string - The string to display (see note 1 below)
  • int display_mode - Bitmask (note 2 below)
  • int text_color - The color of the characters (see note 3 below)

Outputs

Text displayed to the screen

Comments

Note 1: The string must start with two junk letters such as XX that will not be displayed. For example, "XXHello, World" would display 'Hello, World', but the string "Hello, World" would only display 'llo, World'.

Note 2: Display mode 0 is normal, overwrite mode. The rectangle containing each character is cleared. Setting bit 5 (0x20) makes the background not be erased. Setting bit 0 (0x01) makes the text be written in inverse mode. If you want both, bitwise OR the modes together.

You may also use the following, defined in color.h:

  • TEXT_MODE_NORMAL (0)
  • TEXT_MODE_INVERT (1)

When using 0x21 (0x20 | 0x01), the effect isn't the expected where the inverted text is drawn on top of the screen. Instead, it acts like an AND operation where the printed text is used to mask what is currently on the screen (color doesn't matter), printing white elsewhere.

Note 3: Valid colors are defined in color.h and are listed below:

  • TEXT_COLOR_BLACK (0) - Black
  • TEXT_COLOR_BLUE (1) - Blue
  • TEXT_COLOR_GREEN (2) - Green
  • TEXT_COLOR_CYAN (3) - Cyan
  • TEXT_COLOR_RED (4) - Red
  • TEXT_COLOR_PURPLE (5) - Purple
  • TEXT_COLOR_YELLOW (6) - Yellow
  • TEXT_COLOR_WHITE (7) - White

Note 4: Row 0:

A valid input to PrintXY's y parameter is 0, but this is usually not rendered because row 0 is located under the status bar the top of the screen.