Difference between revisions of "DisplayMBString2"

From WikiPrizm
Jump to navigationJump to search
(Created page with "{{syscall | name = DisplayMBString2 | signature = <code>''void'' '''DisplayMBString2'''(''int'' '''select''', ''unsigned char*'' '''str''', ''int'' '''start''', ''int'' '''xpo...")
 
Line 1: Line 1:
 
{{syscall
 
{{syscall
 
| name = DisplayMBString2
 
| name = DisplayMBString2
| signature = <code>''void'' '''DisplayMBString2'''(''int'' '''select''', ''unsigned char*'' '''str''', ''int'' '''start''', ''int'' '''xpos''', ''int'' '''sel_start''', ''int'' '''x''', ''int'' '''y''', ''int'' '''pos_to_clear''', ''int'' '''right_margin''', ''int'' '''key''')</code>
+
| signature = ''void'' '''DisplayMBString2'''(''int'' '''select''', ''unsigned char*'' '''str''', ''int'' '''start''', ''int'' '''xpos''', ''int'' '''sel_start''', ''int'' '''x''', ''int'' '''y''', ''int'' '''pos_to_clear''', ''int'' '''right_margin''', ''int'' '''key''')
| synopsis = Displays a line of text containing multi-byte characters.
+
| synopsis = Displays a string, possibly containing multi-byte characters, for manual single-line text editing. This is a overloaded variant of [[DisplayMBString]].
| header = display_syscalls.h
+
| header = fxcg/keyboard.h
 
| index = 0x1218
 
| index = 0x1218
 
| parameters =  
 
| parameters =  
*''int'' '''select''' - 1 if a part of the string is selected, 0 if not
+
*''int'' '''select''' - 1 if a part of the string is selected, 0 if not.
*''unsigned char*'' '''str''' - Multi-byte string to display
+
*''unsigned char*'' '''str''' - Multi-byte string to display.
*''int'' '''start''' - The position in <u>bytes</u> of the first character to display in '''str'''
+
*''int'' '''start''' - The position in <u>bytes</u> of the first character to display in '''str'''.
 
*''int'' '''xpos''' - The absolute position of the cursor in <u>bytes</u>. If '''select'''==1  it also means one of the ends of the selection.
 
*''int'' '''xpos''' - The absolute position of the cursor in <u>bytes</u>. If '''select'''==1  it also means one of the ends of the selection.
*''int'' '''sel_start''' - The other start/end of the selection. Absolute position in <u>bytes</u>
+
*''int'' '''sel_start''' - The other start/end of the selection. Absolute position in <u>bytes</u>.
*''int'' '''x''' - The horizontal position of the first displayed character. It's like in [[PrintXY]]
+
*''int'' '''x''' - The horizontal "homescreen" coordinate of first displayed character, like in [[PrintXY]].
*''int'' '''y''' - The vertical position of the top of the displayed text in <u>pixels</u>. 0px is under the header line.
+
*''int'' '''y''' - The vertical coordinate of the top of the displayed text in <u>pixels</u>. 0px is under the header line.
*''int'' '''pos_to_clear''' - Printing blocks at this position if the screen. For example if <code>'''pos_to_clear'''==5</code>, characters won't be displayed after the fifth column.
+
*''int'' '''pos_to_clear''' - Printing stops at this position, effectively reducing the width of the text area. For example, if <code>'''pos_to_clear'''==5</code>, characters won't be displayed after the fifth column.
*''int'' '''right_margin''' <u>characters</u> (not bytes!) will be cut from the right of the string, fewer characters will be displayed. It has the same effect as you decreased '''pos_to_clear''' by this number. Actually this parameter is not usable to anything.
+
*''int'' '''right_margin''' <u>characters</u> (not bytes!) will be cut from the right of the string, fewer characters will be displayed. It has a similar effect as decreasing '''pos_to_clear''' by this number.
*''int'' '''key''' - The exact function of this parameter is unknown. It must be a keycode, the syscall has different behaviour in the case <code>'''key'''<30000</code> than <code>30000<='''key'''</code> (In the first case the blinking cursor stays at its position, but in the second case, it disappears after a keypress)
+
*''int'' '''key''' - The exact function of this parameter is unknown. It must be a keycode, the syscall has different behavior in the case <code>'''key'''<30000</code> than <code>30000<='''key'''</code> (In the first case the blinking cursor stays at its position, but in the second case, it disappears after a key press).
 
| example =
 
| example =
 
<pre>DisplayMBString2(1, "(this text is not important)Hello World!-\xE5\x58(not important)", 28, 34, 40, 5, 50, 18, 2, 30000-1);</pre>
 
<pre>DisplayMBString2(1, "(this text is not important)Hello World!-\xE5\x58(not important)", 28, 34, 40, 5, 50, 18, 2, 30000-1);</pre>
This code displays <span style="font-size: 120%; border-style:solid; border-width:1px;"><code>Hello <span style="background-color:black; color:white;">World!</span></code></span> in the centre of the screen.
+
This code displays <span style="font-size: 120%; border-style:solid; border-width:1px;"><code>Hello <span style="background-color:black; color:white;">World!</span></code></span> in the center of the screen.
 +
 
 +
Of course, this is an example that abuses the intended use of the parameters of the syscall; some of the parameters are meant to be set to the values returned when this syscall is used in conjunction with others that actually do the text editing logic, such as [[EditMBStringCtrl2]].
  
 
}}
 
}}

Revision as of 09:19, 31 July 2014


Synopsis

Header: fxcg/keyboard.h
Syscall index: 0x1218
Function signature: void DisplayMBString2(int select, unsigned char* str, int start, int xpos, int sel_start, int x, int y, int pos_to_clear, int right_margin, int key)

Displays a string, possibly containing multi-byte characters, for manual single-line text editing. This is a overloaded variant of DisplayMBString.

Parameters

  • int select - 1 if a part of the string is selected, 0 if not.
  • unsigned char* str - Multi-byte string to display.
  • int start - The position in bytes of the first character to display in str.
  • int xpos - The absolute position of the cursor in bytes. If select==1 it also means one of the ends of the selection.
  • int sel_start - The other start/end of the selection. Absolute position in bytes.
  • int x - The horizontal "homescreen" coordinate of first displayed character, like in PrintXY.
  • int y - The vertical coordinate of the top of the displayed text in pixels. 0px is under the header line.
  • int pos_to_clear - Printing stops at this position, effectively reducing the width of the text area. For example, if pos_to_clear==5, characters won't be displayed after the fifth column.
  • int right_margin characters (not bytes!) will be cut from the right of the string, fewer characters will be displayed. It has a similar effect as decreasing pos_to_clear by this number.
  • int key - The exact function of this parameter is unknown. It must be a keycode, the syscall has different behavior in the case key<30000 than 30000<=key (In the first case the blinking cursor stays at its position, but in the second case, it disappears after a key press).

Example

DisplayMBString2(1, "(this text is not important)Hello World!-\xE5\x58(not important)", 28, 34, 40, 5, 50, 18, 2, 30000-1);

This code displays Hello World! in the center of the screen.

Of course, this is an example that abuses the intended use of the parameters of the syscall; some of the parameters are meant to be set to the values returned when this syscall is used in conjunction with others that actually do the text editing logic, such as EditMBStringCtrl2.