Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Extend TTF for SDLx #163

Closed
kthakore opened this Issue Jul 26, 2011 · 5 comments

Comments

Projects
None yet
2 participants
Owner

kthakore commented Jul 26, 2011

For normal usage of SDL::TTF, there is a lot of boiler plate code to be written.

{{{
use SDL;

use SDL::TTF;
use SDL::TTF::Font;

SDL::init(SDL_INIT_VIDEO);
SDL::TTF::init();

my $font = SDL::TTF::open_font('test/data/aircut3.ttf', '24');
die 'Coudnt make font '. SDL::get_error if !$font;

my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', SDL::Color->new(0xFF,0xFF,0xFF));

SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(10, 10, 640, 480));

SDL::Video::update_rect($display, 0, 0, 0, 0);

}}}

Compared to

{{{

my $font = SDLx::TTF->new( 'test/data/aircut3.ttf' );

$font->size(24);

$font->write_to($display, 'Blah', { style => 'underline', hinting => 'blah', render => 'solid' ... });

}}}

@ghost ghost assigned kthakore Jul 26, 2011

Owner

kthakore commented Jul 26, 2011

Author: kthakore
Time: 1284639238
Field: description
Value: For normal usage of SDL::TTF, there is a lot of boiler plate code to be written.

{{{
use SDL;

use SDL::TTF;
use SDL::TTF::Font;

SDL::init(SDL_INIT_VIDEO);
SDL::TTF::init();

my $font = SDL::TTF::open_font('test/data/aircut3.ttf', '24');
die 'Coudnt make font '. SDL::get_error if !$font;

my $surface = SDL::TTF::render_text_solid($font, 'Hallo!', SDL::Color->new(0xFF,0xFF,0xFF));

SDL::Video::blit_surface($surface, SDL::Rect->new(0, 0, 640, 480), $display, SDL::Rect->new(10, 10, 640, 480));

SDL::Video::update_rect($display, 0, 0, 0, 0);

}}}

Compared to

{{{

my $font = SDLx::TTF->new( 'test/data/aircut3.ttf' );

$font->size(24);

$font->write_to($display, 'Blah', { style => 'underline', hinting => 'blah', render => 'solid' ... });

}}}

Owner

kthakore commented Jul 26, 2011

Author: kthakore
Time: 1284639238
Field: comment
Value:

Owner

kthakore commented Jul 26, 2011

Author: kthakore
Time: 1284639272
Field: type
Value: task

Owner

kthakore commented Jul 26, 2011

Author: kthakore
Time: 1284639272
Field: comment
Value:

Member

Blaizer commented Aug 11, 2011

This has been completed under the name SDLx::Text.

Further issues should refer to the new name.

@Blaizer Blaizer closed this Aug 11, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment