<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<script type="text/javascript" language="JavaScript">
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();
}
if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
origWidth = innerWidth;
origHeight = innerHeight;
onresize = reDo;
}
onerror = null;
</script>
<style type="text/css">
< !-- div.WebHelpPopupMenu {
position: absolute;
left: 0px;
top: 0px;
z-index: 4;
visibility: hidden;
}
p.WebHelpNavBar {
text-align: right;
}
-->
</style>
<script type="text/javascript">
gRootRelPath = "../../../..";
gCommonRootRelPath = "../../../..";
gTopicId = "9.2.5.6.0_7";
<script type="text/javascript" src="../../../../template/scripts/rh.min.js"></script>
<script type="text/javascript" src="../../../../template/scripts/common.min.js"></script>
<script type="text/javascript" src="../../../../template/scripts/topic.min.js"></script>
<script type="text/javascript" src="../../../../template/scripts/topicwidgets.min.js"></script>
<script type="text/javascript" src="../../../../whxdata/projectsettings.js"></script>
<link rel="stylesheet" type="text/css" href="../../../../template/styles/topic.min.css"/>
<link rel="stylesheet" type="text/css" href="../../../../template/Charcoal_Grey/topicheader.css"/>
<meta name="topic-status" content="Draft"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>draw_text</title>
<meta name="generator" content="Adobe RoboHelp 2019"/>
<link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css"/>
<meta name="rh-authors" content="Mark Alexander"/>
<meta name="topic-comment" content="Reference page for draw_text"/>
<meta name="rh-index-keywords" content="draw_text"/>
<meta name="search-keywords" content="draw_text"/>
</head>
<body>
<div class="topic-header rh-hide" id="rh-topic-header" onclick="rh._.goToFullLayout()">
<div class="logo">
</div>
<div class="nav">
<div class="title" title="draw_text">
<span>draw_text</span>
</div>
<div class="gotohome" title="Click here to see this page in full context">
<span>Click here to see this page in full context</span>
</div>
</div>
</div>
<div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div>
<h1>draw_text</h1>
<p>With this function you can draw any string at any position within the room (for drawing real numbers you should use the <a href="../../Strings/string.htm"><tt>string</tt><tt>()</tt></a> function to convert them into text). To combine strings you can
use <b>+</b> (see example below) and you can also use <b>\n</b> within a string to add a line break so it is drawn over multiple lines (for information on how to properly format a string and what escape characters you can use, please see <a href="../../Strings/Strings.htm">here</a>).
The colour of the text and the alpha are governed by the current base alpha and colour values as set by <a href="../Colour_And_Alpha/draw_set_alpha.htm"><tt>draw_set_alpha</tt><tt>()</tt><tt></tt></a> and <a href="../Colour_And_Alpha/draw_set_colour.htm"><tt>draw_set_colour</tt><tt>()</tt><tt></tt></a>.</p>
<p class="note"><b>NOTE</b>:The actual position of the text will be influenced by the alignment values set by <a href="draw_set_halign.htm"><tt><span style="font-size:14px;">draw_set_halign</span></tt><tt>()</tt><tt></tt></a> and <a href="draw_set_valign.htm"><tt><span style="font-size:14px;">draw_set_valign</span></tt><tt>()</tt><tt></tt></a>.</p>
<p> </p>
<h4>Syntax:</h4>
<p class="code">draw_text(x, y, string);</p>
<table>
<tbody>
<tr>
<th>Argument</th>
<th>Description</th>
</tr>
<tr>
<td>x</td>
<td>The x coordinate of the drawn string.</td>
</tr>
<tr>
<td>y</td>
<td>The y coordinate of the drawn string.</td>
</tr>
<tr>
<td>string</td>
<td>The string to draw.</td>
</tr>
</tbody>
</table>
<p> </p>
<h4>Returns:</h4>
<p class="code">N/A</p>
<p> </p>
<h4>Example:</h4>
<p class="code">draw_text(x, y, "Hello, " + global.Name + "!\nI hope you are well!");</p>
<p>The above code will draw a string at the instance x/y position, which will use the string stored in the global variable "Name" and split it over two lines.</p>
<p> </p>
<p> </p>
<p> </p>
<div class="footer">
<div class="buttons">
<div class="clear">
<div style="float:left">Back: <a href="Text.htm">Text</a></div>
<div style="float:right">Next: <a href="draw_text_ext.htm">draw_text_ext</a></div>
</div>
</div>
<h5>© Copyright YoYo Games Ltd. 2020 All Rights Reserved</h5>
</div>
</body></html>