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.116 by root, Sat Apr 15 21:16:50 2006 UTC vs.
Revision 1.119 by root, Sun Apr 16 07:25:30 2006 UTC

112 $self 112 $self
113} 113}
114 114
115sub move { 115sub move {
116 my ($self, $x, $y, $z) = @_; 116 my ($self, $x, $y, $z) = @_;
117 $self->{x} = $x; 117 $self->{x} = int $x;
118 $self->{y} = $y; 118 $self->{y} = int $y;
119 $self->{z} = $z if defined $z; 119 $self->{z} = $z if defined $z;
120} 120}
121 121
122sub needs_redraw { 122sub needs_redraw {
123 0 123 0
565 # TODO: user_x, user_y, overwrite moveto? 565 # TODO: user_x, user_y, overwrite moveto?
566 566
567 $class->SUPER::new ( 567 $class->SUPER::new (
568 bg => [1, 1, 1, 1], 568 bg => [1, 1, 1, 1],
569 border_bg => [1, 1, 1, 1], 569 border_bg => [1, 1, 1, 1],
570 border => $::FONTSIZE * 0.8, 570 border => int $::FONTSIZE * 0.8,
571 @_ 571 @_
572 ) 572 )
573} 573}
574 574
575sub size_request { 575sub size_request {
1276 1276
1277sub _draw { 1277sub _draw {
1278 my ($self) = @_; 1278 my ($self) = @_;
1279 1279
1280 local $self->{fg} = $self->{fg}; 1280 local $self->{fg} = $self->{fg};
1281 my $tex = $tex[0];
1282
1283 glEnable GL_BLEND;
1284 glEnable GL_TEXTURE_2D;
1285 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1286 1281
1287 if ($GRAB == $self) { 1282 if ($GRAB == $self) {
1288 $self->{fg} = $self->{active_fg}; 1283 $self->{fg} = $self->{active_fg};
1289 } 1284 }
1290 1285
1291 glBindTexture GL_TEXTURE_2D, $tex->{name}; 1286 glEnable GL_BLEND;
1287 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1288 glEnable GL_TEXTURE_2D;
1292 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1289 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1290 glColor 0, 0, 0, 1;
1293 1291
1294 $tex->draw_quad (0, 0, $self->{w}, $self->{h}); 1292 $tex[0]->draw_quad (0, 0, $self->{w}, $self->{h});
1295 1293
1296 glDisable GL_TEXTURE_2D; 1294 glDisable GL_TEXTURE_2D;
1297 glDisable GL_BLEND; 1295 glDisable GL_BLEND;
1298 1296
1299 $self->SUPER::_draw; 1297 $self->SUPER::_draw;
1781 0.1, 0.1, 0.1, 1779 0.1, 0.1, 0.1,
1782 ; 1780 ;
1783 glEnable GL_CONVOLUTION_2D; 1781 glEnable GL_CONVOLUTION_2D;
1784 } 1782 }
1785 1783
1786 my $tex = new CFClient::Texture 1784 $self->{fow_texture} = new CFClient::Texture
1787 w => $w, 1785 w => $w,
1788 h => $h, 1786 h => $h,
1789 data => $data, 1787 data => $data,
1790 internalformat => GL_ALPHA, 1788 internalformat => GL_ALPHA,
1791 format => GL_ALPHA; 1789 format => GL_ALPHA;
1796 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1794 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1797 glEnable GL_TEXTURE_2D; 1795 glEnable GL_TEXTURE_2D;
1798 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 1796 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
1799 1797
1800 glColor +($::CFG->{fow_intensity}) x 3, 1; 1798 glColor +($::CFG->{fow_intensity}) x 3, 1;
1801 $tex->draw_quad (0, 0, $w * 32, $h * 32); 1799 $self->{fow_texture}->draw_quad (0, 0, $w * 32, $h * 32);
1802 1800
1803 glDisable GL_TEXTURE_2D; 1801 glDisable GL_TEXTURE_2D;
1804 glDisable GL_BLEND; 1802 glDisable GL_BLEND;
1805 } 1803 }
1806 1804
1812 glEnable GL_BLEND; 1810 glEnable GL_BLEND;
1813 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1811 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1814 glEnable GL_TEXTURE_2D; 1812 glEnable GL_TEXTURE_2D;
1815 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1813 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1816 1814
1815 $self->{mapmap_texture} =
1817 CFClient::Texture->new ( 1816 new CFClient::Texture
1818 w => $w, 1817 w => $w,
1819 h => $h, 1818 h => $h,
1820 data => $::MAP->mapmap ($w, $h), 1819 data => $::MAP->mapmap ($w, $h),
1821 type => GL_UNSIGNED_INT_8_8_8_8_REV 1820 type => GL_UNSIGNED_INT_8_8_8_8_REV;
1822 )->draw_quad (100, 100); 1821
1822 $self->{mapmap_texture}->draw_quad (100, 100);
1823 1823
1824 glDisable GL_TEXTURE_2D; 1824 glDisable GL_TEXTURE_2D;
1825 glDisable GL_BLEND; 1825 glDisable GL_BLEND;
1826 } 1826 }
1827 # HACK END 1827 # HACK END
2023sub add { 2023sub add {
2024 my ($self, $widget) = @_; 2024 my ($self, $widget) = @_;
2025 2025
2026 $self->SUPER::add ($widget); 2026 $self->SUPER::add ($widget);
2027 2027
2028 $widget->size_allocate ($widget->{x}, $widget->{y}, $widget->size_request); 2028 $widget->size_allocate (int $widget->{x}, int $widget->{y}, $widget->size_request);
2029} 2029}
2030 2030
2031sub on_refresh { 2031sub on_refresh {
2032 my ($self, $id, $cb) = @_; 2032 my ($self, $id, $cb) = @_;
2033 2033

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines