CmdText
From MCS Wiki AVR
(Difference between revisions)
(Created page with "= <span class="f_Header">Action</span> = Draw Text. <span style="font-family: Arial;"> </span> <span style="font-family: Arial;"> </span> = <span class="f_Header...") |
|||
Line 68: | Line 68: | ||
= <span class="f_Header">Example</span> = | = <span class="f_Header">Example</span> = | ||
+ | |||
+ | <source lang="bascomavr"> | ||
+ | ClearScreen | ||
+ | ColorRGB &H80, &H80, &H00 | ||
+ | CmdText FT_DispWidth/2, FT_DispHeight/2, 31, OPT_CENTER, "Bascom is here" | ||
+ | |||
+ | UpdateScreen | ||
+ | |||
+ | |||
+ | |||
+ | ' Plain text at (0,0) in the largest font | ||
+ | CmdText 0, 0, 31, 0, "Text!" | ||
+ | </source>[[File:Clip0063.png|center|Clip0063.png]] | ||
+ | |||
+ | <source lang="bascomavr"> | ||
+ | ' Using a smaller font | ||
+ | CmdText 0, 0, 26, 0, "Text!" | ||
+ | </source>[[File:Clip0064.png|center|Clip0064.png]] | ||
+ | |||
+ | <source lang="bascomavr"> | ||
+ | ' Centered horizontally | ||
+ | CmdText 80, 60, 31, OPT_CENTERX, "Text!" | ||
+ | </source>[[File:Clip0065.png|center|Clip0065.png]] | ||
+ | |||
+ | <source lang="bascomavr"> | ||
+ | ' Right-justified | ||
+ | CmdText 80, 60, 31, OPT_RIGHTX, "Text!" | ||
+ | </source>[[File:Clip0066.png|center|Clip0066.png]] | ||
+ | |||
+ | <source lang="bascomavr"> | ||
+ | ' Centered vertically | ||
+ | CmdText 80, 60, 31, OPT_CENTERY, "Text!" | ||
+ | </source>[[File:Clip0067.png|center|Clip0067.png]] | ||
+ | |||
+ | <source lang="bascomavr"> | ||
+ | ' Centered both horizontally and vertically | ||
+ | CmdText 80, 60, 31, OPT_CENTER, "Text!" | ||
+ | </source>[[File:Clip0068.png|center|Clip0068.png]] | ||
+ | |||
+ | {{Languages}} | ||
+ | |||
+ | |||
+ | |||
+ | [[Category:FT800 Commands]] |
Latest revision as of 20:23, 12 December 2014
Contents |
Action
Draw Text.
Syntax
CmdText x, y, font, options, string
Remarks
x |
x-coordinate of text base, in pixels |
y |
y-coordinate of text base, in pixels |
font |
Internal Fonts 16-31, User Defined Fonts 0-14 |
options |
By default (x,y) is the top-left pixel of the text (options = 0). OPT_CENTERX centers the text horizontally OPT_CENTERY centers it vertically OPT_CENTER centers the text in both directions OPT_RIGHTX right-justifies the text, so that the x is the rightmost pixel. |
string |
text to display |
Example
ClearScreen ColorRGB &H80, &H80, &H00 CmdText FT_DispWidth/2, FT_DispHeight/2, 31, OPT_CENTER, "Bascom is here" UpdateScreen ' Plain text at (0,0) in the largest font CmdText 0, 0, 31, 0, "Text!"
' Using a smaller font CmdText 0, 0, 26, 0, "Text!"
' Centered horizontally CmdText 80, 60, 31, OPT_CENTERX, "Text!"
' Right-justified CmdText 80, 60, 31, OPT_RIGHTX, "Text!"
' Centered vertically CmdText 80, 60, 31, OPT_CENTERY, "Text!"
' Centered both horizontally and vertically CmdText 80, 60, 31, OPT_CENTER, "Text!"
Languages | English |
---|