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.96 by root, Fri Apr 14 00:15:52 2006 UTC vs.
Revision 1.101 by elmex, Fri Apr 14 11:43:51 2006 UTC

144 144
145sub focus_in { 145sub focus_in {
146 my ($self) = @_; 146 my ($self) = @_;
147 147
148 return if $FOCUS == $self; 148 return if $FOCUS == $self;
149 return unless $self->{can_focus};
149 150
150 my $focus = $FOCUS; $FOCUS = $self; 151 my $focus = $FOCUS; $FOCUS = $self;
151 $focus->update if $focus; 152 $focus->update if $focus;
152 $FOCUS->update; 153 $FOCUS->update;
153} 154}
186 glPushMatrix; 187 glPushMatrix;
187 glTranslate $self->{x}, $self->{y}, 0; 188 glTranslate $self->{x}, $self->{y}, 0;
188 $self->_draw; 189 $self->_draw;
189 glPopMatrix; 190 glPopMatrix;
190 191
191 if ($self == $HOVER) { 192 if ($self == $HOVER && $self->{can_hover}) {
192 my ($x, $y) = @$self{qw(x y)}; 193 my ($x, $y) = @$self{qw(x y)};
193 194
194 glColor 0, 0, 1, 0.2; 195 glColor 0, 0, 1, 0.2;
195 glEnable GL_BLEND; 196 glEnable GL_BLEND;
196 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 197 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
529 530
530my @tex = 531my @tex =
531 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 532 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
532 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); 533 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png);
533 534
535sub new {
536 my $class = shift;
537
538 # TODO: user_x, user_y, overwrite moveto?
539
540 $class->SUPER::new (
541 bg => [1, 1, 1, 1],
542 border_bg => [1, 1, 1, 1],
543 border => $::FONTSIZE * 0.8,
544 @_
545 )
546}
547
534sub size_request { 548sub size_request {
535 my ($self) = @_; 549 my ($self) = @_;
536 550
537 return ($self->{user_w}, $self->{user_h}) if $self->{user_w} && $self->{user_h}; 551 return ($self->{user_w}, $self->{user_h}) if $self->{user_w} && $self->{user_h};
538 552
539 my ($w, $h) = $self->SUPER::size_request; 553 my ($w, $h) = $self->SUPER::size_request;
540 554
541 $h += $tex[1]->{h}; 555 (
542 $h += $tex[4]->{h}; 556 $w + $self->{border} * 2,
543 $w += $tex[2]->{w}; 557 $h + $self->{border} * 2,
544 $w += $tex[3]->{w}; 558 )
545
546 ($w, $h)
547} 559}
548 560
549sub size_allocate { 561sub size_allocate {
550 my ($self, $x, $y, $w, $h) = @_; 562 my ($self, $x, $y, $w, $h) = @_;
551 563
552 $self->_size_allocate ($x, $y, $w, $h) or return; 564 $self->_size_allocate ($x, $y, $w, $h) or return;
553 565
554 $h -= $tex[1]{h}; 566 $h -= List::Util::max 0, $self->{border} * 2;
555 $h -= $tex[4]{h}; 567 $w -= List::Util::max 0, $self->{border} * 2;
556 $w -= $tex[2]{w};
557 $w -= $tex[3]{w};
558 568
559 $h = $h < 0 ? 0 : $h; 569 $self->child->size_allocate ($self->{border}, $self->{border}, $w, $h);
560 $w = $w < 0 ? 0 : $w;
561
562 my $child = $self->child;
563
564 $child->size_allocate ($tex[3]->{w}, $tex[1]->{h}, $w, $h);
565} 570}
566 571
567sub button_down { 572sub button_down {
568 my ($self, $ev, $x, $y) = @_; 573 my ($self, $ev, $x, $y) = @_;
569 574
570 if ($x < $self->{w} && $x >= $self->{w} - $tex[2]{w} 575 if ($x < $self->{w} && $x >= $self->{w} - $self->{border}
571 && $y < $self->{h} && $y >= $self->{h} - $tex[4]{h}) { 576 && $y < $self->{h} && $y >= $self->{h} - $self->{border}) {
572 577
573 my ($ox, $oy) = ($ev->button_x, $ev->button_y); 578 my ($ox, $oy) = ($ev->button_x, $ev->button_y);
574 my ($bw, $bh) = ($self->{w}, $self->{h}); 579 my ($bw, $bh) = ($self->{w}, $self->{h});
575 580
576 $self->{motion} = sub { 581 $self->{motion} = sub {
582 $self->{user_h} = $bh + $y - $oy; 587 $self->{user_h} = $bh + $y - $oy;
583 $self->update; 588 $self->update;
584 }; 589 };
585 590
586 } elsif ($x >= 0 && $x < $self->{w} 591 } elsif ($x >= 0 && $x < $self->{w}
587 && $y >= 0 && $y < $tex[1]{h}) { 592 && $y >= 0 && $y < $self->{border}) {
588 593
589 my ($ox, $oy) = ($ev->button_x, $ev->button_y); 594 my ($ox, $oy) = ($ev->button_x, $ev->button_y);
590 my ($bx, $by) = ($self->{x}, $self->{y}); 595 my ($bx, $by) = ($self->{x}, $self->{y});
591 596
592 $self->{motion} = sub { 597 $self->{motion} = sub {
613} 618}
614 619
615sub _draw { 620sub _draw {
616 my ($self) = @_; 621 my ($self) = @_;
617 622
618 my ($w, $h) = ($self->{w}, $self->{h}); 623 my ($w, $h ) = ($self->{w}, $self->{h});
619 my ($cw, $ch) = ($self->child->{w}, $self->child->{h}); 624 my ($cw, $ch) = ($self->child->{w}, $self->child->{h});
620 625
621 glEnable GL_BLEND; 626 glEnable GL_BLEND;
622 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 627 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
623 glEnable GL_TEXTURE_2D; 628 glEnable GL_TEXTURE_2D;
624 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 629 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
625 630
626 my $top = $tex[1]; 631 glColor @{ $self->{border_bg} };
627 $top->draw_quad (0, 0, $w, $top->{h}); 632 $tex[1]->draw_quad (0, 0, $w, $self->{border});
628 633 $tex[3]->draw_quad (0, $self->{border}, $self->{border}, $ch);
629 my $left = $tex[3]; 634 $tex[2]->draw_quad ($w - $self->{border}, $self->{border}, $self->{border}, $ch);
630 $left->draw_quad (0, $top->{h}, $left->{w}, $ch); 635 $tex[4]->draw_quad (0, $h - $self->{border}, $w, $self->{border});
631
632 my $right = $tex[2];
633 $right->draw_quad ($w - $right->{w}, $top->{h}, $right->{w}, $ch);
634
635 my $bottom = $tex[4];
636 $bottom->draw_quad (0, $h - $bottom->{h}, $w, $bottom->{h});
637 636
638 my $bg = $tex[0]; 637 my $bg = $tex[0];
639 638
640 glBindTexture GL_TEXTURE_2D, $bg->{name}; 639 # TODO: repeat texture not scale
641 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
642
643 my $rep_x = $cw / $bg->{w}; 640 my $rep_x = $cw / $bg->{w};
644 my $rep_y = $ch / $bg->{h}; 641 my $rep_y = $ch / $bg->{h};
645 642
643 glColor @{ $self->{bg} };
644
645 $bg->{s} = $rep_x;
646 $bg->{t} = $rep_y;
647 $bg->{wrap_mode} = 1;
646 $bg->draw_quad ($left->{w}, $top->{h}, $cw, $ch); 648 $bg->draw_quad ($self->{border}, $self->{border}, $cw, $ch);
647 649
648 glDisable GL_TEXTURE_2D; 650 glDisable GL_TEXTURE_2D;
649 glDisable GL_BLEND; 651 glDisable GL_BLEND;
650 652
651 $self->child->draw; 653 $self->child->draw;
652
653} 654}
654 655
655############################################################################# 656#############################################################################
656 657
657package CFClient::UI::Table; 658package CFClient::UI::Table;
993 my $x = 994 my $x =
994 $self->{align} < 0 ? $self->{padding} 995 $self->{align} < 0 ? $self->{padding}
995 : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} 996 : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding}
996 : ($self->{w} - $tex->{w}) * 0.5; 997 : ($self->{w} - $tex->{w}) * 0.5;
997 998
998 glTranslate $x, ($self->{h} - $tex->{h}) * 0.5, 0; 999 glTranslate int $x, int +($self->{h} - $tex->{h}) * 0.5, 0;
999 $tex->draw_quad (0, 0); 1000 $tex->draw_quad (0, 0);
1000 1001
1001 glDisable GL_TEXTURE_2D; 1002 glDisable GL_TEXTURE_2D;
1002 glDisable GL_BLEND; 1003 glDisable GL_BLEND;
1003} 1004}
1017 $class->SUPER::new ( 1018 $class->SUPER::new (
1018 fg => [1, 1, 1], 1019 fg => [1, 1, 1],
1019 bg => [0, 0, 0, 0.2], 1020 bg => [0, 0, 0, 0.2],
1020 active_bg => [1, 1, 1, 0.5], 1021 active_bg => [1, 1, 1, 0.5],
1021 active_fg => [0, 0, 0], 1022 active_fg => [0, 0, 0],
1023 can_hover => 1,
1024 can_focus => 1,
1022 @_ 1025 @_
1023 ) 1026 )
1024} 1027}
1025 1028
1026sub _set_text { 1029sub _set_text {
1027 my ($self, $text) = @_; 1030 my ($self, $text) = @_;
1031
1032 my $old_text = $self->{text};
1028 1033
1029 $self->{last_activity} = $::NOW; 1034 $self->{last_activity} = $::NOW;
1030 1035
1031 $self->{text} = $text; 1036 $self->{text} = $text;
1032 $self->{layout}->set_width ($self->{w}); 1037 $self->{layout}->set_width ($self->{w});
1038 1043
1039 $text = substr $text, 0, $self->{cursor}; 1044 $text = substr $text, 0, $self->{cursor};
1040 utf8::encode $text; 1045 utf8::encode $text;
1041 1046
1042 @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text); 1047 @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text);
1048
1049 $self->emit (changed => $self->{text}) # XXX: is this the right place to do this?
1050 if $old_text ne $self->{text};
1043} 1051}
1044 1052
1045sub size_request { 1053sub size_request {
1046 my ($self) = @_; 1054 my ($self) = @_;
1047 1055
1086 ++$self->{cursor} if $self->{cursor} < length $self->{text}; 1094 ++$self->{cursor} if $self->{cursor} < length $self->{text};
1087 } elsif ($sym == SDLK_HOME) { 1095 } elsif ($sym == SDLK_HOME) {
1088 $self->{cursor} = 0; 1096 $self->{cursor} = 0;
1089 } elsif ($sym == SDLK_END) { 1097 } elsif ($sym == SDLK_END) {
1090 $self->{cursor} = length $text; 1098 $self->{cursor} = length $text;
1099 } elsif ($sym == SDLK_ESCAPE) {
1100 $self->emit ('escape');
1091 } elsif ($uni) { 1101 } elsif ($uni) {
1092 substr $text, $self->{cursor}++, 0, chr $uni; 1102 substr $text, $self->{cursor}++, 0, chr $uni;
1093 } 1103 }
1094 1104
1095 $self->_set_text ($text); 1105 $self->_set_text ($text);
1157 glVertex $self->{cur_x}, $self->{cur_y} + $self->{cur_h}; 1167 glVertex $self->{cur_x}, $self->{cur_y} + $self->{cur_h};
1158 glEnd; 1168 glEnd;
1159 } 1169 }
1160} 1170}
1161 1171
1172package CFClient::UI::LineEntry;
1173
1174our @ISA = CFClient::UI::Entry::;
1175
1176use SDL;
1177use SDL::OpenGL;
1178
1179sub key_down {
1180 my ($self, $ev) = @_;
1181
1182 my $sym = $ev->key_sym;
1183
1184 if ($sym == SDLK_RETURN) {
1185 $self->emit (activate => $self->get_text);
1186 $self->update;
1187
1188 } else {
1189 $self->SUPER::key_down ($ev);
1190 }
1191
1192}
1193
1162############################################################################# 1194#############################################################################
1163 1195
1164package CFClient::UI::Button; 1196package CFClient::UI::Button;
1165 1197
1166our @ISA = CFClient::UI::Label::; 1198our @ISA = CFClient::UI::Label::;
1178 $class->SUPER::new ( 1210 $class->SUPER::new (
1179 padding => 4, 1211 padding => 4,
1180 fg => [1, 1, 1], 1212 fg => [1, 1, 1],
1181 bg => [1, 1, 1, 0.2], 1213 bg => [1, 1, 1, 0.2],
1182 active_fg => [1, 1, 0], 1214 active_fg => [1, 1, 0],
1183# active_bg => [0, 0, 0, 0.5], 1215 can_hover => 1,
1184# border_fg => [1, 1, 0],
1185 @_ 1216 @_
1186 ) 1217 )
1187} 1218}
1188 1219
1189sub button_up { 1220sub button_up {
1235 $class->SUPER::new ( 1266 $class->SUPER::new (
1236 padding => 2, 1267 padding => 2,
1237 fg => [1, 1, 1], 1268 fg => [1, 1, 1],
1238 active_fg => [1, 1, 0], 1269 active_fg => [1, 1, 0],
1239 state => 0, 1270 state => 0,
1271 can_hover => 1,
1240 @_ 1272 @_
1241 ) 1273 )
1242} 1274}
1243 1275
1244sub size_request { 1276sub size_request {
1299 1331
1300use SDL::OpenGL; 1332use SDL::OpenGL;
1301 1333
1302our @ISA = CFClient::UI::DrawBG::; 1334our @ISA = CFClient::UI::DrawBG::;
1303 1335
1336my @tex =
1337 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1338 qw(s1_slider.png s1_slider_bg.png);
1339
1304sub new { 1340sub new {
1305 my $class = shift; 1341 my $class = shift;
1306 1342
1307 # range [value, low, high, page] 1343 # range [value, low, high, page]
1308 1344
1345 # TODO: 0-width page
1346 # TODO: req_w/h are wrong with vertical
1347 # TODO: calculations are off
1309 my $self = $class->SUPER::new ( 1348 my $self = $class->SUPER::new (
1310 fg => [1, 1, 1], 1349 fg => [1, 1, 1],
1311 active_fg => [0, 0, 0], 1350 active_fg => [0, 0, 0],
1312 range => [0, 0, 100, 10], 1351 range => [0, 0, 100, 10],
1313 req_w => 40, 1352 req_w => 40,
1314 req_h => 10, 1353 req_h => 13,
1315 vertical => 0, 1354 vertical => 0,
1355 can_hover => 1,
1316 @_ 1356 @_
1317 ); 1357 );
1318 1358
1319 $self 1359 $self
1320} 1360}
1372 my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg}; 1412 my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg};
1373 my $bg = $FOCUS == $self ? $self->{active_bg} : $self->{bg}; 1413 my $bg = $FOCUS == $self ? $self->{active_bg} : $self->{bg};
1374 1414
1375 my ($value, $lo, $hi, $page) = @{$self->{range}}; 1415 my ($value, $lo, $hi, $page) = @{$self->{range}};
1376 1416
1417 # the inner_* stuff is for generating a padding for the slider handle,
1418 # so that the handle doesn't leave the texture. This calculation isn't 100%
1419 # correct propably, but it does the job for now
1420 my $inner_pad = 5; # 5% of width for slider bg texture border
1421 my $inner_pad_px = ($w / 100) * $inner_pad; # % to pixels
1422 my $inner_w = $w - $inner_pad_px * 2; # * 2 for left & right
1423
1377 $page = int $page * $w / ($hi - $lo); 1424 $page = int $page * $inner_w / ($hi - $lo);
1378 $value = int +($value - $lo) * $w / ($hi - $lo); 1425 $value = int +($value - $lo) * $inner_w / ($hi - $lo);
1379 1426
1380 $w -= $page; 1427 $w -= $page;
1381 $page &= ~1; 1428 $page &= ~1;
1382 glTranslate $page * 0.5, 0, 0; 1429 glTranslate $page * 0.5, 0, 0;
1383 $page ||= 2; 1430 $page ||= 2;
1384 1431
1385 glColor @$fg;
1386 glBegin GL_LINES;
1387 glVertex 0, 0; glVertex 0, $h;
1388 glVertex $w - 1, 0; glVertex $w - 1, $h;
1389 glVertex 0, $h * 0.5; glVertex $w, $h * 0.5;
1390 glEnd;
1391
1392 my $knob_a = $value - $page * 0.5; 1432 my $knob_a = $inner_pad_px + ($value - $page * 0.5);
1393 my $knob_b = $value + $page * 0.5; 1433 my $knob_b = $inner_pad_px + ($value + $page * 0.5);
1394 1434
1395 glBegin GL_QUADS; 1435 glEnable GL_BLEND;
1396 glColor @$fg; 1436 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1397 glVertex $knob_a, 0; 1437 glEnable GL_TEXTURE_2D;
1398 glVertex $knob_a, $h; 1438 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1399 glVertex $knob_b, $h;
1400 glVertex $knob_b, 0;
1401 1439
1402 if ($knob_a < $knob_b - 2) { 1440 # draw background
1403 glColor @$bg; 1441 $tex[1]->draw_quad (0, 0, $w, $h);
1404 glVertex $knob_a + 1, 1; 1442
1405 glVertex $knob_a + 1, $h - 1; 1443 # draw handle
1406 glVertex $knob_b - 1, $h - 1; 1444 $tex[0]->draw_quad ($knob_a, 0, $knob_b - $knob_a, $h);
1407 glVertex $knob_b - 1, 1; 1445
1446 glDisable GL_BLEND;
1447 glDisable GL_TEXTURE_2D;
1448}
1449
1450#############################################################################
1451
1452package CFClient::UI::TextView;
1453
1454our @ISA = CFClient::UI::HBox::;
1455
1456use SDL::OpenGL;
1457
1458sub new {
1459 my $class = shift;
1460
1461 my $self = $class->SUPER::new (
1462 par => [],
1463 @_,
1464 children => [
1465 (new CFClient::UI::Empty expand => 1),
1466 (new CFClient::UI::Slider vertical => 1),
1467 ],
1468 );
1469
1470 $self
1471}
1472
1473sub add_paragraph {
1474 my ($self, $color, $text) = @_;
1475
1476 push @{$self->{par}}, [$color, $text];
1477 my $count = scalar @{$self->{par}};
1478 $self->{children}[1]{range} = [$count - 1, 0, $count, 1];
1479 $self->{children}[1]->update;
1480}
1481
1482sub _draw {
1483 my ($self) = @_;
1484
1485 my $par = $self->{par};
1486
1487 my $bottom = (scalar @$par) - 1;
1488
1489 my $w = $self->{children}[0]{w};
1490 my $y = $self->{h};
1491
1492 glEnable GL_BLEND;
1493 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1494 glEnable GL_TEXTURE_2D;
1495 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
1496
1497 # TODO: everything!
1498 while ($y > 0 && $bottom >= 0) {
1499 my $par = $par->[$bottom--];
1500
1501 my $layout = new CFClient::Layout;
1502
1503 $layout->set_height ($::FONTSIZE);
1504 $layout->set_width ($w);
1505 $layout->set_text ($par->[1]);
1506 my $tex = new_from_layout CFClient::Texture $layout;
1507 $y -= $tex->{h};
1508
1509 glColor @{ $par->[0] };
1510 $tex->draw_quad (0, $y);
1408 } 1511 }
1409 glEnd; 1512
1513 glDisable GL_TEXTURE_2D;
1514 glDisable GL_BLEND;
1410} 1515}
1411 1516
1412############################################################################# 1517#############################################################################
1413 1518
1414package CFClient::UI::MapWidget; 1519package CFClient::UI::MapWidget;
1424 1529
1425sub new { 1530sub new {
1426 my $class = shift; 1531 my $class = shift;
1427 1532
1428 $class->SUPER::new ( 1533 $class->SUPER::new (
1429 z => -1, 1534 z => -1,
1535 can_focus => 1,
1430 list => (glGenLists 1), 1536 list => (glGenLists 1),
1431 @_ 1537 @_
1432 ) 1538 )
1433} 1539}
1434 1540
1435sub key_down { 1541sub key_down {
1507 } 1613 }
1508 1614
1509 glCallList $self->{list}; 1615 glCallList $self->{list};
1510 1616
1511 if ($FOCUS != $self) { 1617 if ($FOCUS != $self) {
1512 glEnable GL_BLEND; 1618 glColor 64/255, 64/255, 64/255;
1513 glColor 0, 0, 1, 0.4; 1619 glLogicOp GL_AND;
1620 glEnable GL_COLOR_LOGIC_OP;
1514 glBegin GL_QUADS; 1621 glBegin GL_QUADS;
1515 glVertex 0, 0; 1622 glVertex 0, 0;
1516 glVertex 0, $::HEIGHT; 1623 glVertex 0, $::HEIGHT;
1517 glVertex $::WIDTH, $::HEIGHT; 1624 glVertex $::WIDTH, $::HEIGHT;
1518 glVertex $::WIDTH, 0; 1625 glVertex $::WIDTH, 0;
1519 glEnd; 1626 glEnd;
1520 glDisable GL_BLEND; 1627 glDisable GL_COLOR_LOGIC_OP;
1521 } 1628 }
1522} 1629}
1523 1630
1524my %DIR = ( 1631my %DIR = (
1525 SDLK_KP8, [1, "north"], 1632 SDLK_KP8, [1, "north"],
1545 1652
1546 if ($sym == SDLK_KP5) { 1653 if ($sym == SDLK_KP5) {
1547 $::CONN->user_send ("command stay fire"); 1654 $::CONN->user_send ("command stay fire");
1548 } elsif ($sym == SDLK_a) { 1655 } elsif ($sym == SDLK_a) {
1549 $::CONN->user_send ("command apply"); 1656 $::CONN->user_send ("command apply");
1657 } elsif ($sym == SDLK_QUOTE) {
1658 $self->emit ('activate_console');
1550 } elsif (exists $DIR{$sym}) { 1659 } elsif (exists $DIR{$sym}) {
1551 if ($mod & KMOD_SHIFT) { 1660 if ($mod & KMOD_SHIFT) {
1552 $self->{shft}++; 1661 $self->{shft}++;
1553 $::CONN->user_send ("command fire $DIR{$sym}[0]"); 1662 $::CONN->user_send ("command fire $DIR{$sym}[0]");
1554 } elsif ($mod & KMOD_CTRL) { 1663 } elsif ($mod & KMOD_CTRL) {
1640} 1749}
1641 1750
1642sub toggle_flopper { 1751sub toggle_flopper {
1643 my ($self) = @_; 1752 my ($self) = @_;
1644 1753
1754 # TODO: use animation
1645 if ($self->{state} = !$self->{state}) { 1755 if ($self->{state} = !$self->{state}) {
1646 $CFClient::UI::TOPLEVEL->add ($self->{other}); 1756 $CFClient::UI::TOPLEVEL->add ($self->{other});
1647 $self->{other}->move ( 1757 $self->{other}->move (
1648 ($::WIDTH - $self->{other}{w}) * 0.5, 1758 ($::WIDTH - $self->{other}{w}) * 0.5,
1649 ($::HEIGHT - $self->{other}{h}) * 0.5, 1759 ($::HEIGHT - $self->{other}{h}) * 0.5,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines