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.26 by elmex, Sat Apr 8 22:23:57 2006 UTC vs.
Revision 1.28 by root, Sun Apr 9 00:06:10 2006 UTC

327our @ISA = Crossfire::Client::Widget::; 327our @ISA = Crossfire::Client::Widget::;
328 328
329use SDL::OpenGL; 329use SDL::OpenGL;
330 330
331sub new { 331sub new {
332 my ($class, $x, $y, $z, $ttf, $text) = @_; 332 my ($class, $x, $y, $z, $height, $text) = @_;
333 333
334 my $self = $class->SUPER::new (x => $x, y => $y, z => $z, ttf => $ttf); 334 my $self = $class->SUPER::new (x => $x, y => $y, z => $z, height => $height);
335 335
336 $self->set_text ($text); 336 $self->set_text ($text);
337 337
338 $self 338 $self
339} 339}
340 340
341sub set_text { 341sub set_text {
342 my ($self, $text) = @_; 342 my ($self, $text) = @_;
343
344 $self->{text} = $text;
345
343 $self->{texture} = new_from_ttf Crossfire::Client::Texture $self->{ttf}, $self->{text} = $text; 346 $self->{texture} = new_from_text Crossfire::Client::Texture $text, $self->{height};
344} 347}
345 348
346sub get_text { 349sub get_text {
347 my ($self, $text) = @_; 350 my ($self, $text) = @_;
351
348 $self->{text} 352 $self->{text}
349} 353}
350 354
351sub size_request { 355sub size_request {
352 my ($self) = @_; 356 my ($self) = @_;
362 366
363 my $tex = $self->{texture}; 367 my $tex = $self->{texture};
364 368
365 glEnable GL_BLEND; 369 glEnable GL_BLEND;
366 glEnable GL_TEXTURE_2D; 370 glEnable GL_TEXTURE_2D;
367 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;#DECAL; 371 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
368 glBindTexture GL_TEXTURE_2D, $tex->{name}; 372 glBindTexture GL_TEXTURE_2D, $tex->{name};
369 373
370 glColor 1, 0, 1; 374 glColor 1, 0, 1;
371 375
372 glBegin GL_QUADS; 376 glBegin GL_QUADS;
430 434
431 my $sw = 1 + int $::WIDTH / 32; 435 my $sw = 1 + int $::WIDTH / 32;
432 my $sh = 1 + int $::HEIGHT / 32; 436 my $sh = 1 + int $::HEIGHT / 32;
433 437
434 if ($::CONN->{mapw} > $sw) { 438 if ($::CONN->{mapw} > $sw) {
435 $xofs = ($sw - $::CONN->{mapw}) * 0.5; 439 $xofs = $mx + ($::CONN->{mapw} - $sw) * 0.5;
436 } else { 440 } else {
437 $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs}; 441 $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs};
438 } 442 }
439 443
440 if ($::CONN->{maph} > $sh) { 444 if ($::CONN->{maph} > $sh) {
441 $yofs = ($sh - $::CONN->{maph}) * 0.5; 445 $yofs = $my + ($::CONN->{maph} - $sh) * 0.5;
442 } else { 446 } else {
443 $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs}; 447 $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs};
444 } 448 }
445 449
446 glEnable GL_TEXTURE_2D; 450 glEnable GL_TEXTURE_2D;
447 glEnable GL_BLEND; 451 glEnable GL_BLEND;
448 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 452 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
449
450 warn "<$mx,$my> <$xofs,$yofs>\n";#d#
451 453
452 for my $x (0 .. $sw - 1) { 454 for my $x (0 .. $sw - 1) {
453 for my $y (0 .. $sh - 1) { 455 for my $y (0 .. $sh - 1) {
454 456
455 my $cell = $map->[$x + $xofs][$y + $yofs] 457 my $cell = $map->[$x + $xofs][$y + $yofs]

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines