ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.161 by root, Sat Mar 20 01:25:56 2010 UTC vs.
Revision 1.163 by root, Thu Oct 14 00:02:39 2010 UTC

1package DC::MapWidget; 1package DC::MapWidget;
2 2
3use strict; 3use common::sense;
4use utf8;
5 4
6use List::Util qw(min max); 5use List::Util qw(min max);
7 6
8use DC; 7use DC;
9use DC::OpenGL; 8use DC::OpenGL;
515 glTranslate $sx0, $sy0; 514 glTranslate $sx0, $sy0;
516 glScale $::CFG->{map_scale}, $::CFG->{map_scale}; 515 glScale $::CFG->{map_scale}, $::CFG->{map_scale};
517 glTranslate DC::ceil $self->{sdx}, DC::ceil $self->{sdy}; 516 glTranslate DC::ceil $self->{sdx}, DC::ceil $self->{sdy};
518 517
519 $::MAP->draw ($dx, $dy, $sw, $sh, 518 $::MAP->draw ($dx, $dy, $sw, $sh,
520 $self->{tilesize}, 519 ($self->{tilesize}) x 2,
521 $::CONN->{player}{tag}, 520 $::CONN->{player}{tag},
522 -$self->{sdx}, -$self->{sdy}); 521 -$self->{sdx}, -$self->{sdy});
523 522
524 glScale $self->{tilesize}, $self->{tilesize}; 523 glScale $self->{tilesize}, $self->{tilesize};
525 524
608 $self->SUPER::DESTROY; 607 $self->SUPER::DESTROY;
609} 608}
610 609
611package DC::MapWidget::MapMap; 610package DC::MapWidget::MapMap;
612 611
613use strict; 612use common::sense;
614use utf8;
615 613
616our @ISA = DC::UI::Base::; 614our @ISA = DC::UI::Base::;
617 615
618use Time::HiRes qw(time);
619use DC::OpenGL; 616use DC::OpenGL;
620 617
621sub size_request { 618sub size_request {
622 ($::HEIGHT * 0.2, $::HEIGHT * 0.2) 619 ($::HEIGHT * 0.2, $::HEIGHT * 0.2)
623} 620}
624 621
625sub refresh_hook { 622sub refresh_hook {
626 my ($self) = @_; 623 my ($self) = @_;
627 624
628 if ($::MAP && $self->{texture_atime} < time) { 625 if ($::MAP && $self->{texture_atime} < EV::now) {
629 my ($w, $h) = @$self{qw(w h)}; 626 my ($w, $h) = @$self{qw(w h)};
630 627
631 return unless $w && $h; 628 return unless $w && $h;
632 629
633 my $sw = int $::WIDTH / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99; 630 my $sw = int $::WIDTH / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99;
648 $self->{sh} = $sh; 645 $self->{sh} = $sh;
649 646
650 $self->{x0} = $x0; 647 $self->{x0} = $x0;
651 $self->{y0} = $y0; 648 $self->{y0} = $y0;
652 649
653 $self->{texture_atime} = time + 1/3; 650 $self->{texture_atime} = EV::now + 1/2;
654 651
655 $self->{texture} = 652 $self->{texture} =
656 new DC::Texture 653 new DC::Texture
657 w => $w, 654 w => $w,
658 h => $h, 655 h => $h,
713 glDisable GL_BLEND; 710 glDisable GL_BLEND;
714} 711}
715 712
716package DC::MapWidget::Command; 713package DC::MapWidget::Command;
717 714
718use strict; 715use common::sense;
719 716
720use DC::OpenGL; 717use DC::OpenGL;
721 718
722our @ISA = DC::UI::Frame::; 719our @ISA = DC::UI::Frame::;
723 720

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines