App-Fotagger

 view release on metacpan or  search on metacpan

lib/App/Fotagger/Display/SDL.pm  view on Meta::CPAN

    
    my $window = SDL::App->new(
        -width  => $self->width,
        -height => $self->height,
        -depth  => 16,
    );
    $self->window($window);
    $self->font(SDL::TTFont->new(-name=>'/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf', -size=>12,-bg=>$self->black,  -fg=>$self->white));
    $self->starfont(SDL::TTFont->new(-name=>'/usr/share/fonts/truetype/ttf-liberation/LiberationSans-Regular.ttf', -size=>60,-bg=>$self->black,  -fg=>$self->yellow));
    $self->event(SDL::Event->new);
    $self->event->set_unicode(1);
    $self->blank_tags(SDL::Rect->new(-width=>$self->width, -height=>16, -y=>680, -x=>0));
    $self->blank_stars(SDL::Rect->new(-width=>$self->width, -height=>30, -y=>696, -x=>0));

    my $event = $self->event;
    
    $self->draw_image;
    while (1) {
        MAIN: while ($event->poll) {
            my $type = $event->type();
            exit if ($type == SDL_QUIT);

lib/App/Fotagger/Display/SDL.pm  view on Meta::CPAN

                        $self->draw_stars;
                        $self->draw_tags;
                    }
                }
            } elsif ($type == SDL_KEYDOWN && $app->tagging) {
                my $image = $app->current_image;
                my $tags = $image->tags;
                my $update_tags_display=1;
                given($key) {
                    when (length == 1) {
                        my $uni = $event->key_unicode;
                        $tags.=chr($uni);
                    }
                    when('space') {
                        $tags.=' ';
                    }
                    when('backspace') {
                        $tags=~s/.$//;
                    }
                    when('return') {
                        $app->tagging(0);



( run in 0.511 second using v1.01-cache-2.11-cpan-d7f47b0818f )