File: SDLx_text_styles.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 (50 lines) | stat: -rw-r--r-- 1,067 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;

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

$text->write_xy( $app, 300, 10, 'Normal Text' );

$text->bold(1);
$text->write_xy( $app, 300, 50, 'Bold Text' );

$text->italic(1);
$text->write_xy( $app, 300, 90, 'Bold/Italic Text' );

$text->bold(0);
$text->write_xy( $app, 300, 130, 'Italic Text' );

$text->italic(0);
$text->underline(1);
$text->write_xy( $app, 300, 170, 'Underline Text' );

$text->underline(0);
$text->strikethrough(1);
$text->write_xy( $app, 300, 210, 'Strikethrough Text' );

$text->underline(1);
$text->bold(1);
$text->italic(1);
$text->write_xy( $app, 300, 250, 'All in one!' );

my $another = SDLx::Text->new(
        bold          => 1,
        italic        => 1,
        underline     => 1,
        strikethrough => 1,
        shadow        => 1,
);

$another->write_xy( $app, 50, 300, 'Can even be set with others (like shadow), during startup!' );

$app->update;

$app->run;