Skip to content

Commit 1e4e4b9

Browse files
add graphprint scaling, flipping
1 parent 1c0a5b5 commit 1e4e4b9

83 files changed

Lines changed: 442 additions & 253 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,44 @@
11
\page GRAPHPRINT GRAPHPRINT Keyword
22

33
```basic
4-
GRAPHPRINT x, y, printable
4+
GRAPHPRINT x, y, scale_x, scale_y, printable
55
```
66

77
Draws text directly onto the graphics framebuffer at **pixel coordinates**.
88
Unlike `PRINT`, `GRAPHPRINT` does not use or update the text cursor. Each call is independent.
99

10-
---
10+
`x` and `y` are integer **pixel coordinates** measured from the top-left corner of the screen. scale_x and scale_y can be an integer or a real number. If you specify 0 for either dimension, the default scale of 1 will be used.
11+
`printable` is the same syntax accepted by \ref PRINT "PRINT", a list of values separated by commas or semicolons. * Text is rendered using the current **graphics colour** (`GCOL`) for the foreground.
12+
The background is always **transparent**, existing pixels are left unchanged. Each call draws at the specified location only, there is no graphics cursor or scrolling.
1113

12-
### Notes
13-
14-
* `(x, y)` are **pixel coordinates** measured from the top-left corner of the screen.
15-
* `printable` is the same syntax accepted by `PRINT`: a list of values separated by commas or semicolons.
16-
17-
* **Strings** are rendered literally.
18-
* **Numeric values** are converted to their string form.
19-
* `;` continues text without spacing.
20-
* `,` advances to the next tab stop (multiple of text column width).
21-
* Text is rendered using the current **graphics colour** (`GCOL`) for the foreground.
22-
* The background is always **transparent**; existing pixels are left unchanged.
23-
* The function clips safely against screen edges; partially visible text is drawn correctly.
24-
* All 8-bit codes `0x00–0xFF` map directly to glyphs, including those redefined with `VDU 23`. No UTF-8 decoding is applied.
25-
* Each call draws at the specified location only. There is no graphics cursor or scrolling.
26-
27-
---
28-
29-
### Errors
30-
31-
* An error occurs if `x` or `y` are not numeric.
32-
* An error occurs if `printable` is omitted.
33-
34-
---
14+
You can use negative scale values to flip the text. Note that if you flip the scale values, it will render right to left or bottom to top accordingly.
3515

3616
### Examples
3717

38-
**Draw a label in magenta**
18+
**Draw a label upside down in magenta**
3919

4020
```basic
4121
GCOL &FF00FF
42-
GRAPHPRINT 100, 40, "SCORE:", SCORE
22+
GRAPHPRINT 100, 40, 1, -1, "SCORE:", SCORE
4323
```
4424

45-
**Overlay transparent HUD text**
25+
**Overlay transparent HUD text at 5x scale**
4626

4727
```basic
4828
GCOL &FFFFFF
49-
GRAPHPRINT 8, 8, "READY!";
29+
GRAPHPRINT 8, 8, 5, 5, "READY!";
5030
```
5131

5232
**Use a redefined glyph**
5333

5434
```basic
5535
VDU 23,65,&3C,&7E,&FF,&E7,&FF,&66,&66,&00
56-
GRAPHPRINT 120, 100, "AAAAAAAAAAA"
36+
GRAPHPRINT 120, 100, 10, 10, "AAA"
5737
```
5838

59-
---
60-
6139
### See also
6240

63-
* \ref PRINT "PRINT" - text output in the scrolling text grid.
64-
* \ref GCOL "GCOL" - set graphics colour (0xRetro RocketGGBB).
65-
* \ref LINE "LINE" - draw lines (used by `VDU 25` in Retro Rocket).
66-
* \ref VDU "VDU" 23 - redefine character bitmaps used by both `PRINT` and `GRAPHPRINT`.
41+
* \ref PRINT "PRINT" ·
42+
* \ref GCOL "GCOL" ·
43+
* \ref LINE "LINE" ·
44+
* \ref VDU "VDU 23"

docs/GRAPHPRINT.html

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -123,53 +123,28 @@
123123
<div class="headertitle"><div class="title">GRAPHPRINT Keyword </div></div>
124124
</div><!--header-->
125125
<div class="contents">
126-
<div class="textblock"><div class="fragment"><div class="line">GRAPHPRINT x, y, printable</div>
126+
<div class="textblock"><div class="fragment"><div class="line">GRAPHPRINT x, y, scale_x, scale_y, printable</div>
127127
</div><!-- fragment --><p>Draws text directly onto the graphics framebuffer at <b>pixel coordinates</b>. Unlike <span class="tt">PRINT</span>, <span class="tt">GRAPHPRINT</span> does not use or update the text cursor. Each call is independent.</p>
128-
<hr />
129-
<h3 class="doxsection"><a class="anchor" id="notes-181"></a>
130-
Notes</h3>
131-
<ul>
132-
<li><span class="tt">(x, y)</span> are <b>pixel coordinates</b> measured from the top-left corner of the screen.</li>
133-
<li><span class="tt">printable</span> is the same syntax accepted by <span class="tt">PRINT</span>: a list of values separated by commas or semicolons.<ul>
134-
<li><b>Strings</b> are rendered literally.</li>
135-
<li><b>Numeric values</b> are converted to their string form.</li>
136-
<li><span class="tt">;</span> continues text without spacing.</li>
137-
<li><span class="tt">,</span> advances to the next tab stop (multiple of text column width).</li>
138-
</ul>
139-
</li>
140-
<li>Text is rendered using the current <b>graphics colour</b> (<span class="tt">GCOL</span>) for the foreground.</li>
141-
<li>The background is always <b>transparent</b>; existing pixels are left unchanged.</li>
142-
<li>The function clips safely against screen edges; partially visible text is drawn correctly.</li>
143-
<li>All 8-bit codes <span class="tt">0x00–0xFF</span> map directly to glyphs, including those redefined with <span class="tt">VDU 23</span>. No UTF-8 decoding is applied.</li>
144-
<li>Each call draws at the specified location only. There is no graphics cursor or scrolling.</li>
145-
</ul>
146-
<hr />
147-
<h3 class="doxsection"><a class="anchor" id="errors-9"></a>
148-
Errors</h3>
149-
<ul>
150-
<li>An error occurs if <span class="tt">x</span> or <span class="tt">y</span> are not numeric.</li>
151-
<li>An error occurs if <span class="tt">printable</span> is omitted.</li>
152-
</ul>
153-
<hr />
128+
<p><span class="tt">x</span> and <span class="tt">y</span> are integer <b>pixel coordinates</b> measured from the top-left corner of the screen. scale_x and scale_y can be an integer or a real number. If you specify 0 for either dimension, the default scale of 1 will be used. <span class="tt">printable</span> is the same syntax accepted by <a class="el" href="PRINT.html">PRINT</a>, a list of values separated by commas or semicolons. * Text is rendered using the current <b>graphics colour</b> (<span class="tt">GCOL</span>) for the foreground. The background is always <b>transparent</b>, existing pixels are left unchanged. Each call draws at the specified location only, there is no graphics cursor or scrolling.</p>
129+
<p>You can use negative scale values to flip the text. Note that if you flip the scale values, it will render right to left or bottom to top accordingly.</p>
154130
<h3 class="doxsection"><a class="anchor" id="examples-174"></a>
155131
Examples</h3>
156-
<p><b>Draw a label in magenta</b></p>
132+
<p><b>Draw a label upside down in magenta</b></p>
157133
<div class="fragment"><div class="line">GCOL &amp;FF00FF</div>
158-
<div class="line">GRAPHPRINT 100, 40, &quot;SCORE:&quot;, SCORE</div>
159-
</div><!-- fragment --><p><b>Overlay transparent HUD text</b></p>
134+
<div class="line">GRAPHPRINT 100, 40, 1, -1, &quot;SCORE:&quot;, SCORE</div>
135+
</div><!-- fragment --><p><b>Overlay transparent HUD text at 5x scale</b></p>
160136
<div class="fragment"><div class="line">GCOL &amp;FFFFFF</div>
161-
<div class="line">GRAPHPRINT 8, 8, &quot;READY!&quot;;</div>
137+
<div class="line">GRAPHPRINT 8, 8, 5, 5, &quot;READY!&quot;;</div>
162138
</div><!-- fragment --><p><b>Use a redefined glyph</b></p>
163139
<div class="fragment"><div class="line">VDU 23,65,&amp;3C,&amp;7E,&amp;FF,&amp;E7,&amp;FF,&amp;66,&amp;66,&amp;00</div>
164-
<div class="line">GRAPHPRINT 120, 100, &quot;AAAAAAAAAAA&quot;</div>
165-
</div><!-- fragment --><hr />
166-
<h3 class="doxsection"><a class="anchor" id="see-also-7"></a>
140+
<div class="line">GRAPHPRINT 120, 100, 10, 10, &quot;AAA&quot;</div>
141+
</div><!-- fragment --><h3 class="doxsection"><a class="anchor" id="see-also-7"></a>
167142
See also</h3>
168143
<ul>
169-
<li><a class="el" href="PRINT.html">PRINT</a> - text output in the scrolling text grid.</li>
170-
<li><a class="el" href="GCOL.html">GCOL</a> - set graphics colour (0xRetro RocketGGBB).</li>
171-
<li><a class="el" href="LINE.html">LINE</a> - draw lines (used by <span class="tt">VDU 25</span> in Retro Rocket).</li>
172-
<li><a class="el" href="VDU.html">VDU</a> 23 - redefine character bitmaps used by both <span class="tt">PRINT</span> and <span class="tt">GRAPHPRINT</span>. </li>
144+
<li><a class="el" href="PRINT.html">PRINT</a> ·</li>
145+
<li><a class="el" href="GCOL.html">GCOL</a> ·</li>
146+
<li><a class="el" href="LINE.html">LINE</a> ·</li>
147+
<li><a class="el" href="VDU.html">VDU 23</a> </li>
173148
</ul>
174149
</div></div><!-- contents -->
175150
</div><!-- PageDoc -->

docs/IF.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ <h3 class="doxsection"><a class="anchor" id="forms-and-examples"></a>
181181
<div class="line"> PRINT &quot;A NOT POSITIVE&quot;</div>
182182
<div class="line">ENDIF</div>
183183
</div><!-- fragment --><hr />
184-
<h3 class="doxsection"><a class="anchor" id="notes-182"></a>
184+
<h3 class="doxsection"><a class="anchor" id="notes-181"></a>
185185
Notes</h3>
186186
<ul>
187187
<li>In the <b>single-line</b> form, the <span class="tt">THEN</span> and optional <span class="tt">ELSE</span> parts each allow <b>one statement</b>. Use the multi-line form for multiple statements.</li>

docs/INPUT.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ <h3 class="doxsection"><a class="anchor" id="examples-175"></a>
158158
<div class="line">UNTIL X &lt;&gt; 0</div>
159159
<div class="line">PRINT &quot;Thanks: &quot;; X</div>
160160
</div><!-- fragment --><hr />
161-
<h3 class="doxsection"><a class="anchor" id="notes-183"></a>
161+
<h3 class="doxsection"><a class="anchor" id="notes-182"></a>
162162
Notes</h3>
163163
<ul>
164164
<li>The entered line is stored <b>as-is</b> for string variables (without the trailing newline).</li>

docs/KEYMAP.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ <h5 class="doxsection"><a class="anchor" id="example-17"></a>
147147
<div class="fragment"><div class="line">REM Load British English keyboard layout (if installed)</div>
148148
<div class="line">KEYMAP &quot;en-GB&quot;</div>
149149
</div><!-- fragment --><hr />
150-
<h5 class="doxsection"><a class="anchor" id="notes-184"></a>
150+
<h5 class="doxsection"><a class="anchor" id="notes-183"></a>
151151
Notes</h5>
152152
<ul>
153153
<li>The setting affects how keyboard input is interpreted by the system. <br />

docs/LET.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ <h3 class="doxsection"><a class="anchor" id="examples-176"></a>
146146
<div class="line">PRINT A(1)</div>
147147
</div><!-- fragment --><p>Using an expression on the right-hand side </p><div class="fragment"><div class="line">TOTAL = PRICE * QUANTITY</div>
148148
</div><!-- fragment --><hr />
149-
<h3 class="doxsection"><a class="anchor" id="notes-185"></a>
149+
<h3 class="doxsection"><a class="anchor" id="notes-184"></a>
150150
Notes</h3>
151151
<ul>
152152
<li><span class="tt">LET</span> does not change scope. It is simply an optional keyword for assignment.</li>

docs/LINE.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ <h3 class="doxsection"><a class="anchor" id="examples-178"></a>
139139
</div><!-- fragment --><hr />
140140
<dl class="section remark"><dt>Remarks</dt><dd>If <a class="el" href="AUTOFLIP.html">AUTOFLIP</a> is <span class="tt">FALSE</span>, draw your frame (including <span class="tt">LINE</span>) and then call <a class="el" href="FLIP.html">FLIP</a> to present it.</dd></dl>
141141
<hr />
142-
<h3 class="doxsection"><a class="anchor" id="notes-186"></a>
142+
<h3 class="doxsection"><a class="anchor" id="notes-185"></a>
143143
Notes</h3>
144144
<ul>
145145
<li>Coordinates are in <b>screen pixels</b>; <span class="tt">(0,0)</span> is the <b>top-left</b> of the display.</li>

docs/MAPFREE.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ <h5 class="doxsection"><a class="anchor" id="example-18"></a>
141141
<div class="fragment"><div class="line">123</div>
142142
<div class="line">Invalid MAP</div>
143143
</div><!-- fragment --><hr />
144-
<h5 class="doxsection"><a class="anchor" id="notes-187"></a>
144+
<h5 class="doxsection"><a class="anchor" id="notes-186"></a>
145145
Notes</h5>
146146
<ul>
147147
<li>Frees all memory associated with the MAP:<ul>

docs/MAPSET.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ <h5 class="doxsection"><a class="anchor" id="examples-180"></a>
165165
<div class="line"> </div>
166166
<div class="line">PRINT MAPGETR(M, &quot;value&quot;)</div>
167167
</div><!-- fragment --><hr />
168-
<h5 class="doxsection"><a class="anchor" id="notes-188"></a>
168+
<h5 class="doxsection"><a class="anchor" id="notes-187"></a>
169169
Notes</h5>
170170
<ul>
171171
<li>Keys are <b>case-sensitive</b></li>

docs/MATCH.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ <h3 class="doxsection"><a class="anchor" id="not-supported"></a>
216216
<li>Multiline mode (<span class="tt">^</span> and <span class="tt">$</span> match string boundaries only)</li>
217217
</ul>
218218
<hr />
219-
<h3 class="doxsection"><a class="anchor" id="notes-189"></a>
219+
<h3 class="doxsection"><a class="anchor" id="notes-188"></a>
220220
Notes</h3>
221221
<ul>
222222
<li>Matching is <b>case-sensitive</b>. To simulate case-insensitive matching, normalise both strings or use explicit character classes.</li>

0 commit comments

Comments
 (0)