1 | package Crossfire::Client::Widget; |
1 | package CFClient::Widget; |
2 | |
2 | |
3 | use strict; |
3 | use strict; |
4 | |
4 | |
5 | use Scalar::Util; |
5 | use Scalar::Util; |
6 | |
6 | |
7 | use SDL::OpenGL; |
7 | use SDL::OpenGL; |
8 | use SDL::OpenGL::Constants; |
8 | use SDL::OpenGL::Constants; |
9 | |
9 | |
10 | use Crossfire::Client; |
10 | use CFClient; |
11 | |
11 | |
12 | our ($FOCUS, $HOVER, $GRAB); # various widgets |
12 | our ($FOCUS, $HOVER, $GRAB); # various widgets |
13 | |
13 | |
14 | our $TOPLEVEL; |
14 | our $TOPLEVEL; |
15 | our $BUTTON_STATE; |
15 | our $BUTTON_STATE; |
… | |
… | |
73 | } |
73 | } |
74 | |
74 | |
75 | sub new { |
75 | sub new { |
76 | my $class = shift; |
76 | my $class = shift; |
77 | |
77 | |
78 | bless { @_ }, $class |
78 | bless { |
|
|
79 | x => 0, |
|
|
80 | y => 0, |
|
|
81 | z => 0, |
|
|
82 | @_ |
|
|
83 | }, $class |
79 | } |
84 | } |
80 | |
85 | |
81 | sub move { |
86 | sub move { |
82 | my ($self, $x, $y, $z) = @_; |
87 | my ($self, $x, $y, $z) = @_; |
83 | $self->{x} = $x; |
88 | $self->{x} = $x; |
… | |
… | |
210 | #$self->deactivate; |
215 | #$self->deactivate; |
211 | } |
216 | } |
212 | |
217 | |
213 | ############################################################################# |
218 | ############################################################################# |
214 | |
219 | |
215 | package Crossfire::Client::Widget::Container; |
220 | package CFClient::Widget::Container; |
216 | |
221 | |
217 | our @ISA = Crossfire::Client::Widget::; |
222 | our @ISA = CFClient::Widget::; |
218 | |
223 | |
219 | sub new { |
224 | sub new { |
220 | my ($class, @widgets) = @_; |
225 | my ($class, %arg) = @_; |
221 | |
226 | |
|
|
227 | my $children = delete $arg{children} || []; |
|
|
228 | |
222 | my $self = $class->SUPER::new (children => []); |
229 | my $self = $class->SUPER::new (children => [], %arg); |
223 | $self->add ($_) for @widgets; |
230 | $self->add ($_) for @$children; |
224 | |
231 | |
225 | $self |
232 | $self |
226 | } |
233 | } |
227 | |
234 | |
228 | sub add { |
235 | sub add { |
… | |
… | |
269 | $_->draw for @{$self->{children}}; |
276 | $_->draw for @{$self->{children}}; |
270 | } |
277 | } |
271 | |
278 | |
272 | ############################################################################# |
279 | ############################################################################# |
273 | |
280 | |
274 | package Crossfire::Client::Widget::Bin; |
281 | package CFClient::Widget::Bin; |
275 | |
282 | |
276 | our @ISA = Crossfire::Client::Widget::Container::; |
283 | our @ISA = CFClient::Widget::Container::; |
277 | |
284 | |
278 | sub child { $_[0]->{children}[0] } |
285 | sub child { $_[0]->{children}[0] } |
279 | |
286 | |
280 | sub size_request { |
287 | sub size_request { |
281 | $_[0]{children}[0]->size_request if $_[0]{children}[0]; |
288 | $_[0]{children}[0]->size_request if $_[0]{children}[0]; |
… | |
… | |
289 | if $self->{children}[0] |
296 | if $self->{children}[0] |
290 | } |
297 | } |
291 | |
298 | |
292 | ############################################################################# |
299 | ############################################################################# |
293 | |
300 | |
294 | package Crossfire::Client::Widget::Window; |
301 | package CFClient::Widget::Window; |
295 | |
302 | |
296 | our @ISA = Crossfire::Client::Widget::Bin::; |
303 | our @ISA = CFClient::Widget::Bin::; |
297 | |
304 | |
298 | use SDL::OpenGL; |
305 | use SDL::OpenGL; |
299 | |
306 | |
300 | sub new { |
307 | sub new { |
301 | my ($class, $x, $y, $z, $w, $h) = @_; |
308 | my ($class, %arg) = @_; |
302 | |
309 | |
303 | my $self = $class->SUPER::new; |
310 | my $self = $class->SUPER::new (%arg); |
304 | |
|
|
305 | @$self{qw(x y z w h)} = ($x, $y, $z, $w, $h); |
|
|
306 | } |
311 | } |
307 | |
312 | |
308 | sub update { |
313 | sub update { |
309 | my ($self) = @_; |
314 | my ($self) = @_; |
310 | |
315 | |
|
|
316 | # we want to do this delayed... |
311 | $self->render_chld; |
317 | $self->render_chld; |
312 | $self->SUPER::update; |
318 | $self->SUPER::update; |
313 | } |
319 | } |
314 | |
320 | |
315 | sub render_chld { |
321 | sub render_chld { |
316 | my ($self) = @_; |
322 | my ($self) = @_; |
317 | |
323 | |
318 | $self->{texture} = |
324 | $self->{texture} = |
319 | Crossfire::Client::Texture->new_from_opengl ( |
325 | CFClient::Texture->new_from_opengl ( |
320 | $self->{w}, $self->{h}, sub { $self->child->draw } |
326 | $self->{w}, $self->{h}, sub { $self->child->draw } |
321 | ); |
327 | ); |
322 | } |
328 | } |
323 | |
329 | |
324 | sub size_allocate { |
330 | sub size_allocate { |
… | |
… | |
350 | glDisable GL_TEXTURE_2D; |
356 | glDisable GL_TEXTURE_2D; |
351 | } |
357 | } |
352 | |
358 | |
353 | ############################################################################# |
359 | ############################################################################# |
354 | |
360 | |
355 | package Crossfire::Client::Widget::Frame; |
361 | package CFClient::Widget::Frame; |
356 | |
362 | |
357 | our @ISA = Crossfire::Client::Widget::Bin::; |
363 | our @ISA = CFClient::Widget::Bin::; |
358 | |
364 | |
359 | use SDL::OpenGL; |
365 | use SDL::OpenGL; |
360 | |
366 | |
361 | sub size_request { |
367 | sub size_request { |
362 | my ($self) = @_; |
368 | my ($self) = @_; |
… | |
… | |
396 | $chld->draw; |
402 | $chld->draw; |
397 | } |
403 | } |
398 | |
404 | |
399 | ############################################################################# |
405 | ############################################################################# |
400 | |
406 | |
401 | package Crossfire::Client::Widget::FancyFrame; |
407 | package CFClient::Widget::FancyFrame; |
402 | |
408 | |
403 | our @ISA = Crossfire::Client::Widget::Bin::; |
409 | our @ISA = CFClient::Widget::Bin::; |
404 | |
410 | |
405 | use SDL::OpenGL; |
411 | use SDL::OpenGL; |
406 | |
412 | |
407 | my @tex = |
413 | my @tex = |
408 | map { new_from_file Crossfire::Client::Texture Crossfire::Client::find_rcfile $_ } |
414 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } |
409 | qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); |
415 | qw(d1_bg.png d1_border_top.png d1_border_right.png d1_border_left.png d1_border_bottom.png); |
410 | |
416 | |
411 | sub size_request { |
417 | sub size_request { |
412 | my ($self) = @_; |
418 | my ($self) = @_; |
413 | |
419 | |
… | |
… | |
479 | |
485 | |
480 | } |
486 | } |
481 | |
487 | |
482 | ############################################################################# |
488 | ############################################################################# |
483 | |
489 | |
484 | package Crossfire::Client::Widget::Table; |
490 | package CFClient::Widget::Table; |
485 | |
491 | |
486 | our @ISA = Crossfire::Client::Widget::Bin::; |
492 | our @ISA = CFClient::Widget::Bin::; |
487 | |
493 | |
488 | use SDL::OpenGL; |
494 | use SDL::OpenGL; |
489 | |
495 | |
490 | sub add { |
496 | sub add { |
491 | my ($self, $x, $y, $chld) = @_; |
497 | my ($self, $x, $y, $chld) = @_; |
… | |
… | |
566 | } |
572 | } |
567 | } |
573 | } |
568 | |
574 | |
569 | ############################################################################# |
575 | ############################################################################# |
570 | |
576 | |
571 | package Crossfire::Client::Widget::VBox; |
577 | package CFClient::Widget::VBox; |
572 | |
578 | |
573 | our @ISA = Crossfire::Client::Widget::Container::; |
579 | our @ISA = CFClient::Widget::Container::; |
574 | |
580 | |
575 | use SDL::OpenGL; |
581 | use SDL::OpenGL; |
576 | |
582 | |
577 | sub size_request { |
583 | sub size_request { |
578 | my ($self) = @_; |
584 | my ($self) = @_; |
… | |
… | |
626 | } |
632 | } |
627 | } |
633 | } |
628 | |
634 | |
629 | ############################################################################# |
635 | ############################################################################# |
630 | |
636 | |
631 | package Crossfire::Client::Widget::Label; |
637 | package CFClient::Widget::Label; |
632 | |
638 | |
633 | our @ISA = Crossfire::Client::Widget::; |
639 | our @ISA = CFClient::Widget::; |
634 | |
640 | |
635 | use SDL::OpenGL; |
641 | use SDL::OpenGL; |
636 | |
642 | |
637 | sub new { |
643 | sub new { |
638 | my ($class, $x, $y, $z, $height, $text) = @_; |
644 | my ($class, %arg) = @_; |
639 | |
|
|
640 | $height ||= $::FONTSIZE; |
|
|
641 | |
645 | |
642 | # TODO: color, and make height, xyz etc. optional |
646 | # TODO: color, and make height, xyz etc. optional |
643 | my $self = $class->SUPER::new ( |
647 | my $self = $class->SUPER::new ( |
644 | x => $x, |
648 | color => [1, 1, 1], |
645 | y => $y, |
649 | height => $::FONTSIZE, |
646 | z => $z, |
650 | text => "", |
647 | height => $height, |
|
|
648 | layout => new Crossfire::Client::Layout, |
651 | layout => new CFClient::Layout, |
|
|
652 | %arg |
649 | ); |
653 | ); |
650 | |
654 | |
651 | $self->set_text ($text); |
655 | $self->set_text ($self->{text}); |
652 | |
656 | |
653 | $self |
657 | $self |
654 | } |
658 | } |
655 | |
659 | |
656 | sub set_text { |
660 | sub set_text { |
… | |
… | |
670 | |
674 | |
671 | sub size_request { |
675 | sub size_request { |
672 | my ($self) = @_; |
676 | my ($self) = @_; |
673 | |
677 | |
674 | $self->{layout}->set_width; |
678 | $self->{layout}->set_width; |
|
|
679 | $self->{layout}->set_height ($self->{height}); |
675 | $self->{layout}->size |
680 | $self->{layout}->size |
676 | # if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack |
681 | # if ($self->{texture}{width} > 1 && $self->{texture}{height} > 1) { #TODO: hack |
677 | # ( |
682 | # ( |
678 | # $self->{texture}{width}, |
683 | # $self->{texture}{width}, |
679 | # $self->{texture}{height}, |
684 | # $self->{texture}{height}, |
680 | # ) |
685 | # ) |
681 | # } else { |
686 | # } else { |
682 | # my ($w, $h, $data) = Crossfire::Client::font_render "Yy", $self->{height}; |
687 | # my ($w, $h, $data) = CFClient::font_render "Yy", $self->{height}; |
683 | # |
688 | # |
684 | # ($w, $h) |
689 | # ($w, $h) |
685 | # } |
690 | # } |
686 | } |
691 | } |
687 | |
692 | |
… | |
… | |
695 | sub _draw { |
700 | sub _draw { |
696 | my ($self) = @_; |
701 | my ($self) = @_; |
697 | |
702 | |
698 | my $tex = $self->{texture} ||= do { |
703 | my $tex = $self->{texture} ||= do { |
699 | $self->{layout}->set_width ($self->{w}); |
704 | $self->{layout}->set_width ($self->{w}); |
700 | new_from_layout Crossfire::Client::Texture $self->{layout}; |
705 | new_from_layout CFClient::Texture $self->{layout}; |
701 | }; |
706 | }; |
702 | |
707 | |
703 | glEnable GL_BLEND; |
708 | glEnable GL_BLEND; |
704 | glEnable GL_TEXTURE_2D; |
709 | glEnable GL_TEXTURE_2D; |
705 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
710 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
706 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
711 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
707 | |
712 | |
708 | glColor 1, 0, 0, 1; # TODO color |
713 | glColor @{$self->{color}}; |
709 | |
714 | |
710 | $tex->draw_quad (0, 0); |
715 | $tex->draw_quad (0, 0); |
711 | |
716 | |
712 | glDisable GL_BLEND; |
717 | glDisable GL_BLEND; |
713 | glDisable GL_TEXTURE_2D; |
718 | glDisable GL_TEXTURE_2D; |
714 | } |
719 | } |
715 | |
720 | |
716 | ############################################################################# |
721 | ############################################################################# |
717 | |
722 | |
718 | package Crossfire::Client::Widget::Entry; |
723 | package CFClient::Widget::Entry; |
719 | |
724 | |
720 | our @ISA = Crossfire::Client::Widget::Label::; |
725 | our @ISA = CFClient::Widget::Label::; |
721 | |
726 | |
722 | use SDL; |
727 | use SDL; |
723 | use SDL::OpenGL; |
728 | use SDL::OpenGL; |
724 | |
729 | |
725 | sub key_down { |
730 | sub key_down { |
… | |
… | |
771 | $self->SUPER::_draw; |
776 | $self->SUPER::_draw; |
772 | } |
777 | } |
773 | |
778 | |
774 | ############################################################################# |
779 | ############################################################################# |
775 | |
780 | |
776 | package Crossfire::Client::Widget::MapWidget; |
781 | package CFClient::Widget::MapWidget; |
777 | |
782 | |
778 | use strict; |
783 | use strict; |
779 | |
784 | |
780 | use List::Util qw(min max); |
785 | use List::Util qw(min max); |
781 | |
786 | |
782 | use SDL; |
787 | use SDL; |
783 | use SDL::OpenGL; |
788 | use SDL::OpenGL; |
784 | use SDL::OpenGL::Constants; |
789 | use SDL::OpenGL::Constants; |
785 | |
790 | |
786 | our @ISA = Crossfire::Client::Widget::; |
791 | our @ISA = CFClient::Widget::; |
|
|
792 | |
|
|
793 | sub new { |
|
|
794 | my $class = shift; |
|
|
795 | |
|
|
796 | $class->SUPER::new ( |
|
|
797 | z => -1, |
|
|
798 | list => (glGenLists 1), |
|
|
799 | @_ |
|
|
800 | ) |
|
|
801 | } |
787 | |
802 | |
788 | sub key_down { |
803 | sub key_down { |
789 | print "MAPKEYDOWN\n"; |
804 | print "MAPKEYDOWN\n"; |
790 | } |
805 | } |
791 | |
806 | |
… | |
… | |
797 | 1 + int $::WIDTH / 32, |
812 | 1 + int $::WIDTH / 32, |
798 | 1 + int $::HEIGHT / 32, |
813 | 1 + int $::HEIGHT / 32, |
799 | ) |
814 | ) |
800 | } |
815 | } |
801 | |
816 | |
|
|
817 | sub update { |
|
|
818 | my ($self) = @_; |
|
|
819 | |
|
|
820 | $self->{need_update} = 1; |
|
|
821 | } |
|
|
822 | |
802 | sub _draw { |
823 | sub _draw { |
803 | my ($self) = @_; |
824 | my ($self) = @_; |
804 | |
825 | |
|
|
826 | if (delete $self->{need_update}) { |
|
|
827 | glNewList $self->{list}, GL_COMPILE; |
|
|
828 | |
805 | my $mx = $::CONN->{mapx}; |
829 | my $mx = $::CONN->{mapx}; |
806 | my $my = $::CONN->{mapy}; |
830 | my $my = $::CONN->{mapy}; |
807 | |
831 | |
808 | my $map = $::CONN->{map}; |
832 | my $map = $::CONN->{map}; |
809 | |
833 | |
810 | my ($xofs, $yofs); |
834 | my ($xofs, $yofs); |
811 | |
835 | |
812 | my $sw = 1 + int $::WIDTH / 32; |
836 | my $sw = 1 + int $::WIDTH / 32; |
813 | my $sh = 1 + int $::HEIGHT / 32; |
837 | my $sh = 1 + int $::HEIGHT / 32; |
814 | |
838 | |
815 | if ($::CONN->{mapw} > $sw) { |
839 | if ($::CONN->{mapw} > $sw) { |
816 | $xofs = $mx + ($::CONN->{mapw} - $sw) * 0.5; |
840 | $xofs = $mx + ($::CONN->{mapw} - $sw) * 0.5; |
817 | } else { |
841 | } else { |
818 | $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs}; |
842 | $xofs = $self->{xofs} = min $mx, max $mx + $::CONN->{mapw} - $sw + 1, $self->{xofs}; |
819 | } |
843 | } |
820 | |
844 | |
821 | if ($::CONN->{maph} > $sh) { |
845 | if ($::CONN->{maph} > $sh) { |
822 | $yofs = $my + ($::CONN->{maph} - $sh) * 0.5; |
846 | $yofs = $my + ($::CONN->{maph} - $sh) * 0.5; |
823 | } else { |
847 | } else { |
824 | $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs}; |
848 | $yofs = $self->{yofs} = min $my, max $my + $::CONN->{maph} - $sh + 1, $self->{yofs}; |
825 | } |
849 | } |
826 | |
850 | |
827 | glEnable GL_TEXTURE_2D; |
851 | glEnable GL_TEXTURE_2D; |
828 | glEnable GL_BLEND; |
852 | glEnable GL_BLEND; |
829 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
853 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
830 | |
854 | |
831 | my $sw4 = ($sw + 3) & ~3; |
855 | my $sw4 = ($sw + 3) & ~3; |
832 | my $darkness = "\x00" x ($sw4 * $sh); |
856 | my $darkness = "\x00" x ($sw4 * $sh); |
833 | |
857 | |
834 | for my $x (0 .. $sw - 1) { |
858 | for my $x (0 .. $sw - 1) { |
835 | my $row = $map->[$x + $xofs]; |
859 | my $row = $map->[$x + $xofs]; |
836 | for my $y (0 .. $sh - 1) { |
860 | for my $y (0 .. $sh - 1) { |
837 | |
861 | |
838 | my $cell = $row->[$y + $yofs] |
862 | my $cell = $row->[$y + $yofs] |
839 | or next; |
863 | or next; |
840 | |
864 | |
841 | my $dark = $cell->[0]; |
865 | my $dark = $cell->[0]; |
842 | if ($dark < 0) { |
866 | if ($dark < 0) { |
843 | substr $darkness, $y * $sw4 + $x, 1, chr 224; |
867 | substr $darkness, $y * $sw4 + $x, 1, chr 224; |
844 | } else { |
868 | } else { |
845 | substr $darkness, $y * $sw4 + $x, 1, chr 255 - $dark; |
869 | substr $darkness, $y * $sw4 + $x, 1, chr 255 - $dark; |
846 | } |
870 | } |
847 | |
871 | |
848 | for my $num (grep $_, @$cell[1,2,3]) { |
872 | for my $num (grep $_, @$cell[1,2,3]) { |
849 | my $tex = $::CONN->{face}[$num]{texture} || next; |
873 | my $tex = $::CONN->{face}[$num]{texture} || next; |
850 | |
874 | |
851 | my $w = $tex->{width}; |
875 | my $w = $tex->{width}; |
852 | my $h = $tex->{height}; |
876 | my $h = $tex->{height}; |
853 | |
877 | |
854 | $tex->draw_quad (($x + 1) * 32 - $w, ($y + 1) * 32 - $h, $w, $h); |
878 | $tex->draw_quad (($x + 1) * 32 - $w, ($y + 1) * 32 - $h, $w, $h); |
|
|
879 | } |
855 | } |
880 | } |
856 | } |
881 | } |
857 | } |
|
|
858 | |
882 | |
859 | # if (1) { # higher quality darkness |
883 | # if (1) { # higher quality darkness |
860 | # $lighting =~ s/(.)/$1$1$1/gs; |
884 | # $lighting =~ s/(.)/$1$1$1/gs; |
861 | # my $pb = new_from_data Gtk2::Gdk::Pixbuf $lighting, "rgb", 0, 8, $sw4, $sh, $sw4 * 3; |
885 | # my $pb = new_from_data Gtk2::Gdk::Pixbuf $lighting, "rgb", 0, 8, $sw4, $sh, $sw4 * 3; |
862 | # |
886 | # |
… | |
… | |
864 | # |
888 | # |
865 | # $lighting = $pb->get_pixels; |
889 | # $lighting = $pb->get_pixels; |
866 | # $lighting =~ s/(.)../$1/gs; |
890 | # $lighting =~ s/(.)../$1/gs; |
867 | # } |
891 | # } |
868 | |
892 | |
869 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
893 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
870 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
894 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
871 | |
895 | |
872 | $darkness = new Crossfire::Client::Texture |
896 | $darkness = new CFClient::Texture |
873 | width => $sw4, |
897 | width => $sw4, |
874 | height => $sh, |
898 | height => $sh, |
875 | data => $darkness, |
899 | data => $darkness, |
876 | internalformat => GL_ALPHA, |
900 | internalformat => GL_ALPHA, |
877 | format => GL_ALPHA; |
901 | format => GL_ALPHA; |
878 | |
902 | |
879 | glColor 0.45, 0.45, 0.45, 1; |
903 | glColor 0.45, 0.45, 0.45, 1; |
880 | $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32); |
904 | $darkness->draw_quad (0, 0, $sw4 * 32, $sh * 32); |
881 | |
905 | |
882 | glDisable GL_TEXTURE_2D; |
906 | glDisable GL_TEXTURE_2D; |
883 | glDisable GL_BLEND; |
907 | glDisable GL_BLEND; |
|
|
908 | |
|
|
909 | glEndList; |
|
|
910 | } |
|
|
911 | |
|
|
912 | glCallList $self->{list}; |
884 | } |
913 | } |
885 | |
914 | |
886 | my %DIR = ( |
915 | my %DIR = ( |
887 | SDLK_KP8, [1, "north"], |
916 | SDLK_KP8, [1, "north"], |
888 | SDLK_KP9, [2, "northeast"], |
917 | SDLK_KP9, [2, "northeast"], |
… | |
… | |
934 | } |
963 | } |
935 | } |
964 | } |
936 | |
965 | |
937 | ############################################################################# |
966 | ############################################################################# |
938 | |
967 | |
939 | package Crossfire::Client::Widget::Animator; |
968 | package CFClient::Widget::Animator; |
940 | |
969 | |
941 | use SDL::OpenGL; |
970 | use SDL::OpenGL; |
942 | |
971 | |
943 | our @ISA = Crossfire::Client::Widget::Bin::; |
972 | our @ISA = CFClient::Widget::Bin::; |
944 | |
973 | |
945 | sub moveto { |
974 | sub moveto { |
946 | my ($self, $x, $y) = @_; |
975 | my ($self, $x, $y) = @_; |
947 | |
976 | |
948 | $self->{moveto} = [$self->{x}, $self->{y}, $x, $y]; |
977 | $self->{moveto} = [$self->{x}, $self->{y}, $x, $y]; |
… | |
… | |
976 | glPopMatrix; |
1005 | glPopMatrix; |
977 | } |
1006 | } |
978 | |
1007 | |
979 | ############################################################################# |
1008 | ############################################################################# |
980 | |
1009 | |
981 | package Crossfire::Client::Widget::Toplevel; |
1010 | package CFClient::Widget::Toplevel; |
982 | |
1011 | |
983 | our @ISA = Crossfire::Client::Widget::Container::; |
1012 | our @ISA = CFClient::Widget::Container::; |
984 | |
1013 | |
985 | sub size_request { |
1014 | sub size_request { |
986 | ($::WIDTH, $::HEIGHT) |
1015 | ($::WIDTH, $::HEIGHT) |
987 | } |
1016 | } |
988 | |
1017 | |
… | |
… | |
1022 | $self->_draw; |
1051 | $self->_draw; |
1023 | } |
1052 | } |
1024 | |
1053 | |
1025 | ############################################################################# |
1054 | ############################################################################# |
1026 | |
1055 | |
1027 | package Crossfire::Client::Widget; |
1056 | package CFClient::Widget; |
1028 | |
1057 | |
1029 | $TOPLEVEL = new Crossfire::Client::Widget::Toplevel; |
1058 | $TOPLEVEL = new CFClient::Widget::Toplevel; |
1030 | |
1059 | |
1031 | 1 |
1060 | 1 |
1032 | |
1061 | |