… | |
… | |
18 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
18 | for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { |
19 | if (exists $widget->{tooltip}) { |
19 | if (exists $widget->{tooltip}) { |
20 | |
20 | |
21 | if ($TOOLTIP->{owner} != $widget) { |
21 | if ($TOOLTIP->{owner} != $widget) { |
22 | $TOOLTIP->{owner} = $widget; |
22 | $TOOLTIP->{owner} = $widget; |
|
|
23 | |
|
|
24 | my $tip = $widget->{tooltip}; |
|
|
25 | |
|
|
26 | $tip = $tip->($widget) if CODE:: eq ref $tip; |
|
|
27 | |
23 | $TOOLTIP->set_text ($widget->{tooltip}); |
28 | $TOOLTIP->set_text ($widget->{tooltip}); |
24 | $TOOLTIP->move ($widget->coord2global ($widget->{w}, 0)); |
29 | $TOOLTIP->move ($widget->coord2global ($widget->{w}, 0)); |
25 | $TOOLTIP->show; |
30 | $TOOLTIP->show; |
26 | } |
31 | } |
27 | |
32 | |
… | |
… | |
163 | $self->{z} = $z if defined $z; |
168 | $self->{z} = $z if defined $z; |
164 | |
169 | |
165 | $self->update; |
170 | $self->update; |
166 | } |
171 | } |
167 | |
172 | |
168 | sub needs_redraw { |
173 | sub set_size { |
169 | 0 |
174 | my ($self, $w, $h) = @_; |
|
|
175 | |
|
|
176 | $self->{user_w} = $w; |
|
|
177 | $self->{user_h} = $h; |
|
|
178 | |
|
|
179 | $self->check_size; |
170 | } |
180 | } |
171 | |
181 | |
172 | sub size_request { |
182 | sub size_request { |
173 | require Carp; |
183 | require Carp; |
174 | Carp::confess "size_request is abstract"; |
184 | Carp::confess "size_request is abstract"; |
… | |
… | |
204 | } |
214 | } |
205 | } |
215 | } |
206 | |
216 | |
207 | sub size_allocate { |
217 | sub size_allocate { |
208 | # nothing to be done |
218 | # nothing to be done |
|
|
219 | } |
|
|
220 | |
|
|
221 | sub set_max_size { |
|
|
222 | my ($self, $w, $h) = @_; |
|
|
223 | |
|
|
224 | delete $self->{max_w}; $self->{max_w} = $w if $w; |
|
|
225 | delete $self->{max_h}; $self->{max_h} = $h if $h; |
209 | } |
226 | } |
210 | |
227 | |
211 | # return top left coordinates |
228 | # return top left coordinates |
212 | sub _topleft { |
229 | sub _topleft { |
213 | my ($self, $x, $y) = @_; |
230 | my ($self, $x, $y) = @_; |
… | |
… | |
325 | } |
342 | } |
326 | |
343 | |
327 | sub check_size { |
344 | sub check_size { |
328 | my ($self) = @_; |
345 | my ($self) = @_; |
329 | |
346 | |
330 | return unless $self->{parent}; |
347 | $self->{parent} |
|
|
348 | or return 1; |
331 | |
349 | |
332 | my ($w, $h) = $self->size_request; |
350 | my ($w, $h) = $self->{user_w} && $self->{user_h} |
|
|
351 | ? @$self{qw(user_w user_h)} |
|
|
352 | : $self->size_request; |
333 | |
353 | |
334 | if ($w != $self->{req_w} || $h != $self->{req_h}) { |
354 | if ($w != $self->{req_w} || $h != $self->{req_h}) { |
335 | $self->{req_w} = $w; |
355 | $self->{req_w} = $w; |
336 | $self->{req_h} = $h; |
356 | $self->{req_h} = $h; |
337 | |
357 | |
338 | $self->{parent}->check_size; |
358 | $self->{parent}->check_size |
|
|
359 | or $self->size_allocate ( |
|
|
360 | (List::Util::max $self->{w}, $w), |
|
|
361 | (List::Util::max $self->{h}, $h), |
|
|
362 | ); |
|
|
363 | |
|
|
364 | 1 |
|
|
365 | } else { |
|
|
366 | 0 |
339 | } |
367 | } |
340 | } |
368 | } |
341 | |
369 | |
342 | sub update { |
370 | sub update { |
343 | my ($self) = @_; |
371 | my ($self) = @_; |
… | |
… | |
631 | border => 0.8, |
659 | border => 0.8, |
632 | @_ |
660 | @_ |
633 | ); |
661 | ); |
634 | |
662 | |
635 | $self |
663 | $self |
636 | } |
|
|
637 | |
|
|
638 | sub set_size { |
|
|
639 | my ($self, $w, $h) = @_; |
|
|
640 | $self->{req_w} = $w; |
|
|
641 | $self->{req_h} = $h; |
|
|
642 | $self->check_size; |
|
|
643 | } |
|
|
644 | |
|
|
645 | sub size_request { |
|
|
646 | my ($self) = @_; |
|
|
647 | ($self->{req_w}, $self->{req_h}) |
|
|
648 | } |
|
|
649 | |
|
|
650 | sub size_allocate { |
|
|
651 | my ($self, $w, $h) = @_; |
|
|
652 | $self->{w} = $w; |
|
|
653 | $self->{h} = $h; |
|
|
654 | $self->child->configure (0, 0, $w, $h); |
|
|
655 | } |
664 | } |
656 | |
665 | |
657 | sub _draw { |
666 | sub _draw { |
658 | my ($self) = @_; |
667 | my ($self) = @_; |
659 | |
668 | |
… | |
… | |
716 | int $_[0]{border} * $::FONTSIZE |
725 | int $_[0]{border} * $::FONTSIZE |
717 | } |
726 | } |
718 | |
727 | |
719 | sub size_request { |
728 | sub size_request { |
720 | my ($self) = @_; |
729 | my ($self) = @_; |
721 | |
|
|
722 | return ($self->{user_w}, $self->{user_h}) if $self->{user_w} && $self->{user_h}; |
|
|
723 | |
730 | |
724 | my ($w, $h) = $self->SUPER::size_request; |
731 | my ($w, $h) = $self->SUPER::size_request; |
725 | |
732 | |
726 | ( |
733 | ( |
727 | $w + $self->border * 2, |
734 | $w + $self->border * 2, |
… | |
… | |
1094 | sub new { |
1101 | sub new { |
1095 | my ($class, %arg) = @_; |
1102 | my ($class, %arg) = @_; |
1096 | |
1103 | |
1097 | my $self = $class->SUPER::new ( |
1104 | my $self = $class->SUPER::new ( |
1098 | fg => [1, 1, 1], |
1105 | fg => [1, 1, 1], |
|
|
1106 | #font => default_font |
1099 | fontsize => 1, |
1107 | fontsize => 1, |
1100 | text => "", |
1108 | text => "", |
1101 | align => -1, |
1109 | align => -1, |
1102 | valign => -1, |
1110 | valign => -1, |
1103 | padding => 2, |
1111 | padding => 2, |
… | |
… | |
1149 | } |
1157 | } |
1150 | |
1158 | |
1151 | sub size_request { |
1159 | sub size_request { |
1152 | my ($self) = @_; |
1160 | my ($self) = @_; |
1153 | |
1161 | |
1154 | $self->{layout}->set_width; |
1162 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
|
|
1163 | $self->{layout}->set_width ($self->{max_w} || -1); |
1155 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1164 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1156 | |
1165 | |
1157 | my ($w, $h) = $self->{layout}->size; |
1166 | my ($w, $h) = $self->{layout}->size; |
1158 | |
1167 | |
1159 | if (exists $self->{template}) { |
1168 | if (exists $self->{template}) { |
|
|
1169 | $self->{template}->set_font ($self->{font}) if $self->{font}; |
1160 | $self->{template}->set_height ($self->{fontsize} * $::FONTSIZE); |
1170 | $self->{template}->set_height ($self->{fontsize} * $::FONTSIZE); |
1161 | |
1171 | |
1162 | my ($w2, $h2) = $self->{template}->size; |
1172 | my ($w2, $h2) = $self->{template}->size; |
1163 | |
1173 | |
1164 | $w = List::Util::max $w, $w2; |
1174 | $w = List::Util::max $w, $w2; |
… | |
… | |
1179 | |
1189 | |
1180 | sub set_fontsize { |
1190 | sub set_fontsize { |
1181 | my ($self, $fontsize) = @_; |
1191 | my ($self, $fontsize) = @_; |
1182 | |
1192 | |
1183 | $self->{fontsize} = $fontsize; |
1193 | $self->{fontsize} = $fontsize; |
|
|
1194 | delete $self->{texture}; |
1184 | $self->check_size; |
1195 | $self->check_size; |
|
|
1196 | $self->update; |
1185 | } |
1197 | } |
1186 | |
1198 | |
1187 | sub _draw { |
1199 | sub _draw { |
1188 | my ($self) = @_; |
1200 | my ($self) = @_; |
1189 | |
1201 | |
1190 | my $tex = $self->{texture} ||= do { |
1202 | my $tex = $self->{texture} ||= do { |
|
|
1203 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1191 | $self->{layout}->set_width ($self->{w}); |
1204 | $self->{layout}->set_width ($self->{w}); |
1192 | $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize} * $::FONTSIZE); |
1205 | $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize} * $::FONTSIZE); |
1193 | new_from_layout CFClient::Texture $self->{layout} |
1206 | new_from_layout CFClient::Texture $self->{layout} |
1194 | }; |
1207 | }; |
1195 | |
1208 | |
… | |
… | |
1598 | |
1611 | |
1599 | package CFClient::UI::VGauge; |
1612 | package CFClient::UI::VGauge; |
1600 | |
1613 | |
1601 | our @ISA = CFClient::UI::Base::; |
1614 | our @ISA = CFClient::UI::Base::; |
1602 | |
1615 | |
|
|
1616 | use List::Util qw(min max); |
|
|
1617 | |
1603 | use CFClient::OpenGL; |
1618 | use CFClient::OpenGL; |
1604 | |
1619 | |
1605 | my %tex = ( |
1620 | my %tex = ( |
1606 | food => [ |
1621 | food => [ |
1607 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1622 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1608 | qw/g1_food_gauge_empty.png g1_food_gauge_full.png/ |
1623 | qw/g1_food_gauge_empty.png g1_food_gauge_full.png/ |
1609 | ], |
1624 | ], |
1610 | grace => [ |
1625 | grace => [ |
1611 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1626 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1612 | qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png/ |
1627 | qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png g1_grace_gauge_overflow.png/ |
1613 | ], |
1628 | ], |
1614 | hp => [ |
1629 | hp => [ |
1615 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1630 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1616 | qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/ |
1631 | qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/ |
1617 | ], |
1632 | ], |
1618 | mana => [ |
1633 | mana => [ |
1619 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1634 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_, mipmap => 1 } |
1620 | qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png/ |
1635 | qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png g1_mana_gauge_overflow.png/ |
1621 | ], |
1636 | ], |
1622 | ); |
1637 | ); |
1623 | |
1638 | |
1624 | # eg. VGauge->new (gauge => 'food'), default gauge: food |
1639 | # eg. VGauge->new (gauge => 'food'), default gauge: food |
1625 | sub new { |
1640 | sub new { |
… | |
… | |
1663 | |
1678 | |
1664 | sub _draw { |
1679 | sub _draw { |
1665 | my ($self) = @_; |
1680 | my ($self) = @_; |
1666 | |
1681 | |
1667 | my $tex = $tex{$self->{type}}; |
1682 | my $tex = $tex{$self->{type}}; |
|
|
1683 | my ($t1, $t2, $t3) = @$tex; |
1668 | |
1684 | |
1669 | my ($w, $h) = ($self->{w}, $self->{h}); |
1685 | my ($w, $h) = ($self->{w}, $self->{h}); |
1670 | |
1686 | |
1671 | if ($self->{vertical}) { |
1687 | if ($self->{vertical}) { |
1672 | glRotate 90, 0, 0, 1; |
1688 | glRotate 90, 0, 0, 1; |
… | |
… | |
1674 | |
1690 | |
1675 | ($w, $h) = ($h, $w); |
1691 | ($w, $h) = ($h, $w); |
1676 | } |
1692 | } |
1677 | |
1693 | |
1678 | my $ycut = $self->{val} / ($self->{max_val} || 1); |
1694 | my $ycut = $self->{val} / ($self->{max_val} || 1); |
1679 | $ycut = 1 if $self->{val} > $self->{max_val}; |
|
|
1680 | |
1695 | |
1681 | my $t1 = $tex->[0]; |
1696 | my $ycut1 = max 0, min 1, $ycut; |
1682 | my $t2 = $tex->[1]; |
1697 | my $ycut2 = max 0, min 1, $ycut - 1; |
|
|
1698 | |
|
|
1699 | my $h1 = $self->{h} * (1 - $ycut1); |
|
|
1700 | my $h2 = $self->{h} * (1 - $ycut2); |
1683 | |
1701 | |
1684 | glEnable GL_BLEND; |
1702 | glEnable GL_BLEND; |
1685 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
1703 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
1686 | glEnable GL_TEXTURE_2D; |
1704 | glEnable GL_TEXTURE_2D; |
1687 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1705 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1688 | |
1706 | |
1689 | my $h1 = $self->{h} - $ycut * $self->{h}; |
|
|
1690 | my $h2 = $ycut * $self->{h}; |
|
|
1691 | |
|
|
1692 | glBindTexture GL_TEXTURE_2D, $t1->{name}; |
1707 | glBindTexture GL_TEXTURE_2D, $t1->{name}; |
1693 | glBegin GL_QUADS; |
1708 | glBegin GL_QUADS; |
1694 | glTexCoord 0 , 0; glVertex 0 , 0; |
1709 | glTexCoord 0 , 0; glVertex 0 , 0; |
1695 | glTexCoord 0 , $t1->{t} * (1 - $ycut); glVertex 0 , $h1; |
1710 | glTexCoord 0 , $t1->{t} * (1 - $ycut1); glVertex 0 , $h1; |
1696 | glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut); glVertex $w, $h1; |
1711 | glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut1); glVertex $w, $h1; |
1697 | glTexCoord $t1->{s}, 0; glVertex $w, 0; |
1712 | glTexCoord $t1->{s}, 0; glVertex $w, 0; |
1698 | glEnd; |
1713 | glEnd; |
1699 | |
1714 | |
|
|
1715 | my $ycut1 = List::Util::min 1, $ycut; |
1700 | glBindTexture GL_TEXTURE_2D, $t2->{name}; |
1716 | glBindTexture GL_TEXTURE_2D, $t2->{name}; |
1701 | glBegin GL_QUADS; |
1717 | glBegin GL_QUADS; |
1702 | glTexCoord 0 , $t2->{t} * (1 - $ycut); glVertex 0 , $h1; |
1718 | glTexCoord 0 , $t2->{t} * (1 - $ycut1); glVertex 0 , $h1; |
1703 | glTexCoord 0 , $t2->{t}; glVertex 0 , $h1 + $h2; |
1719 | glTexCoord 0 , $t2->{t} * (1 - $ycut2); glVertex 0 , $h2; |
1704 | glTexCoord $t2->{s}, $t2->{t}; glVertex $w, $h1 + $h2; |
1720 | glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut2); glVertex $w, $h2; |
1705 | glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut); glVertex $w, $h1; |
1721 | glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut1); glVertex $w, $h1; |
1706 | glEnd; |
1722 | glEnd; |
|
|
1723 | |
|
|
1724 | if ($t3) { |
|
|
1725 | glBindTexture GL_TEXTURE_2D, $t3->{name}; |
|
|
1726 | glBegin GL_QUADS; |
|
|
1727 | glTexCoord 0 , $t3->{t} * (1 - $ycut2); glVertex 0 , $h2; |
|
|
1728 | glTexCoord 0 , $t3->{t}; glVertex 0 , $self->{h}; |
|
|
1729 | glTexCoord $t3->{s}, $t3->{t}; glVertex $w, $self->{h}; |
|
|
1730 | glTexCoord $t3->{s}, $t3->{t} * (1 - $ycut2); glVertex $w, $h2; |
|
|
1731 | glEnd; |
|
|
1732 | } |
1707 | |
1733 | |
1708 | glDisable GL_BLEND; |
1734 | glDisable GL_BLEND; |
1709 | glDisable GL_TEXTURE_2D; |
1735 | glDisable GL_TEXTURE_2D; |
1710 | } |
1736 | } |
1711 | |
1737 | |
… | |
… | |
1721 | my $self = $class->SUPER::new ( |
1747 | my $self = $class->SUPER::new ( |
1722 | tooltip => $arg{type}, |
1748 | tooltip => $arg{type}, |
1723 | %arg, |
1749 | %arg, |
1724 | ); |
1750 | ); |
1725 | |
1751 | |
1726 | $self->add ($self->{value} = new CFClient::UI::Label valign => +1, align => 0, template => "999"); |
1752 | $self->add ($self->{value} = new CFClient::UI::Label valign => +1, align => 0, template => "999", can_events => 1, can_hover => 1); |
1727 | $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1); |
1753 | $self->add ($self->{gauge} = new CFClient::UI::VGauge type => $self->{type}, expand => 1, can_events => 1, can_hover => 1); |
1728 | $self->add ($self->{max} = new CFClient::UI::Label valign => -1, align => 0, template => "999"); |
1754 | $self->add ($self->{max} = new CFClient::UI::Label valign => -1, align => 0, template => "999", can_events => 1, can_hover => 1); |
1729 | |
1755 | |
1730 | $self |
1756 | $self |
1731 | } |
1757 | } |
1732 | |
1758 | |
1733 | sub set_fontsize { |
1759 | sub set_fontsize { |
… | |
… | |
1900 | sub new { |
1926 | sub new { |
1901 | my $class = shift; |
1927 | my $class = shift; |
1902 | |
1928 | |
1903 | my $self = $class->SUPER::new ( |
1929 | my $self = $class->SUPER::new ( |
1904 | fontsize => 1, |
1930 | fontsize => 1, |
|
|
1931 | #font => default_font |
1905 | @_, |
1932 | @_, |
1906 | |
1933 | |
1907 | layout => (new CFClient::Layout), |
1934 | layout => (new CFClient::Layout), |
1908 | par => [], |
1935 | par => [], |
1909 | height => 0, |
1936 | height => 0, |
… | |
… | |
1949 | sub size_allocate { |
1976 | sub size_allocate { |
1950 | my ($self, $w, $h) = @_; |
1977 | my ($self, $w, $h) = @_; |
1951 | |
1978 | |
1952 | $self->SUPER::size_allocate ($w, $h); |
1979 | $self->SUPER::size_allocate ($w, $h); |
1953 | |
1980 | |
|
|
1981 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1954 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1982 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1955 | $self->{layout}->set_width ($self->{children}[0]{w}); |
1983 | $self->{layout}->set_width ($self->{children}[0]{w}); |
1956 | |
1984 | |
1957 | $self->reflow; |
1985 | $self->reflow; |
1958 | } |
1986 | } |
… | |
… | |
2010 | my $y1 = $top + $self->{h}; |
2038 | my $y1 = $top + $self->{h}; |
2011 | |
2039 | |
2012 | my $y = 0; |
2040 | my $y = 0; |
2013 | |
2041 | |
2014 | my $layout = $self->{layout}; |
2042 | my $layout = $self->{layout}; |
|
|
2043 | |
|
|
2044 | $layout->set_font ($self->{font}) if $self->{font}; |
2015 | |
2045 | |
2016 | for my $par (@{$self->{par}}) { |
2046 | for my $par (@{$self->{par}}) { |
2017 | my $h = $par->[0]; |
2047 | my $h = $par->[0]; |
2018 | |
2048 | |
2019 | if ($y0 < $y + $h && $y < $y1) { |
2049 | if ($y0 < $y + $h && $y < $y1) { |
… | |
… | |
2129 | $self->emit (changed => $self->{state}); |
2159 | $self->emit (changed => $self->{state}); |
2130 | } |
2160 | } |
2131 | |
2161 | |
2132 | ############################################################################# |
2162 | ############################################################################# |
2133 | |
2163 | |
|
|
2164 | package CFClient::UI::Tooltip; |
|
|
2165 | |
|
|
2166 | our @ISA = CFClient::UI::Bin::; |
|
|
2167 | |
|
|
2168 | use CFClient::OpenGL; |
|
|
2169 | |
|
|
2170 | sub new { |
|
|
2171 | my $class = shift; |
|
|
2172 | |
|
|
2173 | $class->SUPER::new ( |
|
|
2174 | @_, |
|
|
2175 | can_events => 0, |
|
|
2176 | ) |
|
|
2177 | } |
|
|
2178 | |
|
|
2179 | sub set_text { |
|
|
2180 | my ($self, $text) = @_; |
|
|
2181 | |
|
|
2182 | $self->{label} ||= new CFClient::UI::Label fontsize => 0.8, fg => [0, 0, 0]; |
|
|
2183 | $self->{label}->set_text ($text); |
|
|
2184 | $self->add ($self->{label}); |
|
|
2185 | } |
|
|
2186 | |
|
|
2187 | sub size_request { |
|
|
2188 | my ($self) = @_; |
|
|
2189 | |
|
|
2190 | $self->child->set_max_size ($::WIDTH * 0.2); |
|
|
2191 | |
|
|
2192 | my ($w, $h) = @{$self->child}{qw(req_w req_h)}; |
|
|
2193 | |
|
|
2194 | ($w + 4, $h + 4) |
|
|
2195 | } |
|
|
2196 | |
|
|
2197 | sub _draw { |
|
|
2198 | my ($self) = @_; |
|
|
2199 | |
|
|
2200 | glPushMatrix; |
|
|
2201 | glTranslate 0.375, 0.375; |
|
|
2202 | |
|
|
2203 | my ($w, $h) = @$self{qw(w h)}; |
|
|
2204 | |
|
|
2205 | glColor 1, 0.8, 0.4; |
|
|
2206 | glBegin GL_QUADS; |
|
|
2207 | glVertex 0 , 0; |
|
|
2208 | glVertex 0 , $h; |
|
|
2209 | glVertex $w, $h; |
|
|
2210 | glVertex $w, 0; |
|
|
2211 | glEnd; |
|
|
2212 | |
|
|
2213 | glColor 0, 0, 0; |
|
|
2214 | glBegin GL_LINE_LOOP; |
|
|
2215 | glVertex 0 , 0; |
|
|
2216 | glVertex 0 , $h; |
|
|
2217 | glVertex $w, $h; |
|
|
2218 | glVertex $w, 0; |
|
|
2219 | glEnd; |
|
|
2220 | |
|
|
2221 | glPopMatrix; |
|
|
2222 | |
|
|
2223 | glTranslate 2, 2; |
|
|
2224 | $self->SUPER::_draw; |
|
|
2225 | } |
|
|
2226 | |
|
|
2227 | ############################################################################# |
|
|
2228 | |
2134 | package CFClient::UI::Root; |
2229 | package CFClient::UI::Root; |
2135 | |
2230 | |
2136 | our @ISA = CFClient::UI::Container::; |
2231 | our @ISA = CFClient::UI::Container::; |
2137 | |
2232 | |
2138 | use CFClient::OpenGL; |
2233 | use CFClient::OpenGL; |
… | |
… | |
2213 | ############################################################################# |
2308 | ############################################################################# |
2214 | |
2309 | |
2215 | package CFClient::UI; |
2310 | package CFClient::UI; |
2216 | |
2311 | |
2217 | $ROOT = new CFClient::UI::Root; |
2312 | $ROOT = new CFClient::UI::Root; |
2218 | $TOOLTIP = new CFClient::UI::Label fontsize => 0.8, can_events => 0; |
2313 | $TOOLTIP = new CFClient::UI::Tooltip; |
2219 | |
2314 | |
2220 | 1 |
2315 | 1 |
2221 | |
2316 | |