This wiki is out of date, use the continuation of this wiki instead

Set text color

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 10:11, 22 April 2007 (edit)
Woody (Talk | contribs)
(Example)
← Previous diff
Current revision (00:25, 24 March 2008) (edit) (undo)
86.72.151.138 (Talk)
(Notes)
 
(6 intermediate revisions not shown.)
Line 1: Line 1:
[[Category:functions]] [[Category:functions]]
 +[[Category:texts]]
==Definition== ==Definition==
 +'''INT''' set_text_color ( <'''WORD''' color> )
-'''INT''' set_text_color ( <'''INT''' color> )+Sets the current text color (the color where texts will be written in). This only affects 1 bit (2 color) fonts, which can be loaded with [[load_font]]() or [[load_bdf]](). 8 bit and 16 bit fonts already contain color information themselves and thus aren't affected.
- +
-Sets the color of the default font and possibly TTF fonts as well.+
== Parameters == == Parameters ==
- 
{| {|
-| '''INT''' color || - The color to use for text.+| '''WORD''' color || - The [[color]] to use for text.
|} |}
- 
== Returns == == Returns ==
 +'''INT''' : [[true]] if successful and [[false]] if failed. (''Needs confirmation.'')
-'''INT''' : Returns [[true|1]] if successful and [[false|0]] if failed.+== Notes ==
 +Be warned that values returned by the [[Rgb]]() function differ with the video card. So, directly filling out color numbers as color parameter in 16 bit color mode without using [[Rgb]]() is a bad idea, as RGB returns the correct color code for every video card
 +== Errors ==
 +''<If someone knows, please edit!> ''
== Example == == Example ==
- 
<pre> <pre>
Program awesome; Program awesome;
Global Global
- red=0;+ byte red=0;
- green=255;+ byte green=255;
- blue=0;+ byte blue=0;
Begin Begin
set_text_color(rgb(red,green,blue)); set_text_color(rgb(red,green,blue));
 + write(0,1,1,0,"Mijn potlood is bruin"); //this text will be green as an Irishman's ejecta
- write(0,1,1,0,"Mijn potlood is bruin"); //this text will be green as an Irishman's ejecta+ set_text_color(rgb(255,0,0));
 + write(0,1,11,0,"Je moeder"); //this text will be red
Loop Loop
Line 40: Line 43:
End End
End End
- 
</pre> </pre>
 +Used in example: [[write]](), [[rgb]]()
 +
 +This results in something like this: <br/>
 +[[Image:set_text_color.png]]

Current revision


Contents

[edit] Definition

INT set_text_color ( <WORD color> )

Sets the current text color (the color where texts will be written in). This only affects 1 bit (2 color) fonts, which can be loaded with load_font() or load_bdf(). 8 bit and 16 bit fonts already contain color information themselves and thus aren't affected.


[edit] Parameters

WORD color - The color to use for text.

[edit] Returns

INT : true if successful and false if failed. (Needs confirmation.)

[edit] Notes

Be warned that values returned by the Rgb() function differ with the video card. So, directly filling out color numbers as color parameter in 16 bit color mode without using Rgb() is a bad idea, as RGB returns the correct color code for every video card

[edit] Errors

<If someone knows, please edit!>

[edit] Example

Program awesome;
Global
    byte red=0;
    byte green=255;
    byte blue=0;

Begin
    
    set_text_color(rgb(red,green,blue));
    write(0,1,1,0,"Mijn potlood is bruin"); //this text will be green as an Irishman's ejecta

    set_text_color(rgb(255,0,0));
    write(0,1,11,0,"Je moeder"); //this text will be red
        
    Loop
  
        frame;
    End
End

Used in example: write(), rgb()

This results in something like this:
Image:set_text_color.png

Personal tools