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

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.107 by root, Fri Apr 14 20:27:35 2006 UTC vs.
Revision 1.111 by root, Sat Apr 15 02:10:22 2006 UTC

1655} 1655}
1656 1656
1657sub key_up { 1657sub key_up {
1658} 1658}
1659 1659
1660sub button_down {
1661 my ($self, $ev, $x, $y) = @_;
1662
1663 $self->focus_in;
1664
1665 if ($ev->button == 2) {
1666 my ($ox, $oy) = ($ev->button_x, $ev->button_y);
1667 my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y});
1668
1669 $self->{motion} = sub {
1670 my ($ev, $x, $y) = @_;
1671
1672 ($x, $y) = ($ev->motion_x, $ev->motion_y);
1673
1674 $::CFG->{map_shift_x} = $bw + $x - $ox;
1675 $::CFG->{map_shift_y} = $bh + $y - $oy;
1676
1677 $self->update;
1678 };
1679 }
1680}
1681
1682sub button_up {
1683 my ($self, $ev, $x, $y) = @_;
1684
1685 delete $self->{motion};
1686}
1687
1688sub mouse_motion {
1689 my ($self, $ev, $x, $y) = @_;
1690
1691 $self->{motion}->($ev, $x, $y) if $self->{motion};
1692}
1693
1660sub size_request { 1694sub size_request {
1661 ( 1695 (
1662 1 + 32 * int $::WIDTH / 32, 1696 1 + 32 * int $::WIDTH / 32,
1663 1 + 32 * int $::HEIGHT / 32, 1697 1 + 32 * int $::HEIGHT / 32,
1664 ) 1698 )
1672} 1706}
1673 1707
1674sub draw { 1708sub draw {
1675 my ($self) = @_; 1709 my ($self) = @_;
1676 1710
1677 $self->{need_update}++;#d#
1678 if (delete $self->{need_update}) { 1711 if (delete $self->{need_update}) {
1679 glNewList $self->{list}, GL_COMPILE; 1712 glNewList $self->{list}, GL_COMPILE;
1680 1713
1681 my $sw = int $::WIDTH / 32;
1682 my $sh = int $::HEIGHT / 32;
1683
1684 if ($::MAP) { 1714 if ($::MAP) {
1715 my $sw = int $::WIDTH / 32;
1716 my $sh = int $::HEIGHT / 32;
1717
1718 my $sx = $::CFG->{map_shift_x}; my $sx0 = $sx & 31; $sx = ($sx - $sx0) / 32;
1719 my $sy = $::CFG->{map_shift_y}; my $sy0 = $sy & 31; $sy = ($sy - $sy0) / 32;
1720
1721 glTranslate $sx0 - 32, $sy0 - 32, 0;
1722
1685 my ($w, $h, $data) = $::MAP->draw (0, 0, $sw, $sh); 1723 my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1);
1686 1724
1687 if ($::CFG->{fow_enable}) { 1725 if ($::CFG->{fow_enable}) {
1688 if ($::CFG->{fow_smooth}) { # smooth fog of war 1726 if ($::CFG->{fow_smooth}) { # smooth fog of war
1689 glConvolutionParameter GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER; 1727 glConvolutionParameter GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER;
1690 glConvolutionFilter2D 1728 glConvolutionFilter2D
1708 format => GL_ALPHA; 1746 format => GL_ALPHA;
1709 1747
1710 glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth}; 1748 glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth};
1711 1749
1712 glEnable GL_BLEND; 1750 glEnable GL_BLEND;
1751 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1713 glEnable GL_TEXTURE_2D; 1752 glEnable GL_TEXTURE_2D;
1714 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 1753 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
1715 1754
1716 glColor +($::CFG->{fow_intensity}) x 3, 1; 1755 glColor +($::CFG->{fow_intensity}) x 3, 1;
1717 $tex->draw_quad (0, 0, $w * 32, $h * 32); 1756 $tex->draw_quad (0, 0, $w * 32, $h * 32);
1718 1757
1719 glDisable GL_TEXTURE_2D; 1758 glDisable GL_TEXTURE_2D;
1720 glDisable GL_BLEND; 1759 glDisable GL_BLEND;
1721 } 1760 }
1761
1762 # HACK BEGIN
1763 {
1764 glTranslate -($sx0 - 32), -($sy0 - 32), 0;#remove
1765 my ($w, $h) = (250, 250);
1766
1767 glEnable GL_BLEND;
1768 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1769 glEnable GL_TEXTURE_2D;
1770 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1771
1772 CFClient::Texture->new (
1773 w => $w,
1774 h => $h,
1775 data => $::MAP->mapmap ($w, $h),
1776 type => GL_UNSIGNED_INT_8_8_8_8_REV
1777 )->draw_quad (100, 100);
1778
1779 glDisable GL_TEXTURE_2D;
1780 glDisable GL_BLEND;
1781 }
1782 # HACK END
1722 } 1783 }
1723 1784
1724 glEndList; 1785 glEndList;
1725 } 1786 }
1726 1787
1788 glPushMatrix;
1727 glCallList $self->{list}; 1789 glCallList $self->{list};
1790 glPopMatrix;
1728 1791
1729 if ($FOCUS != $self) { 1792 if ($FOCUS != $self) {
1730 glColor 64/255, 64/255, 64/255; 1793 glColor 64/255, 64/255, 64/255;
1731 glLogicOp GL_AND; 1794 glLogicOp GL_AND;
1732 glEnable GL_COLOR_LOGIC_OP; 1795 glEnable GL_COLOR_LOGIC_OP;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines