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.28 by root, Sun Apr 9 00:06:10 2006 UTC vs.
Revision 1.30 by root, Sun Apr 9 00:18:45 2006 UTC

148} 148}
149 149
150sub _draw { 150sub _draw {
151 my ($self) = @_; 151 my ($self) = @_;
152 152
153 my ($w, $h) = $self->size_request;#TODO# use widht/height of texture 153 my ($w, $h) = $self->size_request;#TODO# use width/height of texture
154
154 my $tex = $self->{texture} 155 my $tex = $self->{texture}
155 or return; 156 or return;
156 157
157 glEnable GL_BLEND; 158 glEnable GL_BLEND;
158 glEnable GL_TEXTURE_2D; 159 glEnable GL_TEXTURE_2D;
180 181
181sub size_request { 182sub size_request {
182 my ($self) = @_; 183 my ($self) = @_;
183 my $chld = $self->get 184 my $chld = $self->get
184 or return (0, 0); 185 or return (0, 0);
186
187 $chld->move (2, 2);
188
185 map { $_ + 4 } $chld->size_request; 189 map { $_ + 4 } $chld->size_request;
186} 190}
187 191
188sub _draw { 192sub _draw {
189 my ($self) = @_; 193 my ($self) = @_;
190 194
191 my $chld = $self->get; 195 my $chld = $self->get;
192 196
193 $chld->move (2, 2, 0); #TODO:move to size_request
194
195 my ($w, $h) = $chld->size_request; 197 my ($w, $h) = $chld->size_request;
196 198
197 glColor 1, 0, 0;
198 glBegin GL_QUADS; 199 glBegin GL_QUADS;
200 glColor 0, 0, 0;
199 glTexCoord 0, 0; glVertex 0 , 0; 201 glTexCoord 0, 0; glVertex 0 , 0;
200 glTexCoord 0, 1; glVertex 0 , $h + 4; 202 glTexCoord 0, 1; glVertex 0 , $h + 4;
201 glTexCoord 1, 1; glVertex $w + 4 , $h + 4; 203 glTexCoord 1, 1; glVertex $w + 4 , $h + 4;
202 glTexCoord 1, 0; glVertex $w + 4 , 0; 204 glTexCoord 1, 0; glVertex $w + 4 , 0;
203 glEnd; 205 glEnd;
366 368
367 my $tex = $self->{texture}; 369 my $tex = $self->{texture};
368 370
369 glEnable GL_BLEND; 371 glEnable GL_BLEND;
370 glEnable GL_TEXTURE_2D; 372 glEnable GL_TEXTURE_2D;
373 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
371 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 374 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
372 glBindTexture GL_TEXTURE_2D, $tex->{name}; 375 glBindTexture GL_TEXTURE_2D, $tex->{name};
373 376
374 glColor 1, 0, 1; 377 glColor 1, 1, 1, 0.8;
375 378
376 glBegin GL_QUADS; 379 glBegin GL_QUADS;
377 glTexCoord 0, 0; glVertex 0 , 0; 380 glTexCoord 0, 0; glVertex 0 , 0;
378 glTexCoord 0, 1; glVertex 0 , $tex->{height}; 381 glTexCoord 0, 1; glVertex 0 , $tex->{height};
379 glTexCoord 1, 1; glVertex $tex->{width}, $tex->{height}; 382 glTexCoord 1, 1; glVertex $tex->{width}, $tex->{height};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines