… | |
… | |
2653 | can_events => 1, |
2653 | can_events => 1, |
2654 | @_ |
2654 | @_ |
2655 | ); |
2655 | ); |
2656 | } |
2656 | } |
2657 | |
2657 | |
|
|
2658 | sub invoke_button_down { |
|
|
2659 | my ($self, $ev, $x, $y) = @_; |
|
|
2660 | |
|
|
2661 | 1 |
|
|
2662 | } |
|
|
2663 | |
2658 | sub invoke_button_up { |
2664 | sub invoke_button_up { |
2659 | my ($self, $ev, $x, $y) = @_; |
2665 | my ($self, $ev, $x, $y) = @_; |
2660 | |
2666 | |
2661 | $self->emit ("activate") |
2667 | $self->emit ("activate") |
2662 | if $x >= 0 && $x < $self->{w} |
2668 | if $x >= 0 && $x < $self->{w} |
… | |
… | |
3590 | } |
3596 | } |
3591 | |
3597 | |
3592 | sub update_face { |
3598 | sub update_face { |
3593 | my ($self) = @_; |
3599 | my ($self) = @_; |
3594 | |
3600 | |
3595 | return unless $::CONN; |
3601 | if ($::CONN) { |
3596 | |
|
|
3597 | if (my $anim = $::CONN->{anim}[$self->{anim}]) { |
3602 | if (my $anim = $::CONN->{anim}[$self->{anim}]) { |
3598 | if ($anim && @$anim) { |
3603 | if ($anim && @$anim) { |
3599 | delete $self->{wait_face}; |
|
|
3600 | $self->{face} = $anim->[ $self->{frame} % @$anim ]; |
3604 | $self->{face} = $anim->[ $self->{frame} % @$anim ]; |
|
|
3605 | delete $self->{face_change_cb}; |
|
|
3606 | |
3601 | if (my $tex = $self->{tex} = $::CONN->{texture}[ $::CONN->{faceid}[$self->{face}] ]) { |
3607 | if (my $tex = $self->{tex} = $::CONN->{texture}[ $::CONN->{face}[$self->{face}]{id} ]) { |
3602 | unless ($tex->{name} || $tex->{loading}) { |
3608 | unless ($tex->{name} || $tex->{loading}) { |
3603 | $tex->upload (sub { $self->reconfigure }); |
3609 | $tex->upload (sub { $self->reconfigure }); |
|
|
3610 | } |
3604 | } |
3611 | } |
3605 | } |
3612 | } |
3606 | } |
3613 | } |
3607 | } |
3614 | } |
3608 | } |
3615 | } |
3609 | |
3616 | |
3610 | sub size_request { |
3617 | sub size_request { |
3611 | my ($self) = @_; |
3618 | my ($self) = @_; |
3612 | |
3619 | |
3613 | if ($::CONN) { |
3620 | if ($::CONN) { |
3614 | if (my $faceid = $::CONN->{faceid}[$self->{face}]) { |
3621 | if (my $faceid = $::CONN->{face}[$self->{face}]{id}) { |
3615 | if (my $tex = $self->{tex} = $::CONN->{texture}[$faceid]) { |
3622 | if (my $tex = $self->{tex} = $::CONN->{texture}[$faceid]) { |
3616 | if ($tex->{name}) { |
3623 | if ($tex->{name}) { |
3617 | return ($self->{size_w} || $tex->{w}, $self->{size_h} || $tex->{h}); |
3624 | return ($self->{size_w} || $tex->{w}, $self->{size_h} || $tex->{h}); |
3618 | } elsif (!$tex->{loading}) { |
3625 | } elsif (!$tex->{loading}) { |
3619 | $tex->upload (sub { $self->reconfigure }); |
3626 | $tex->upload (sub { $self->reconfigure }); |
3620 | } |
3627 | } |
3621 | } else { |
|
|
3622 | $self->{wait_face} ||= $::CONN->connect_face_update ($faceid, sub { |
|
|
3623 | $self->reconfigure; |
|
|
3624 | }); |
|
|
3625 | } |
3628 | } |
|
|
3629 | |
|
|
3630 | $self->{face_change_cb} ||= $::CONN->on_face_change ($self->{face}, sub { $self->reconfigure }); |
3626 | } |
3631 | } |
3627 | } |
3632 | } |
3628 | |
3633 | |
3629 | ($self->{size_w} || 8, $self->{size_h} || 8) |
3634 | ($self->{size_w} || 8, $self->{size_h} || 8) |
3630 | } |
3635 | } |