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.136 by root, Wed Apr 19 20:46:44 2006 UTC vs.
Revision 1.142 by elmex, Thu Apr 20 16:29:40 2006 UTC

21 $FOCUS->key_up ($_[0]) if $FOCUS; 21 $FOCUS->key_up ($_[0]) if $FOCUS;
22} 22}
23 23
24sub feed_sdl_button_down_event { 24sub feed_sdl_button_down_event {
25 my ($ev) = @_; 25 my ($ev) = @_;
26 my ($x, $y) = ($ev->motion_x, $ev->motion_y); 26 my ($x, $y) = ($ev->{x}, $ev->{y});
27 27
28 if (!$BUTTON_STATE) { 28 if (!$BUTTON_STATE) {
29 my $widget = $ROOT->find_widget ($x, $y); 29 my $widget = $ROOT->find_widget ($x, $y);
30 30
31 $GRAB = $widget; 31 $GRAB = $widget;
32 $GRAB->update if $GRAB; 32 $GRAB->update if $GRAB;
33 } 33 }
34 34
35 $BUTTON_STATE |= 1 << ($ev->button - 1); 35 $BUTTON_STATE |= 1 << ($ev->{button} - 1);
36 36
37 $GRAB->button_down ($ev, $GRAB->coord2local ($x, $y)) if $GRAB; 37 $GRAB->button_down ($ev, $GRAB->coord2local ($x, $y)) if $GRAB;
38} 38}
39 39
40sub feed_sdl_button_up_event { 40sub feed_sdl_button_up_event {
41 my ($ev) = @_; 41 my ($ev) = @_;
42 my ($x, $y) = ($ev->motion_x, $ev->motion_y); 42 my ($x, $y) = ($ev->{x}, $ev->{y});
43 43
44 my $widget = $GRAB || $ROOT->find_widget ($x, $y); 44 my $widget = $GRAB || $ROOT->find_widget ($x, $y);
45 45
46 $BUTTON_STATE &= ~(1 << ($ev->button - 1)); 46 $BUTTON_STATE &= ~(1 << ($ev->{button} - 1));
47 47
48 $GRAB->button_up ($ev, $GRAB->coord2local ($x, $y)) if $GRAB; 48 $GRAB->button_up ($ev, $GRAB->coord2local ($x, $y)) if $GRAB;
49 49
50 if (!$BUTTON_STATE) { 50 if (!$BUTTON_STATE) {
51 my $grab = $GRAB; undef $GRAB; 51 my $grab = $GRAB; undef $GRAB;
54 } 54 }
55} 55}
56 56
57sub feed_sdl_motion_event { 57sub feed_sdl_motion_event {
58 my ($ev) = @_; 58 my ($ev) = @_;
59 my ($x, $y) = ($ev->motion_x, $ev->motion_y); 59 my ($x, $y) = ($ev->{x}, $ev->{y});
60 60
61 my $widget = $GRAB || $ROOT->find_widget ($x, $y); 61 my $widget = $GRAB || $ROOT->find_widget ($x, $y);
62 62
63 if ($widget != $HOVER) { 63 if ($widget != $HOVER) {
64 my $hover = $HOVER; $HOVER = $widget; 64 my $hover = $HOVER; $HOVER = $widget;
87 87
88package CFClient::UI::Base; 88package CFClient::UI::Base;
89 89
90use strict; 90use strict;
91 91
92use SDL::OpenGL; 92use CFClient::OpenGL;
93 93
94sub new { 94sub new {
95 my $class = shift; 95 my $class = shift;
96 96
97 my $self = bless { 97 my $self = bless {
146} 146}
147 147
148sub configure { 148sub configure {
149 my ($self, $x, $y, $w, $h) = @_; 149 my ($self, $x, $y, $w, $h) = @_;
150 150
151 if ($self->{aspect}) {
152 my $w2 = List::Util::min $w, int $h * $self->{aspect};
153 my $h2 = List::Util::min $h, int $w / $self->{aspect};
154
155 # use alignment to adjust x, y
156
157 $x += ($w - $w2) * 0.5;
158 $y += ($h - $h2) * 0.5;
159
160 ($w, $h) = ($w2, $h2);
161 }
162
163 if ($self->{x} != $x || $self->{y} != $y) {
151 $self->{x} = $x; 164 $self->{x} = $x;
152 $self->{y} = $y; 165 $self->{y} = $y;
166 $self->update;
167 }
153 168
154 return unless $self->{w} != $w || $self->{h} != $h; 169 if ($self->{w} != $w || $self->{h} != $h) {
155
156 $self->{w} = $w; 170 $self->{w} = $w;
157 $self->{h} = $h; 171 $self->{h} = $h;
158 172
159 $self->size_allocate ($w, $h); 173 $self->size_allocate ($w, $h);
160 $self->update; 174 $self->update;
175 }
161} 176}
162 177
163sub size_allocate { 178sub size_allocate {
164 # nothing to be done 179 # nothing to be done
165} 180}
324package CFClient::UI::DrawBG; 339package CFClient::UI::DrawBG;
325 340
326our @ISA = CFClient::UI::Base::; 341our @ISA = CFClient::UI::Base::;
327 342
328use strict; 343use strict;
329use SDL::OpenGL; 344use CFClient::OpenGL;
330 345
331sub new { 346sub new {
332 my $class = shift; 347 my $class = shift;
333 348
334 # range [value, low, high, page] 349 # range [value, low, high, page]
482 497
483package CFClient::UI::Window; 498package CFClient::UI::Window;
484 499
485our @ISA = CFClient::UI::Bin::; 500our @ISA = CFClient::UI::Bin::;
486 501
487use SDL::OpenGL; 502use CFClient::OpenGL;
488 503
489sub new { 504sub new {
490 my ($class, %arg) = @_; 505 my ($class, %arg) = @_;
491 506
492 my $self = $class->SUPER::new (%arg); 507 my $self = $class->SUPER::new (%arg);
565 580
566package CFClient::UI::Frame; 581package CFClient::UI::Frame;
567 582
568our @ISA = CFClient::UI::Bin::; 583our @ISA = CFClient::UI::Bin::;
569 584
570use SDL::OpenGL; 585use CFClient::OpenGL;
571 586
572sub size_request { 587sub size_request {
573 my ($self) = @_; 588 my ($self) = @_;
574 my $chld = $self->child 589 my $chld = $self->child
575 or return (0, 0); 590 or return (0, 0);
607 622
608package CFClient::UI::FancyFrame; 623package CFClient::UI::FancyFrame;
609 624
610our @ISA = CFClient::UI::Bin::; 625our @ISA = CFClient::UI::Bin::;
611 626
612use SDL::OpenGL; 627use CFClient::OpenGL;
613 628
614my @tex = 629my @tex =
615 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 630 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
616 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); 631 qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png);
617 632
618sub new { 633sub new {
619 my $class = shift; 634 my $class = shift;
620 635
621 # TODO: user_x, user_y, overwrite moveto? 636 # TODO: user_x, user_y, overwrite moveto?
622 637
623 $class->SUPER::new ( 638 my $self = $class->SUPER::new (
624 bg => [1, 1, 1, 1], 639 bg => [1, 1, 1, 1],
625 border_bg => [1, 1, 1, 1], 640 border_bg => [1, 1, 1, 1],
626 border => 0.8, 641 border => 0.8,
627 @_ 642 @_
628 ) 643 );
644
645 $self->{title} &&= new CFClient::UI::Label
646 align => 0,
647 valign => 1,
648 text => $self->{title},
649 fontsize => 1;
650
651 $self
629} 652}
630 653
631sub border { 654sub border {
632 int $_[0]{border} * $::FONTSIZE 655 int $_[0]{border} * $::FONTSIZE
633} 656}
649 my ($self, $w, $h) = @_; 672 my ($self, $w, $h) = @_;
650 673
651 $h -= List::Util::max 0, $self->border * 2; 674 $h -= List::Util::max 0, $self->border * 2;
652 $w -= List::Util::max 0, $self->border * 2; 675 $w -= List::Util::max 0, $self->border * 2;
653 676
677 $self->{title}->configure ($self->border, $self->border - $::FONTSIZE * 2, $w, $::FONTSIZE * 2)
678 if $self->{title};
679
654 $self->child->configure ($self->border, $self->border, $w, $h); 680 $self->child->configure ($self->border, $self->border, $w, $h);
655} 681}
656 682
657sub button_down { 683sub button_down {
658 my ($self, $ev, $x, $y) = @_; 684 my ($self, $ev, $x, $y) = @_;
660 my $border = $self->border; 686 my $border = $self->border;
661 687
662 if ($x < $self->{w} && $x >= $self->{w} - $border 688 if ($x < $self->{w} && $x >= $self->{w} - $border
663 && $y < $self->{h} && $y >= $self->{h} - $border) { 689 && $y < $self->{h} && $y >= $self->{h} - $border) {
664 690
665 my ($ox, $oy) = ($ev->button_x, $ev->button_y); 691 my ($ox, $oy) = ($ev->{x}, $ev->{y});
666 my ($bw, $bh) = ($self->{w}, $self->{h}); 692 my ($bw, $bh) = ($self->{w}, $self->{h});
667 693
668 $self->{motion} = sub { 694 $self->{motion} = sub {
669 my ($ev, $x, $y) = @_; 695 my ($ev, $x, $y) = @_;
670 696
671 ($x, $y) = ($ev->motion_x, $ev->motion_y); 697 ($x, $y) = ($ev->{x}, $ev->{y});
672 698
673 $self->{user_w} = $bw + $x - $ox; 699 $self->{user_w} = $bw + $x - $ox;
674 $self->{user_h} = $bh + $y - $oy; 700 $self->{user_h} = $bh + $y - $oy;
675 $self->check_size; 701 $self->check_size;
676 }; 702 };
677 703
678 } elsif ($x >= 0 && $x < $self->{w} 704 } elsif ($x >= 0 && $x < $self->{w}
679 && $y >= 0 && $y < $border) { 705 && $y >= 0 && $y < $border) {
680 706
681 my ($ox, $oy) = ($ev->button_x, $ev->button_y); 707 my ($ox, $oy) = ($ev->{x}, $ev->{y});
682 my ($bx, $by) = ($self->{x}, $self->{y}); 708 my ($bx, $by) = ($self->{x}, $self->{y});
683 709
684 $self->{motion} = sub { 710 $self->{motion} = sub {
685 my ($ev, $x, $y) = @_; 711 my ($ev, $x, $y) = @_;
686 712
687 ($x, $y) = ($ev->motion_x, $ev->motion_y); 713 ($x, $y) = ($ev->{x}, $ev->{y});
688 714
689 $self->move ($bx + $x - $ox, $by + $y - $oy); 715 $self->move ($bx + $x - $ox, $by + $y - $oy);
690 $self->update; 716 $self->update;
691 }; 717 };
692 } 718 }
737 $bg->draw_quad ($border, $border, $cw, $ch); 763 $bg->draw_quad ($border, $border, $cw, $ch);
738 764
739 glDisable GL_TEXTURE_2D; 765 glDisable GL_TEXTURE_2D;
740 glDisable GL_BLEND; 766 glDisable GL_BLEND;
741 767
768 $self->{title}->draw if $self->{title};
742 $self->child->draw; 769 $self->child->draw;
743} 770}
744 771
745############################################################################# 772#############################################################################
746 773
748 775
749our @ISA = CFClient::UI::Base::; 776our @ISA = CFClient::UI::Base::;
750 777
751use List::Util qw(max sum); 778use List::Util qw(max sum);
752 779
753use SDL::OpenGL; 780use CFClient::OpenGL;
754 781
755sub new { 782sub new {
756 my $class = shift; 783 my $class = shift;
757 784
758 $class->SUPER::new ( 785 $class->SUPER::new (
999 1026
1000package CFClient::UI::Label; 1027package CFClient::UI::Label;
1001 1028
1002our @ISA = CFClient::UI::Base::; 1029our @ISA = CFClient::UI::Base::;
1003 1030
1004use SDL::OpenGL; 1031use CFClient::OpenGL;
1005 1032
1006sub new { 1033sub new {
1007 my ($class, %arg) = @_; 1034 my ($class, %arg) = @_;
1008 1035
1009 my $self = $class->SUPER::new ( 1036 my $self = $class->SUPER::new (
1015 padding => 2, 1042 padding => 2,
1016 layout => new CFClient::Layout, 1043 layout => new CFClient::Layout,
1017 %arg 1044 %arg
1018 ); 1045 );
1019 1046
1020 $self->{xxx}++ if $self->{text} eq "Client Setup" && $self->{align};#d# 1047 if (exists $self->{template}) {
1048 my $layout = new CFClient::Layout;
1049 $layout->set_text (delete $self->{template});
1050 $self->{template} = $layout;
1051 }
1021 1052
1022 $self->set_text (delete $self->{text}) if exists $self->{text}; 1053 $self->set_text (delete $self->{text}) if exists $self->{text};
1023 $self->set_markup (delete $self->{markup}) if exists $self->{markup}; 1054 $self->set_markup (delete $self->{markup}) if exists $self->{markup};
1024 1055
1025 $self 1056 $self
1058 1089
1059 $self->{layout}->set_width; 1090 $self->{layout}->set_width;
1060 $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); 1091 $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE);
1061 1092
1062 my ($w, $h) = $self->{layout}->size; 1093 my ($w, $h) = $self->{layout}->size;
1094
1095 if (exists $self->{template}) {
1096 $self->{template}->set_height ($self->{fontsize} * $::FONTSIZE);
1097
1098 my ($w2, $h2) = $self->{template}->size;
1099
1100 $w = List::Util::max $w, $w2;
1101 $h = List::Util::max $h, $h2;
1102 }
1063 1103
1064 ( 1104 (
1065 $w + $self->{padding} * 2, 1105 $w + $self->{padding} * 2,
1066 $h + $self->{padding} * 2, 1106 $h + $self->{padding} * 2,
1067 ) 1107 )
1111 1151
1112package CFClient::UI::EntryBase; 1152package CFClient::UI::EntryBase;
1113 1153
1114our @ISA = CFClient::UI::Label::; 1154our @ISA = CFClient::UI::Label::;
1115 1155
1116use SDL::OpenGL; 1156use CFClient::OpenGL;
1117 1157
1118sub new { 1158sub new {
1119 my $class = shift; 1159 my $class = shift;
1120 1160
1121 $class->SUPER::new ( 1161 $class->SUPER::new (
1175} 1215}
1176 1216
1177sub key_down { 1217sub key_down {
1178 my ($self, $ev) = @_; 1218 my ($self, $ev) = @_;
1179 1219
1180 my $mod = $ev->key_mod; 1220 my $mod = $ev->{mod};
1181 my $sym = $ev->key_sym; 1221 my $sym = $ev->{sym};
1182
1183 my $uni = $ev->key_unicode; 1222 my $uni = $ev->{unicode};
1184 1223
1185 my $text = $self->get_text; 1224 my $text = $self->get_text;
1186 1225
1187 if ($sym == 8) { 1226 if ($sym == 8) {
1188 substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; 1227 substr $text, --$self->{cursor}, 1, "" if $self->{cursor};
1279 1318
1280package CFClient::UI::Entry; 1319package CFClient::UI::Entry;
1281 1320
1282our @ISA = CFClient::UI::EntryBase::; 1321our @ISA = CFClient::UI::EntryBase::;
1283 1322
1284use SDL::OpenGL; 1323use CFClient::OpenGL;
1285 1324
1286sub key_down { 1325sub key_down {
1287 my ($self, $ev) = @_; 1326 my ($self, $ev) = @_;
1288 1327
1289 my $sym = $ev->key_sym; 1328 my $sym = $ev->{sym};
1290 1329
1291 if ($sym == 13) { 1330 if ($sym == 13) {
1292 $self->emit (activate => $self->get_text); 1331 $self->emit (activate => $self->get_text);
1293 $self->update; 1332 $self->update;
1294 1333
1302 1341
1303package CFClient::UI::Button; 1342package CFClient::UI::Button;
1304 1343
1305our @ISA = CFClient::UI::Label::; 1344our @ISA = CFClient::UI::Label::;
1306 1345
1307use SDL::OpenGL; 1346use CFClient::OpenGL;
1308 1347
1309my @tex = 1348my @tex =
1310 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1349 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1311 qw(b1_button_active.png); 1350 qw(b1_button_active.png);
1312 1351
1365 1404
1366my @tex = 1405my @tex =
1367 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1406 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1368 qw(c1_checkbox_bg.png c1_checkbox_active.png); 1407 qw(c1_checkbox_bg.png c1_checkbox_active.png);
1369 1408
1370use SDL::OpenGL; 1409use CFClient::OpenGL;
1371 1410
1372sub new { 1411sub new {
1373 my $class = shift; 1412 my $class = shift;
1374 1413
1375 $class->SUPER::new ( 1414 $class->SUPER::new (
1425 1464
1426package CFClient::UI::VGauge; 1465package CFClient::UI::VGauge;
1427 1466
1428our @ISA = CFClient::UI::Base::; 1467our @ISA = CFClient::UI::Base::;
1429 1468
1430use SDL::OpenGL; 1469use CFClient::OpenGL;
1431 1470
1432my %tex = ( 1471my %tex = (
1433 food => [ 1472 food => [
1434 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1473 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1435 qw/g1_food_gauge_empty.png g1_food_gauge_full.png/ 1474 qw/g1_food_gauge_empty.png g1_food_gauge_full.png/
1450 1489
1451# eg. VGauge->new (gauge => 'food'), default gauge: food 1490# eg. VGauge->new (gauge => 'food'), default gauge: food
1452sub new { 1491sub new {
1453 my $class = shift; 1492 my $class = shift;
1454 1493
1455 my $self = $class->SUPER::new (gauge => 'food', @_); 1494 my $self = $class->SUPER::new (
1495 type => 'food',
1496 scale => 1,
1497 @_
1498 );
1499
1500 $self->{aspect} = $tex{$self->{type}}[0]{w} / $tex{$self->{type}}[0]{h};
1456 1501
1457 $self 1502 $self
1458} 1503}
1459 1504
1460sub size_request { 1505sub size_request {
1461 my ($self) = @_; 1506 my ($self) = @_;
1462 1507
1463 my $tex = $tex{$self->{gauge}}[0]; 1508 my $tex = $tex{$self->{type}}[0];
1464 1509
1465 @$tex{qw(w h)} 1510 my ($w, $h) = map { $_ * $self->{scale} } @$tex{qw(w h)};
1511 ($self->{vertical}) ? ($h, $w) : ($w, $h)
1466} 1512}
1467 1513
1468sub set_max { 1514sub set_max {
1469 my ($self, $max) = @_; 1515 my ($self, $max) = @_;
1470 1516
1484} 1530}
1485 1531
1486sub _draw { 1532sub _draw {
1487 my ($self) = @_; 1533 my ($self) = @_;
1488 1534
1489 my $tex = $tex{$self->{gauge}}; 1535 my $tex = $tex{$self->{type}};
1490 1536
1491 my ($w, $h) = ($self->{w}, $self->{h}); 1537 my ($w, $h) = ($self->{w}, $self->{h});
1538
1539 if ($self->{vertical}) {
1540 glRotate 90, 0, 0, 1;
1541 glTranslate 0, -$self->{w}, 0;
1542
1543 ($w, $h) = ($h, $w);
1544 }
1492 1545
1493 my $ycut = $self->{val} / ($self->{max_val} || 1); 1546 my $ycut = $self->{val} / ($self->{max_val} || 1);
1494 $ycut = 1 if $self->{val} > $self->{max_val}; 1547 $ycut = 1 if $self->{val} > $self->{max_val};
1495 1548
1496 my $t1 = $tex->[0]; 1549 my $t1 = $tex->[0];
1502 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1555 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1503 1556
1504 my $h1 = $self->{h} - $ycut * $self->{h}; 1557 my $h1 = $self->{h} - $ycut * $self->{h};
1505 my $h2 = $ycut * $self->{h}; 1558 my $h2 = $ycut * $self->{h};
1506 1559
1507 my $yp = 0;
1508
1509 glBindTexture GL_TEXTURE_2D, $t1->{name}; 1560 glBindTexture GL_TEXTURE_2D, $t1->{name};
1510 glBegin GL_QUADS; 1561 glBegin GL_QUADS;
1511 glTexCoord 0 , 0; glVertex 0 , $yp; 1562 glTexCoord 0 , 0; glVertex 0 , 0;
1512 glTexCoord 0 , $t1->{t} * (1 - $ycut); glVertex 0 , $yp + $h1; 1563 glTexCoord 0 , $t1->{t} * (1 - $ycut); glVertex 0 , $h1;
1513 glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut); glVertex 0 + $w, $yp + $h1; 1564 glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut); glVertex $w, $h1;
1514 glTexCoord $t1->{s}, 0; glVertex 0 + $w, $yp; 1565 glTexCoord $t1->{s}, 0; glVertex $w, 0;
1515 glEnd; 1566 glEnd;
1516
1517 $yp += $h1;
1518 1567
1519 glBindTexture GL_TEXTURE_2D, $t2->{name}; 1568 glBindTexture GL_TEXTURE_2D, $t2->{name};
1520 glBegin GL_QUADS; 1569 glBegin GL_QUADS;
1521 glTexCoord 0 , $t2->{t} * (1 - $ycut); glVertex 0 , $yp; 1570 glTexCoord 0 , $t2->{t} * (1 - $ycut); glVertex 0 , $h1;
1522 glTexCoord 0 , $t2->{t}; glVertex 0 , $yp + $h2; 1571 glTexCoord 0 , $t2->{t}; glVertex 0 , $h1 + $h2;
1523 glTexCoord $t2->{s}, $t2->{t}; glVertex 0 + $w, $yp + $h2; 1572 glTexCoord $t2->{s}, $t2->{t}; glVertex $w, $h1 + $h2;
1524 glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut); glVertex 0 + $w, $yp; 1573 glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut); glVertex $w, $h1;
1525 glEnd; 1574 glEnd;
1526 1575
1527 glDisable GL_BLEND; 1576 glDisable GL_BLEND;
1528 glDisable GL_TEXTURE_2D; 1577 glDisable GL_TEXTURE_2D;
1529} 1578}
1530 1579
1531############################################################################# 1580#############################################################################
1532 1581
1582package CFClient::UI::Gauge;
1583
1584our @ISA = CFClient::UI::VBox::;
1585
1586sub new {
1587 my ($class, %arg) = shift;
1588
1589 my $self = $class->SUPER::new (
1590 @_,
1591 );
1592
1593 $self->add ($self->{value} = new CFClient::UI::Label valign => 1, align => 0, template => "999");
1594 $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1, scale => ($self->{scale} || 0.5));
1595 $self->add ($self->{max} = new CFClient::UI::Label valign => 1, align => 0, template => "999");
1596
1597 $self
1598}
1599
1600sub set_value {
1601 my ($self, $val, $max) = @_;
1602
1603 $self->set_max ($max)
1604 if defined $max;
1605
1606 $self->{gauge}->set_value ($val, $max);
1607 $self->{value}->set_text ($val);
1608}
1609
1610sub set_max {
1611 my ($self, $max) = @_;
1612
1613 $self->{gauge}->set_max ($max);
1614 $self->{max}->set_text ($max);
1615}
1616
1617#############################################################################
1618
1533package CFClient::UI::Slider; 1619package CFClient::UI::Slider;
1534 1620
1535use strict; 1621use strict;
1536 1622
1537use SDL::OpenGL; 1623use CFClient::OpenGL;
1538 1624
1539our @ISA = CFClient::UI::DrawBG::; 1625our @ISA = CFClient::UI::DrawBG::;
1540 1626
1541my @tex = 1627my @tex =
1542 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1628 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1667 1753
1668package CFClient::UI::TextView; 1754package CFClient::UI::TextView;
1669 1755
1670our @ISA = CFClient::UI::HBox::; 1756our @ISA = CFClient::UI::HBox::;
1671 1757
1672use SDL::OpenGL; 1758use CFClient::OpenGL;
1673 1759
1674sub new { 1760sub new {
1675 my $class = shift; 1761 my $class = shift;
1676 1762
1677 my $self = $class->SUPER::new ( 1763 my $self = $class->SUPER::new (
1823 1909
1824############################################################################# 1910#############################################################################
1825 1911
1826package CFClient::UI::Animator; 1912package CFClient::UI::Animator;
1827 1913
1828use SDL::OpenGL; 1914use CFClient::OpenGL;
1829 1915
1830our @ISA = CFClient::UI::Bin::; 1916our @ISA = CFClient::UI::Bin::;
1831 1917
1832sub moveto { 1918sub moveto {
1833 my ($self, $x, $y) = @_; 1919 my ($self, $x, $y) = @_;
1906 1992
1907package CFClient::UI::Root; 1993package CFClient::UI::Root;
1908 1994
1909our @ISA = CFClient::UI::Container::; 1995our @ISA = CFClient::UI::Container::;
1910 1996
1911use SDL::OpenGL; 1997use CFClient::OpenGL;
1912 1998
1913sub check_size { 1999sub check_size {
1914 my ($self) = @_; 2000 my ($self) = @_;
1915 2001
1916 $self->configure (0, 0, $::WITH, $::HEIGHT); 2002 $self->configure (0, 0, $::WITH, $::HEIGHT);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines