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

Write

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:39, 27 June 2007 (edit)
Sandman (Talk | contribs)

← Previous diff
Current revision (21:26, 9 February 2010) (edit) (undo)
91.214.44.2 (Talk)
(Definition)
 
(6 intermediate revisions not shown.)
Line 2: Line 2:
[[Category:texts]] [[Category:texts]]
-==Definition==+gizmo <a href="http://www.beadingdaily.com/members/Buy-Viagra-Soft-Flavoured-Online/default.aspx">buy accutane</a> gush
-'''INT''' write ( <'''INT''' fontID> , <'''INT''' x> , <'''INT''' y> , <'''INT''' alignment> , <'''STRING''' text>)+
- +
-Puts a dynamic text with a certain font on certain coordinates on the screen with a certain [[alignment]].+
== Parameters == == Parameters ==
{| {|
| '''INT''' fontID || - The [[FontID]] of the font to be used for the text. | '''INT''' fontID || - The [[FontID]] of the font to be used for the text.
 +|-
| '''INT''' x || - The X coordinate of the text. | '''INT''' x || - The X coordinate of the text.
 +|-
| '''INT''' y || - The Y coordinate of the text. | '''INT''' y || - The Y coordinate of the text.
-| '''INT''' alignment || - The type of [[alignment]].+|-
 +| '''INT''' alignment || - The type of [[Alignment modes|alignment]].
 +|-
| '''STRING''' text || - The text to be used. | '''STRING''' text || - The text to be used.
|} |}
Line 19: Line 20:
'''INT''' : [[TextID]] '''INT''' : [[TextID]]
{| {|
-| 0 || - Error. The text could not be obtained or was empty.+| -1 || - Error. The text could not be obtained or was empty.
|- |-
-| !0 || - The [[TextID]] of the text.+| >=0 || - The [[TextID]] of the text.
|} |}
 +
 +== Notes ==
 +There is a limit of 511 texts to simultaneously exist on the screen. The program will crash with an error when this number is reached.
 +
 +The text depth can be changed by adjusting the global variable [[text_z]].
 +
 +To write variables to the screen, rather use [[write_int]](), [[write_string]](), [[write_float]]() or [[write_var]]() than this command.
 +
 +To write text on a map you can use the command [[write_in_map]]().
== Example == == Example ==
Line 64: Line 74:
Used in example: [[set_fps]](), [[write_int]](), [[write_string]](), [[write_float]](), [[key]](), [[delete_text]](), [[array]], [[fps]], [[TextID]] Used in example: [[set_fps]](), [[write_int]](), [[write_string]](), [[write_float]](), [[key]](), [[delete_text]](), [[array]], [[fps]], [[TextID]]
-This will output the words LEFT or RIGHT according to the keys you press,+This will result in something like:<br>
-or it will quit the program once ESCAPE is pressed.+http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/texts.PNG

Current revision


gizmo <a href="http://www.beadingdaily.com/members/Buy-Viagra-Soft-Flavoured-Online/default.aspx">buy accutane</a> gush

Contents

[edit] Parameters

INT fontID - The FontID of the font to be used for the text.
INT x - The X coordinate of the text.
INT y - The Y coordinate of the text.
INT alignment - The type of alignment.
STRING text - The text to be used.

[edit] Returns

INT : TextID

-1 - Error. The text could not be obtained or was empty.
>=0 - The TextID of the text.

[edit] Notes

There is a limit of 511 texts to simultaneously exist on the screen. The program will crash with an error when this number is reached.

The text depth can be changed by adjusting the global variable text_z.

To write variables to the screen, rather use write_int(), write_string(), write_float() or write_var() than this command.

To write text on a map you can use the command write_in_map().

[edit] Example

Program texts;
Const
    maxtexts = 10;
Private
    int textid[maxtexts-1];
    string str;
    float flt;
Begin

    // Set FPS
    set_fps(60,0);

    // Write some texts
    textid[0] = write(0,0,0,0,"FPS:");
    textid[1] = write_int(0,30,0,0,&fps);
    textid[2] = write_string(0,160,95,1,&str);
    textid[3] = write_float(0,160,105,0,&flt);

    // Update the texts until ESC is pressed
    Repeat
        // Notice the texts get updated as the values of str and flt changes.
        // The same goes for the value of fps.
        str = "This program is running for " + timer/100 + " seconds.";
        flt = (float)timer/100;
        frame;
    Until(key(_esc));

    // Delete the texts
    for(x=0; x<maxtexts; x++)
        if(textid[x]!=0)
            delete_text(textid[x]);
        end
    end

End

Used in example: set_fps(), write_int(), write_string(), write_float(), key(), delete_text(), array, fps, TextID

This will result in something like:
texts.PNG

Personal tools