File: SDLx_text_wordwrap.pl

package info (click to toggle)
libsdl-perl 2.548-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,972 kB
  • sloc: perl: 13,985; ansic: 583; makefile: 35
file content (28 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use warnings;
use lib '../lib';
use SDL;
use SDLx::App;
use SDLx::Text;

my $app = SDLx::App->new( eoq => 1 );

my $text = SDLx::Text->new( word_wrap => 450 );

$app->draw_rect( [0, 0, $app->w, $app->h], 0x00ffff );

my $message = <<'EOT';
All lines come from a single string.

- Really?
Yup.

- But... but... what if I say a lot of things in a single line.  Won't that become trucated or something?

Not if you set "word_wrap" to a particular width, like we do here :-)
EOT

$text->write_to( $app, $message );
$app->update;

$app->run;