… | |
… | |
136 | $rem += $_ - $i; |
136 | $rem += $_ - $i; |
137 | $_ = $i; |
137 | $_ = $i; |
138 | } |
138 | } |
139 | } |
139 | } |
140 | |
140 | |
|
|
141 | sub full_refresh { |
|
|
142 | # make a copy, otherwise for complains about freed values. |
|
|
143 | my @widgets = values %WIDGET; |
|
|
144 | |
|
|
145 | $_->update |
|
|
146 | for @widgets; |
|
|
147 | } |
|
|
148 | |
141 | # call when resolution changes etc. |
149 | # call when resolution changes etc. |
142 | sub rescale_widgets { |
150 | sub rescale_widgets { |
143 | my ($sx, $sy) = @_; |
151 | my ($sx, $sy) = @_; |
144 | |
152 | |
|
|
153 | # make a copy, otherwise for complains about freed values. |
145 | for my $widget (values %WIDGET) { |
154 | my @widgets = values %WIDGET; |
|
|
155 | |
|
|
156 | for my $widget (@widgets) { |
146 | if ($widget->{toplevel}) { |
157 | if ($widget->{toplevel}) { |
147 | $widget->{x} = int 0.5 + $widget->{x} * $sx if exists $widget->{x}; |
158 | $widget->{x} = int 0.5 + $widget->{x} * $sx if exists $widget->{x}; |
148 | $widget->{w} = int 0.5 + $widget->{w} * $sx if exists $widget->{w}; |
159 | $widget->{w} = int 0.5 + $widget->{w} * $sx if exists $widget->{w}; |
149 | $widget->{req_w} = int 0.5 + $widget->{req_w} * $sx if exists $widget->{req_w}; |
160 | $widget->{req_w} = int 0.5 + $widget->{req_w} * $sx if exists $widget->{req_w}; |
150 | $widget->{user_w} = int 0.5 + $widget->{user_w} * $sx if exists $widget->{user_w}; |
161 | $widget->{user_w} = int 0.5 + $widget->{user_w} * $sx if exists $widget->{user_w}; |
… | |
… | |
195 | %$self = (); |
206 | %$self = (); |
196 | } |
207 | } |
197 | |
208 | |
198 | sub show { |
209 | sub show { |
199 | my ($self) = @_; |
210 | my ($self) = @_; |
200 | |
|
|
201 | return if $self->{parent}; |
211 | return if $self->{parent}; |
202 | |
212 | |
203 | $CFClient::UI::ROOT->add ($self); |
213 | $CFClient::UI::ROOT->add ($self); |
204 | } |
214 | } |
205 | |
215 | |
… | |
… | |
280 | sub set_max_size { |
290 | sub set_max_size { |
281 | my ($self, $w, $h) = @_; |
291 | my ($self, $w, $h) = @_; |
282 | |
292 | |
283 | delete $self->{max_w}; $self->{max_w} = $w if $w; |
293 | delete $self->{max_w}; $self->{max_w} = $w if $w; |
284 | delete $self->{max_h}; $self->{max_h} = $h if $h; |
294 | delete $self->{max_h}; $self->{max_h} = $h if $h; |
|
|
295 | } |
|
|
296 | |
|
|
297 | sub set_tooltip { |
|
|
298 | my ($self, $tooltip) = @_; |
|
|
299 | |
|
|
300 | $self->{tooltip} = $tooltip; |
|
|
301 | |
|
|
302 | if ($CFClient::UI::TOOLTIP->{owner} == $self) { |
|
|
303 | delete $CFClient::UI::TOOLTIP->{owner}; |
|
|
304 | CFClient::UI::check_tooltip; |
|
|
305 | } |
285 | } |
306 | } |
286 | |
307 | |
287 | # translate global coordinates to local coordinate system |
308 | # translate global coordinates to local coordinate system |
288 | sub coord2local { |
309 | sub coord2local { |
289 | my ($self, $x, $y) = @_; |
310 | my ($self, $x, $y) = @_; |
… | |
… | |
405 | Scalar::Util::weaken ($self->{parent} = $parent); |
426 | Scalar::Util::weaken ($self->{parent} = $parent); |
406 | |
427 | |
407 | # TODO: req_w _does_change after ->reconfigure |
428 | # TODO: req_w _does_change after ->reconfigure |
408 | $self->check_size |
429 | $self->check_size |
409 | unless exists $self->{req_w}; |
430 | unless exists $self->{req_w}; |
|
|
431 | |
|
|
432 | $self->show; |
410 | } |
433 | } |
411 | |
434 | |
412 | sub check_size { |
435 | sub check_size { |
413 | my ($self, $forced) = @_; |
436 | my ($self, $forced) = @_; |
414 | |
437 | |
… | |
… | |
455 | my $class = shift; |
478 | my $class = shift; |
456 | |
479 | |
457 | # range [value, low, high, page] |
480 | # range [value, low, high, page] |
458 | |
481 | |
459 | $class->SUPER::new ( |
482 | $class->SUPER::new ( |
460 | bg => [0, 0, 0, 0.2], |
483 | #bg => [0, 0, 0, 0.2], |
461 | active_bg => [1, 1, 1, 0.5], |
484 | #active_bg => [1, 1, 1, 0.5], |
462 | @_ |
485 | @_ |
463 | ) |
486 | ) |
464 | } |
487 | } |
465 | |
488 | |
466 | sub _draw { |
489 | sub _draw { |
467 | my ($self) = @_; |
490 | my ($self) = @_; |
468 | |
491 | |
|
|
492 | my $color = $FOCUS == $self && $self->{active_bg} |
|
|
493 | ? $self->{active_bg} |
|
|
494 | : $self->{bg}; |
|
|
495 | |
|
|
496 | if ($color && (@$color < 4 || $color->[3])) { |
469 | my ($w, $h) = @$self{qw(w h)}; |
497 | my ($w, $h) = @$self{qw(w h)}; |
470 | |
498 | |
471 | glEnable GL_BLEND; |
499 | glEnable GL_BLEND; |
472 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
500 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
473 | glColor @{ $FOCUS == $self ? $self->{active_bg} : $self->{bg} }; |
501 | glColor @$color; |
474 | |
502 | |
475 | glBegin GL_QUADS; |
503 | glBegin GL_QUADS; |
476 | glVertex 0 , 0; |
504 | glVertex 0 , 0; |
477 | glVertex 0 , $h; |
505 | glVertex 0 , $h; |
478 | glVertex $w, $h; |
506 | glVertex $w, $h; |
479 | glVertex $w, 0; |
507 | glVertex $w, 0; |
480 | glEnd; |
508 | glEnd; |
481 | |
509 | |
482 | glDisable GL_BLEND; |
510 | glDisable GL_BLEND; |
|
|
511 | } |
483 | } |
512 | } |
484 | |
513 | |
485 | ############################################################################# |
514 | ############################################################################# |
486 | |
515 | |
487 | package CFClient::UI::Empty; |
516 | package CFClient::UI::Empty; |
… | |
… | |
671 | $self->{texture} = new_from_opengl CFClient::Texture $self->{w}, $self->{h}, sub { |
700 | $self->{texture} = new_from_opengl CFClient::Texture $self->{w}, $self->{h}, sub { |
672 | glClearColor 0, 0, 0, 0; |
701 | glClearColor 0, 0, 0, 0; |
673 | glClear GL_COLOR_BUFFER_BIT; |
702 | glClear GL_COLOR_BUFFER_BIT; |
674 | |
703 | |
675 | $self->_render; |
704 | $self->_render; |
676 | # glColorMask 1, 1, 1, 0; |
|
|
677 | # glEnable GL_BLEND; |
|
|
678 | # glBlendFunc GL_SRC_ALPHA, GL_ZERO; |
|
|
679 | # glRasterPos 0, 0; |
|
|
680 | # glCopyPixels 0, 0, $self->{w}, $self->{h}; |
|
|
681 | # glDisable GL_BLEND; |
|
|
682 | # glColorMask 1, 1, 1, 1; |
|
|
683 | }; |
705 | }; |
684 | } |
706 | } |
685 | |
707 | |
686 | sub _draw { |
708 | sub _draw { |
687 | my ($self) = @_; |
709 | my ($self) = @_; |
… | |
… | |
691 | my $tex = $self->{texture} |
713 | my $tex = $self->{texture} |
692 | or return; |
714 | or return; |
693 | |
715 | |
694 | glEnable GL_TEXTURE_2D; |
716 | glEnable GL_TEXTURE_2D; |
695 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
717 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
696 | glColor 0, 0, 0, 1; |
718 | glColor 1, 1, 1, 1; |
697 | |
719 | |
698 | $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h); |
720 | $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h); |
699 | |
721 | |
700 | glDisable GL_TEXTURE_2D; |
722 | glDisable GL_TEXTURE_2D; |
701 | } |
723 | } |
… | |
… | |
784 | $self->{vp}->set_offset (0, $_[1] * ($self->{vp}{child_h} - $self->{vp}{h})); |
806 | $self->{vp}->set_offset (0, $_[1] * ($self->{vp}{child_h} - $self->{vp}{h})); |
785 | }, |
807 | }, |
786 | ; |
808 | ; |
787 | |
809 | |
788 | $self = $class->SUPER::new ( |
810 | $self = $class->SUPER::new ( |
789 | vp => (new CFClient::UI::ViewPort), |
811 | vp => (new CFClient::UI::ViewPort expand => 1), |
790 | slider => $slider, |
812 | slider => $slider, |
791 | @_, |
813 | @_, |
792 | ); |
814 | ); |
793 | |
815 | |
794 | $self->{vp}->add ($self->{scrolled}); |
816 | $self->{vp}->add ($self->{scrolled}); |
… | |
… | |
1266 | |
1288 | |
1267 | ############################################################################# |
1289 | ############################################################################# |
1268 | |
1290 | |
1269 | package CFClient::UI::Label; |
1291 | package CFClient::UI::Label; |
1270 | |
1292 | |
1271 | our @ISA = CFClient::UI::Base::; |
1293 | our @ISA = CFClient::UI::DrawBG::; |
1272 | |
1294 | |
1273 | use CFClient::OpenGL; |
1295 | use CFClient::OpenGL; |
1274 | |
1296 | |
1275 | sub new { |
1297 | sub new { |
1276 | my ($class, %arg) = @_; |
1298 | my ($class, %arg) = @_; |
1277 | |
1299 | |
1278 | my $self = $class->SUPER::new ( |
1300 | my $self = $class->SUPER::new ( |
1279 | fg => [1, 1, 1], |
1301 | fg => [1, 1, 1], |
|
|
1302 | #bg => none |
|
|
1303 | #active_bg => none |
1280 | #font => default_font |
1304 | #font => default_font |
1281 | #text => initial text |
1305 | #text => initial text |
1282 | #markup => initial narkup |
1306 | #markup => initial narkup |
|
|
1307 | #max_w => maximum pixel width |
|
|
1308 | ellipsise => 3, # end |
1283 | layout => (new CFClient::Layout), |
1309 | layout => (new CFClient::Layout), |
1284 | fontsize => 1, |
1310 | fontsize => 1, |
1285 | align => -1, |
1311 | align => -1, |
1286 | valign => -1, |
1312 | valign => -1, |
1287 | padding => 2, |
1313 | padding => 2, |
… | |
… | |
1302 | } |
1328 | } |
1303 | |
1329 | |
1304 | $self |
1330 | $self |
1305 | } |
1331 | } |
1306 | |
1332 | |
1307 | sub escape { |
1333 | sub escape($) { |
1308 | local $_ = $_[1]; |
1334 | local $_ = $_[0]; |
1309 | |
1335 | |
1310 | s/&/&/g; |
1336 | s/&/&/g; |
1311 | s/>/>/g; |
1337 | s/>/>/g; |
1312 | s/</</g; |
1338 | s/</</g; |
1313 | |
1339 | |
1314 | $_[1] |
1340 | $_ |
1315 | } |
1341 | } |
1316 | |
1342 | |
1317 | sub update { |
1343 | sub update { |
1318 | my ($self) = @_; |
1344 | my ($self) = @_; |
1319 | |
1345 | |
… | |
… | |
1352 | sub size_request { |
1378 | sub size_request { |
1353 | my ($self) = @_; |
1379 | my ($self) = @_; |
1354 | |
1380 | |
1355 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1381 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1356 | $self->{layout}->set_width ($self->{max_w} || -1); |
1382 | $self->{layout}->set_width ($self->{max_w} || -1); |
|
|
1383 | $self->{layout}->set_ellipsise ($self->{ellipsise}); |
|
|
1384 | $self->{layout}->set_single_paragraph_mode ($self->{ellipsise}); |
1357 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1385 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1358 | |
1386 | |
1359 | my ($w, $h) = $self->{layout}->size; |
1387 | my ($w, $h) = $self->{layout}->size; |
1360 | |
1388 | |
1361 | if (exists $self->{template}) { |
1389 | if (exists $self->{template}) { |
… | |
… | |
1391 | } |
1419 | } |
1392 | |
1420 | |
1393 | sub _draw { |
1421 | sub _draw { |
1394 | my ($self) = @_; |
1422 | my ($self) = @_; |
1395 | |
1423 | |
|
|
1424 | $self->SUPER::_draw; # draw background, if applicable |
|
|
1425 | |
1396 | my $tex = $self->{texture} ||= do { |
1426 | my $tex = $self->{texture} ||= do { |
1397 | $self->{layout}->set_foreground (@{$self->{fg}}); |
1427 | $self->{layout}->set_foreground (@{$self->{fg}}); |
1398 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1428 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
1399 | $self->{layout}->set_width ($self->{w}); |
1429 | $self->{layout}->set_width ($self->{w}); |
|
|
1430 | $self->{layout}->set_ellipsise ($self->{ellipsise}); |
|
|
1431 | $self->{layout}->set_single_paragraph_mode ($self->{ellipsise}); |
1400 | $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize} * $::FONTSIZE); |
1432 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
1401 | |
1433 | |
1402 | my $tex = new_from_layout CFClient::Texture $self->{layout}; |
1434 | my $tex = new_from_layout CFClient::Texture $self->{layout}; |
1403 | |
1435 | |
1404 | $self->{ox} = int ($self->{align} < 0 ? $self->{padding} |
1436 | $self->{ox} = int ($self->{align} < 0 ? $self->{padding} |
1405 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} |
1437 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} |
… | |
… | |
1660 | my $class = shift; |
1692 | my $class = shift; |
1661 | |
1693 | |
1662 | $class->SUPER::new ( |
1694 | $class->SUPER::new ( |
1663 | padding => 4, |
1695 | padding => 4, |
1664 | fg => [1, 1, 1], |
1696 | fg => [1, 1, 1], |
1665 | bg => [1, 1, 1, 0.2], |
|
|
1666 | active_fg => [0, 0, 1], |
1697 | active_fg => [0, 0, 1], |
1667 | can_hover => 1, |
1698 | can_hover => 1, |
1668 | align => 0, |
1699 | align => 0, |
1669 | valign => 0, |
1700 | valign => 0, |
1670 | can_events => 1, |
1701 | can_events => 1, |
… | |
… | |
1718 | |
1749 | |
1719 | $class->SUPER::new ( |
1750 | $class->SUPER::new ( |
1720 | padding => 2, |
1751 | padding => 2, |
1721 | fg => [1, 1, 1], |
1752 | fg => [1, 1, 1], |
1722 | active_fg => [1, 1, 0], |
1753 | active_fg => [1, 1, 0], |
|
|
1754 | bg => [0, 0, 0, 0.2], |
|
|
1755 | active_bg => [1, 1, 1, 0.5], |
1723 | state => 0, |
1756 | state => 0, |
1724 | can_hover => 1, |
1757 | can_hover => 1, |
1725 | @_ |
1758 | @_ |
1726 | ) |
1759 | ) |
1727 | } |
1760 | } |
… | |
… | |
2019 | # TODO: req_w/h are wrong with vertical |
2052 | # TODO: req_w/h are wrong with vertical |
2020 | # TODO: calculations are off |
2053 | # TODO: calculations are off |
2021 | my $self = $class->SUPER::new ( |
2054 | my $self = $class->SUPER::new ( |
2022 | fg => [1, 1, 1], |
2055 | fg => [1, 1, 1], |
2023 | active_fg => [0, 0, 0], |
2056 | active_fg => [0, 0, 0], |
|
|
2057 | bg => [0, 0, 0, 0.2], |
|
|
2058 | active_bg => [1, 1, 1, 0.5], |
2024 | range => [0, 0, 100, 10], |
2059 | range => [0, 0, 100, 10], |
2025 | req_w => $::WIDTH / 80, |
2060 | req_w => $::WIDTH / 80, |
2026 | req_h => $::WIDTH / 80, |
2061 | req_h => $::WIDTH / 80, |
2027 | vertical => 0, |
2062 | vertical => 0, |
2028 | can_hover => 1, |
2063 | can_hover => 1, |
2029 | inner_pad => .05, |
2064 | inner_pad => 0.02, |
2030 | @_ |
2065 | @_ |
2031 | ); |
2066 | ); |
2032 | |
2067 | |
2033 | $self->set_value ($self->{range}[0]); |
2068 | $self->set_value ($self->{range}[0]); |
2034 | $self->update; |
2069 | $self->update; |
… | |
… | |
2124 | glScale $self->{w}, $self->{h}; |
2159 | glScale $self->{w}, $self->{h}; |
2125 | |
2160 | |
2126 | if ($self->{vertical}) { |
2161 | if ($self->{vertical}) { |
2127 | # draw a vertical slider like a rotated horizontal slider |
2162 | # draw a vertical slider like a rotated horizontal slider |
2128 | |
2163 | |
|
|
2164 | glTranslate 1, 0, 0; |
2129 | glRotate 90, 0, 0, 1; |
2165 | glRotate 90, 0, 0, 1; |
2130 | glTranslate 0, 1, 0; |
|
|
2131 | } |
2166 | } |
2132 | |
2167 | |
2133 | my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg}; |
2168 | my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg}; |
2134 | my $bg = $FOCUS == $self ? $self->{active_bg} : $self->{bg}; |
2169 | my $bg = $FOCUS == $self ? $self->{active_bg} : $self->{bg}; |
2135 | |
2170 | |
… | |
… | |
2181 | |
2216 | |
2182 | $self->{fontsize} = $fontsize; |
2217 | $self->{fontsize} = $fontsize; |
2183 | $self->reflow; |
2218 | $self->reflow; |
2184 | } |
2219 | } |
2185 | |
2220 | |
|
|
2221 | sub size_allocate { |
|
|
2222 | my ($self, $w, $h) = @_; |
|
|
2223 | |
|
|
2224 | $self->SUPER::size_allocate ($w, $h); |
|
|
2225 | |
|
|
2226 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
|
|
2227 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
|
|
2228 | $self->{layout}->set_width ($self->{children}[0]{w}); |
|
|
2229 | |
|
|
2230 | $self->reflow; |
|
|
2231 | } |
|
|
2232 | |
2186 | sub text_height { |
2233 | sub text_height { |
2187 | my ($self, $text) = @_; |
2234 | my ($self, $text, $indent) = @_; |
2188 | |
2235 | |
2189 | my $layout = $self->{layout}; |
2236 | my $layout = $self->{layout}; |
2190 | |
2237 | |
2191 | $layout->set_height ($self->{fontsize} * $::FONTSIZE); |
2238 | $layout->set_height ($self->{fontsize} * $::FONTSIZE); |
2192 | $layout->set_width ($self->{children}[0]{w}); |
2239 | $layout->set_width ($self->{children}[0]{w} - $indent); |
2193 | $layout->set_markup ($text); |
2240 | $layout->set_markup ($text); |
2194 | |
2241 | |
2195 | ($layout->size)[1] |
2242 | ($layout->size)[1] |
2196 | } |
2243 | } |
2197 | |
2244 | |
… | |
… | |
2200 | |
2247 | |
2201 | $self->{need_reflow}++; |
2248 | $self->{need_reflow}++; |
2202 | $self->update; |
2249 | $self->update; |
2203 | } |
2250 | } |
2204 | |
2251 | |
2205 | sub size_allocate { |
|
|
2206 | my ($self, $w, $h) = @_; |
|
|
2207 | |
|
|
2208 | $self->SUPER::size_allocate ($w, $h); |
|
|
2209 | |
|
|
2210 | $self->{layout}->set_font ($self->{font}) if $self->{font}; |
|
|
2211 | $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE); |
|
|
2212 | $self->{layout}->set_width ($self->{children}[0]{w}); |
|
|
2213 | |
|
|
2214 | $self->reflow; |
|
|
2215 | } |
|
|
2216 | |
|
|
2217 | sub add_paragraph { |
2252 | sub add_paragraph { |
2218 | my ($self, $color, $text) = @_; |
2253 | my ($self, $color, $text, $indent) = @_; |
2219 | |
2254 | |
2220 | #TODO: intelligently "reformat" paragraph |
2255 | #TODO: intelligently "reformat" paragraph |
2221 | |
2256 | |
|
|
2257 | for my $line (split /\n/, $text) { |
2222 | my $height = $self->text_height ($text); |
2258 | my $height = $self->text_height ($line); |
2223 | |
|
|
2224 | $self->{height} += $height; |
2259 | $self->{height} += $height; |
2225 | |
|
|
2226 | push @{$self->{par}}, [$height, $color, $text]; |
2260 | push @{$self->{par}}, [$height, $color, $indent, $line]; |
|
|
2261 | } |
2227 | |
2262 | |
2228 | $self->{children}[1]{range} = [$self->{height} - $self->{h}, 0, $self->{height}, $self->{h}]; |
2263 | $self->{children}[1]{range} = [$self->{height} - $self->{h}, 0, $self->{height}, $self->{h}]; |
2229 | $self->{children}[1]->update; |
2264 | $self->{children}[1]->update; |
2230 | } |
2265 | } |
2231 | |
2266 | |
… | |
… | |
2240 | |
2275 | |
2241 | $ROOT->on_post_alloc ($self, sub { |
2276 | $ROOT->on_post_alloc ($self, sub { |
2242 | if (delete $self->{need_reflow}) { |
2277 | if (delete $self->{need_reflow}) { |
2243 | my $height = 0; |
2278 | my $height = 0; |
2244 | |
2279 | |
2245 | $height += $_->[0] = $self->text_height ($_->[2]) |
2280 | $height += $_->[0] = $self->text_height ($_->[3], $_->[2]) |
2246 | for @{$self->{par}}; |
2281 | for @{$self->{par}}; |
2247 | |
2282 | |
2248 | $self->{height} = $height; |
2283 | $self->{height} = $height; |
2249 | |
2284 | |
2250 | $self->{children}[1]{range} = [$height - $self->{h}, 0, $height, $self->{h}]; |
2285 | $self->{children}[1]{range} = [$height - $self->{h}, 0, $height, $self->{h}]; |
|
|
2286 | $self->{children}[1]->update; |
2251 | |
2287 | |
2252 | delete $self->{texture}; |
2288 | delete $self->{texture}; |
2253 | } |
2289 | } |
2254 | |
2290 | |
2255 | $self->{texture} ||= new_from_opengl CFClient::Texture $self->{children}[0]{w}, $self->{children}[0]{h}, sub { |
2291 | $self->{texture} ||= new_from_opengl CFClient::Texture $self->{children}[0]{w}, $self->{children}[0]{h}, sub { |
2256 | glClearColor 0, 0, 0, 0; |
2292 | glClearColor 0.5, 0.5, 0.5, 0; |
2257 | glClear GL_COLOR_BUFFER_BIT; |
2293 | glClear GL_COLOR_BUFFER_BIT; |
2258 | |
|
|
2259 | glEnable GL_TEXTURE_2D; |
|
|
2260 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
|
|
2261 | |
2294 | |
2262 | my $top = int $self->{children}[1]{range}[0]; |
2295 | my $top = int $self->{children}[1]{range}[0]; |
2263 | |
2296 | |
2264 | my $y0 = $top; |
2297 | my $y0 = $top; |
2265 | my $y1 = $top + $self->{h}; |
2298 | my $y1 = $top + $self->{h}; |
… | |
… | |
2268 | |
2301 | |
2269 | my $layout = $self->{layout}; |
2302 | my $layout = $self->{layout}; |
2270 | |
2303 | |
2271 | $layout->set_font ($self->{font}) if $self->{font}; |
2304 | $layout->set_font ($self->{font}) if $self->{font}; |
2272 | |
2305 | |
|
|
2306 | glEnable GL_BLEND; |
|
|
2307 | glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA; |
|
|
2308 | |
2273 | for my $par (@{$self->{par}}) { |
2309 | for my $par (@{$self->{par}}) { |
2274 | my $h = $par->[0]; |
2310 | my $h = $par->[0]; |
2275 | |
2311 | |
2276 | if ($y0 < $y + $h && $y < $y1) { |
2312 | if ($y0 < $y + $h && $y < $y1) { |
2277 | $layout->set_foreground (@{ $par->[1] }); |
2313 | $layout->set_foreground (@{ $par->[1] }); |
|
|
2314 | $layout->set_width ($self->{w} - $par->[2]); |
2278 | $layout->set_markup ($par->[2]); |
2315 | $layout->set_markup ($par->[3]); |
2279 | |
2316 | |
2280 | my ($W, $H) = $layout->size; |
2317 | my ($w, $h, $data, $format, $internalformat) = $layout->render; |
2281 | CFClient::Texture->new_from_layout ($layout)->draw_quad_alpha_premultiplied (0, $y - $y0); |
2318 | |
|
|
2319 | glRasterPos $par->[2], $y - $y0; |
|
|
2320 | glDrawPixels $w, $h, $format, GL_UNSIGNED_BYTE, $data; |
2282 | } |
2321 | } |
2283 | |
2322 | |
2284 | $y += $h; |
2323 | $y += $h; |
2285 | } |
2324 | } |
2286 | |
2325 | |
2287 | glDisable GL_TEXTURE_2D; |
2326 | glDisable GL_BLEND; |
2288 | }; |
2327 | }; |
2289 | }); |
2328 | }); |
2290 | } |
2329 | } |
2291 | |
2330 | |
2292 | sub _draw { |
2331 | sub _draw { |
2293 | my ($self) = @_; |
2332 | my ($self) = @_; |
2294 | |
2333 | |
2295 | glEnable GL_TEXTURE_2D; |
2334 | glEnable GL_TEXTURE_2D; |
2296 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2335 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2297 | glColor 1, 1, 1, 1; |
2336 | glColor 1, 1, 1, 1; |
2298 | $self->{texture}->draw_quad_alpha_premultiplied (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h}); |
2337 | $self->{texture}->draw_quad_alpha (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h}); |
2299 | glDisable GL_TEXTURE_2D; |
2338 | glDisable GL_TEXTURE_2D; |
2300 | |
2339 | |
2301 | $self->{children}[1]->draw; |
2340 | $self->{children}[1]->draw; |
2302 | |
2341 | |
2303 | } |
2342 | } |
… | |
… | |
2402 | |
2441 | |
2403 | sub set_tooltip_from { |
2442 | sub set_tooltip_from { |
2404 | my ($self, $widget) = @_; |
2443 | my ($self, $widget) = @_; |
2405 | |
2444 | |
2406 | $self->add (new CFClient::UI::Label |
2445 | $self->add (new CFClient::UI::Label |
2407 | markup => $widget->{tooltip}, |
2446 | markup => $widget->{tooltip}, |
2408 | max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH, |
2447 | max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH, |
2409 | fontsize => 0.8, |
2448 | fontsize => 0.8, |
2410 | fg => [0, 0, 0, 1], |
2449 | fg => [0, 0, 0, 1], |
|
|
2450 | ellipsise => 0, |
2411 | font => ($widget->{tooltip_font} || $::FONT_PROP), |
2451 | font => ($widget->{tooltip_font} || $::FONT_PROP), |
2412 | ); |
2452 | ); |
2413 | } |
2453 | } |
2414 | |
2454 | |
2415 | sub size_request { |
2455 | sub size_request { |
2416 | my ($self) = @_; |
2456 | my ($self) = @_; |
… | |
… | |
2462 | use CFClient::OpenGL; |
2502 | use CFClient::OpenGL; |
2463 | |
2503 | |
2464 | sub new { |
2504 | sub new { |
2465 | my $class = shift; |
2505 | my $class = shift; |
2466 | |
2506 | |
2467 | $class->SUPER::new ( |
2507 | my $self = $class->SUPER::new ( |
2468 | aspect => 1, |
2508 | aspect => 1, |
2469 | @_, |
2509 | @_, |
2470 | ) |
2510 | ); |
|
|
2511 | |
|
|
2512 | if ($self->{anim} && $self->{animspeed}) { |
|
|
2513 | Scalar::Util::weaken (my $widget = $self); |
|
|
2514 | |
|
|
2515 | $self->{timer} = Event->timer ( |
|
|
2516 | at => $self->{animspeed} * int $::NOW / $self->{animspeed}, |
|
|
2517 | hard => 1, |
|
|
2518 | interval => $self->{animspeed}, |
|
|
2519 | cb => sub { |
|
|
2520 | ++$widget->{frame}; |
|
|
2521 | $widget->update; |
|
|
2522 | }, |
|
|
2523 | ); |
|
|
2524 | } |
|
|
2525 | |
|
|
2526 | $self |
2471 | } |
2527 | } |
2472 | |
2528 | |
2473 | sub size_request { |
2529 | sub size_request { |
2474 | (32, 8) |
2530 | (32, 8) |
2475 | } |
2531 | } |
2476 | |
2532 | |
|
|
2533 | sub update { |
|
|
2534 | my ($self) = @_; |
|
|
2535 | |
|
|
2536 | return unless $self->{visible}; |
|
|
2537 | |
|
|
2538 | $self->SUPER::update; |
|
|
2539 | } |
|
|
2540 | |
2477 | sub _draw { |
2541 | sub _draw { |
2478 | my ($self) = @_; |
2542 | my ($self) = @_; |
2479 | |
2543 | |
2480 | return unless $::CONN;#d# manage and cache textures differently |
2544 | return unless $::CONN;#d# manage and cache textures differently |
|
|
2545 | |
|
|
2546 | my $face; |
|
|
2547 | |
|
|
2548 | if ($self->{frame}) { |
|
|
2549 | my $anim = $::CONN->{anim}[$self->{anim}]; |
|
|
2550 | |
|
|
2551 | $face = $anim->[ $self->{frame} % @$anim ] |
|
|
2552 | if $anim && @$anim; |
|
|
2553 | } |
|
|
2554 | |
2481 | my $tex = $::CONN->{texture}[$::CONN->{faceid}[$self->{face}]]; |
2555 | my $tex = $::CONN->{texture}[$::CONN->{faceid}[$face || $self->{face}]]; |
2482 | |
2556 | |
2483 | # TODO animation |
|
|
2484 | if ($tex) { |
2557 | if ($tex) { |
2485 | glEnable GL_TEXTURE_2D; |
2558 | glEnable GL_TEXTURE_2D; |
2486 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2559 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
2487 | glColor 1, 1, 1, 1; |
2560 | glColor 1, 1, 1, 1; |
2488 | $tex->draw_quad_alpha (0, 0, $self->{w}, $self->{h}); |
2561 | $tex->draw_quad_alpha (0, 0, $self->{w}, $self->{h}); |
2489 | glDisable GL_TEXTURE_2D; |
2562 | glDisable GL_TEXTURE_2D; |
2490 | } |
2563 | } |
2491 | } |
2564 | } |
2492 | |
2565 | |
|
|
2566 | sub DESTROY { |
|
|
2567 | my ($self) = @_; |
|
|
2568 | |
|
|
2569 | $self->{timer}->cancel |
|
|
2570 | if $self->{timer}; |
|
|
2571 | |
|
|
2572 | $self->SUPER::DESTROY; |
|
|
2573 | } |
|
|
2574 | |
2493 | ############################################################################# |
2575 | ############################################################################# |
2494 | |
2576 | |
2495 | package CFClient::UI::InventoryItem; |
2577 | package CFClient::UI::InventoryItem; |
2496 | |
2578 | |
2497 | our @ISA = CFClient::UI::HBox::; |
2579 | our @ISA = CFClient::UI::HBox::; |
2498 | |
2580 | |
2499 | sub new { |
2581 | sub _item_to_desc { |
2500 | my $class = shift; |
2582 | my ($item) = @_; |
2501 | |
2583 | |
2502 | my %args = @_; |
2584 | my $desc = |
2503 | |
|
|
2504 | my $item = delete $args{item}; |
|
|
2505 | |
|
|
2506 | my $desc = $item->{nrof} < 2 |
2585 | $item->{nrof} < 2 |
2507 | ? $item->{name} |
2586 | ? $item->{name} |
2508 | : "$item->{nrof} $item->{name_pl}"; |
2587 | : "$item->{nrof} × $item->{name_pl}"; |
2509 | |
2588 | |
2510 | $item->{flags} & Crossfire::Protocol::F_OPEN |
2589 | $item->{flags} & Crossfire::Protocol::F_OPEN |
2511 | and $desc .= " (open)"; |
2590 | and $desc .= " (open)"; |
2512 | $item->{flags} & Crossfire::Protocol::F_APPLIED |
2591 | $item->{flags} & Crossfire::Protocol::F_APPLIED |
2513 | and $desc .= " (applied)"; |
2592 | and $desc .= " (applied)"; |
… | |
… | |
2520 | $item->{flags} & Crossfire::Protocol::F_DAMNED |
2599 | $item->{flags} & Crossfire::Protocol::F_DAMNED |
2521 | and $desc .= " (damned)"; |
2600 | and $desc .= " (damned)"; |
2522 | $item->{flags} & Crossfire::Protocol::F_LOCKED |
2601 | $item->{flags} & Crossfire::Protocol::F_LOCKED |
2523 | and $desc .= " *"; |
2602 | and $desc .= " *"; |
2524 | |
2603 | |
|
|
2604 | $desc |
|
|
2605 | } |
|
|
2606 | |
|
|
2607 | sub new { |
|
|
2608 | my $class = shift; |
|
|
2609 | |
|
|
2610 | my %args = @_; |
|
|
2611 | |
|
|
2612 | my $item = delete $args{item}; |
|
|
2613 | |
|
|
2614 | my $desc = _item_to_desc ($item); |
|
|
2615 | |
2525 | my $self = $class->SUPER::new ( |
2616 | my $self = $class->SUPER::new ( |
2526 | can_hover => 1, |
2617 | can_hover => 1, |
2527 | can_events => 1, |
2618 | can_events => 1, |
2528 | tooltip => (CFClient::UI::Label->escape ($desc) |
2619 | tooltip => ((CFClient::UI::Label::escape $desc) |
2529 | . "\n<small>leftclick - pick up\nmiddle click - apply\nrightclick - menu</small>"), |
2620 | . "\n<small>leftclick - pick up\nmiddle click - apply\nrightclick - menu</small>"), |
2530 | connect_button_down => sub { |
2621 | connect_button_down => sub { |
2531 | my ($self, $ev, $x, $y) = @_; |
2622 | my ($self, $ev, $x, $y) = @_; |
2532 | |
2623 | |
2533 | # todo: maybe put examine on 1? but should just be a tooltip :( |
2624 | # todo: maybe put examine on 1? but should just be a tooltip :( |
2534 | if ($ev->{button} == 1) { |
2625 | if ($ev->{button} == 1) { |
|
|
2626 | my $targ = $::CONN->{player}{tag}; |
|
|
2627 | |
|
|
2628 | if ($item->{container} == $::CONN->{player}{tag}) { |
|
|
2629 | $targ = $main::OPENCONT; |
|
|
2630 | } |
|
|
2631 | |
2535 | $::CONN->send ("move $::CONN->{player}{tag} $item->{tag} 0"); |
2632 | $::CONN->send ("move $targ $item->{tag} 0"); |
2536 | } elsif ($ev->{button} == 2) { |
2633 | } elsif ($ev->{button} == 2) { |
2537 | $::CONN->send ("apply $item->{tag}"); |
2634 | $::CONN->send ("apply $item->{tag}"); |
2538 | } elsif ($ev->{button} == 3) { |
2635 | } elsif ($ev->{button} == 3) { |
2539 | my @menu_items = ( |
2636 | my @menu_items = ( |
2540 | ["examine", sub { $::CONN->send ("examine $item->{tag}") }], |
2637 | ["examine", sub { $::CONN->send ("examine $item->{tag}") }], |
2541 | ["mark", sub { $::CONN->send ("mark $item->{tag}") }], |
2638 | ["mark", sub { $::CONN->send ("mark ". pack "N", $item->{tag}) }], |
2542 | ["apply", sub { $::CONN->send ("apply $item->{tag}") }], |
2639 | ["apply", sub { $::CONN->send ("apply $item->{tag}") }], |
|
|
2640 | ( |
|
|
2641 | $item->{flags} & Crossfire::Protocol::F_LOCKED |
|
|
2642 | ? ( |
|
|
2643 | ["unlock", sub { $::CONN->send ("lock " . pack "CN", 0, $item->{tag}) }], |
|
|
2644 | ) |
|
|
2645 | : ( |
|
|
2646 | ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $item->{tag}) }], |
2543 | ["drop", sub { $::CONN->send ("move $main::OPENCONT $item->{tag} 0") }], |
2647 | ["drop", sub { $::CONN->send ("move $main::OPENCONT $item->{tag} 0") }], |
2544 | [ |
2648 | ) |
2545 | $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock", |
|
|
2546 | sub { $::CONN->send ("lock ". () ."$item->{tag}") }, |
|
|
2547 | ], |
2649 | ), |
2548 | ); |
2650 | ); |
2549 | |
2651 | |
2550 | CFClient::UI::Menu->new (items => \@menu_items)->popup ($ev); |
2652 | CFClient::UI::Menu->new (items => \@menu_items)->popup ($ev); |
2551 | } |
2653 | } |
2552 | |
2654 | |
2553 | 1 |
2655 | 1 |
2554 | }, |
2656 | }, |
2555 | %args |
2657 | %args |
2556 | ); |
2658 | ); |
|
|
2659 | |
2557 | |
2660 | |
2558 | $self->add (new CFClient::UI::Face |
2661 | $self->add (new CFClient::UI::Face |
2559 | can_events => 0, |
2662 | can_events => 0, |
2560 | face => $item->{face}, |
2663 | face => $item->{face}, |
2561 | anim => $item->{anim}, |
2664 | anim => $item->{anim}, |
2562 | animspeed => $item->{animspeed}, |
2665 | animspeed => $item->{animspeed}, |
2563 | ); |
2666 | ); |
2564 | |
2667 | |
2565 | $self->add (new CFClient::UI::Label |
2668 | $self->add ($self->{name_lbl} = new CFClient::UI::Label can_events => 0); |
2566 | can_events => 0, |
2669 | |
2567 | text => $desc, |
2670 | $self->{item} = $item; |
2568 | ); |
2671 | |
|
|
2672 | $self->update_item; |
2569 | |
2673 | |
2570 | $self |
2674 | $self |
|
|
2675 | } |
|
|
2676 | |
|
|
2677 | sub update_item { |
|
|
2678 | my ($self) = @_; |
|
|
2679 | |
|
|
2680 | my $desc = _item_to_desc ($self->{item}); |
|
|
2681 | |
|
|
2682 | $self->{name_lbl}->set_text ($desc); |
2571 | } |
2683 | } |
2572 | |
2684 | |
2573 | ############################################################################# |
2685 | ############################################################################# |
2574 | |
2686 | |
2575 | package CFClient::UI::Inventory; |
2687 | package CFClient::UI::Inventory; |
… | |
… | |
2599 | } @$items; |
2711 | } @$items; |
2600 | |
2712 | |
2601 | $self->{real_items} = \@items; |
2713 | $self->{real_items} = \@items; |
2602 | |
2714 | |
2603 | for my $item (@items) { |
2715 | for my $item (@items) { |
2604 | my $desc = $item->{nrof} < 2 |
|
|
2605 | ? $item->{name} |
|
|
2606 | : "$item->{nrof} $item->{name_pl}"; |
|
|
2607 | |
|
|
2608 | $item = $item->{widget} ||= new CFClient::UI::InventoryItem item => $item; |
2716 | $item = $item->{widget} ||= new CFClient::UI::InventoryItem item => $item; |
|
|
2717 | $item->update_item (); |
2609 | } |
2718 | } |
2610 | |
2719 | |
2611 | $self->{scrolled}->add (@items); |
2720 | $self->{scrolled}->add (@items); |
2612 | |
2721 | |
2613 | # $range->{range} = [$self->{pos}, 0, $self->{max_pos}, $page]; |
2722 | # $range->{range} = [$self->{pos}, 0, $self->{max_pos}, $page]; |
… | |
… | |
2694 | |
2803 | |
2695 | package CFClient::UI::Statusbox; |
2804 | package CFClient::UI::Statusbox; |
2696 | |
2805 | |
2697 | our @ISA = CFClient::UI::VBox::; |
2806 | our @ISA = CFClient::UI::VBox::; |
2698 | |
2807 | |
|
|
2808 | sub new { |
|
|
2809 | my $class = shift; |
|
|
2810 | |
|
|
2811 | $class->SUPER::new ( |
|
|
2812 | fontsize => 0.8, |
|
|
2813 | @_, |
|
|
2814 | ) |
|
|
2815 | } |
|
|
2816 | |
2699 | sub reorder { |
2817 | sub reorder { |
2700 | my ($self) = @_; |
2818 | my ($self) = @_; |
2701 | my $NOW = time; |
2819 | my $NOW = time; |
2702 | |
2820 | |
2703 | while (my ($k, $v) = each %{ $self->{item} }) { |
2821 | while (my ($k, $v) = each %{ $self->{item} }) { |
… | |
… | |
2722 | : $item->{text}; |
2840 | : $item->{text}; |
2723 | |
2841 | |
2724 | for ($short) { |
2842 | for ($short) { |
2725 | s/^\s+//; |
2843 | s/^\s+//; |
2726 | s/\s+/ /g; |
2844 | s/\s+/ /g; |
2727 | my $len = int 40 / $item->{fontsize}; |
|
|
2728 | substr $_, $len, length, "…" if $len < length; |
|
|
2729 | } |
2845 | } |
2730 | |
2846 | |
2731 | new CFClient::UI::Label |
2847 | new CFClient::UI::Label |
2732 | markup => $short, |
2848 | markup => $short, |
2733 | tooltip => $item->{tooltip}, |
2849 | tooltip => $item->{tooltip}, |
2734 | tooltip_font => $::FONT_PROP, |
2850 | tooltip_font => $::FONT_PROP, |
2735 | tooltip_width => 0.67, |
2851 | tooltip_width => 0.67, |
2736 | fontsize => $item->{fontsize}, |
2852 | fontsize => $item->{fontsize} || $self->{fontsize}, |
|
|
2853 | max_w => $::WIDTH * 0.44, |
2737 | fg => $item->{fg}, |
2854 | fg => $item->{fg}, |
2738 | can_events => 1, |
2855 | can_events => 1, |
2739 | can_hover => 1 |
2856 | can_hover => 1 |
2740 | }; |
2857 | }; |
2741 | } |
2858 | } |
… | |
… | |
2768 | $self->{item}{$group} = { |
2885 | $self->{item}{$group} = { |
2769 | id => ++$self->{id}, |
2886 | id => ++$self->{id}, |
2770 | text => $text, |
2887 | text => $text, |
2771 | timeout => $timeout, |
2888 | timeout => $timeout, |
2772 | tooltip => $text, |
2889 | tooltip => $text, |
2773 | fontsize => 0.8, |
|
|
2774 | fg => [0.8, 0.8, 0.8, 0.8], |
2890 | fg => [0.8, 0.8, 0.8, 0.8], |
2775 | pri => 0, |
2891 | pri => 0, |
2776 | count => 1, |
2892 | count => 1, |
2777 | %arg, |
2893 | %arg, |
2778 | }; |
2894 | }; |
2779 | } |
2895 | } |
2780 | |
2896 | |
2781 | $self->reorder; |
2897 | $self->reorder; |
2782 | } |
2898 | } |
2783 | |
2899 | |
|
|
2900 | sub reconfigure { |
|
|
2901 | my ($self) = @_; |
|
|
2902 | |
|
|
2903 | delete $_->{label} |
|
|
2904 | for values %{ $self->{item} || {} }; |
|
|
2905 | |
|
|
2906 | $self->reorder; |
|
|
2907 | $self->SUPER::reconfigure; |
|
|
2908 | } |
|
|
2909 | |
2784 | ############################################################################# |
2910 | ############################################################################# |
2785 | |
2911 | |
2786 | package CFClient::UI::Root; |
2912 | package CFClient::UI::Root; |
2787 | |
2913 | |
2788 | our @ISA = CFClient::UI::Container::; |
2914 | our @ISA = CFClient::UI::Container::; |
… | |
… | |
2871 | $child->{x} = int $child->{x}; |
2997 | $child->{x} = int $child->{x}; |
2872 | $child->{y} = int $child->{y}; |
2998 | $child->{y} = int $child->{y}; |
2873 | } |
2999 | } |
2874 | |
3000 | |
2875 | $self->SUPER::add (@children); |
3001 | $self->SUPER::add (@children); |
|
|
3002 | |
|
|
3003 | while (@children) { |
|
|
3004 | my $w = pop @children; |
|
|
3005 | push @children, $w->children; |
|
|
3006 | $w->{visible} = 1; |
|
|
3007 | } |
|
|
3008 | } |
|
|
3009 | |
|
|
3010 | sub remove { |
|
|
3011 | my ($self, @children) = @_; |
|
|
3012 | |
|
|
3013 | $self->SUPER::remove (@children); |
|
|
3014 | |
|
|
3015 | while (@children) { |
|
|
3016 | my $w = pop @children; |
|
|
3017 | push @children, $w->children; |
|
|
3018 | delete $w->{visible}; |
|
|
3019 | } |
2876 | } |
3020 | } |
2877 | |
3021 | |
2878 | sub on_refresh { |
3022 | sub on_refresh { |
2879 | my ($self, $id, $cb) = @_; |
3023 | my ($self, $id, $cb) = @_; |
2880 | |
3024 | |
… | |
… | |
2949 | glClearColor +($::CFG->{fow_intensity}) x 3, 1; |
3093 | glClearColor +($::CFG->{fow_intensity}) x 3, 1; |
2950 | glClear GL_COLOR_BUFFER_BIT; |
3094 | glClear GL_COLOR_BUFFER_BIT; |
2951 | |
3095 | |
2952 | glMatrixMode GL_PROJECTION; |
3096 | glMatrixMode GL_PROJECTION; |
2953 | glLoadIdentity; |
3097 | glLoadIdentity; |
2954 | glOrtho 0, $::WIDTH, $::HEIGHT, 0, -10000 , 10000; |
3098 | glOrtho 0, $::WIDTH, $::HEIGHT, 0, -10000, 10000; |
2955 | glMatrixMode GL_MODELVIEW; |
3099 | glMatrixMode GL_MODELVIEW; |
2956 | glLoadIdentity; |
3100 | glLoadIdentity; |
2957 | |
3101 | |
2958 | $self->_draw; |
3102 | $self->_draw; |
2959 | } |
3103 | } |
… | |
… | |
2961 | ############################################################################# |
3105 | ############################################################################# |
2962 | |
3106 | |
2963 | package CFClient::UI; |
3107 | package CFClient::UI; |
2964 | |
3108 | |
2965 | $ROOT = new CFClient::UI::Root; |
3109 | $ROOT = new CFClient::UI::Root; |
2966 | $TOOLTIP = new CFClient::UI::Tooltip; |
3110 | $TOOLTIP = new CFClient::UI::Tooltip z => 900; |
2967 | |
3111 | |
2968 | 1 |
3112 | 1 |
2969 | |
3113 | |