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.10 by root, Fri Apr 7 20:34:44 2006 UTC vs.
Revision 1.11 by elmex, Fri Apr 7 20:39:58 2006 UTC

1package Crossfire::Client::Widget; 1package Crossfire::Client::Widget;
2 2
3use strict; 3use strict;
4use SDL::OpenGL;
5use SDL::OpenGL::Constants;
4 6
5our $FOCUS; # the widget with current focus 7our $FOCUS; # the widget with current focus
6our %ACTIVE_WIDGETS; 8our %ACTIVE_WIDGETS;
7 9
8# class methods for events 10# class methods for events
48 50
49sub button_up { 51sub button_up {
50 my ($widget, $sdlev) = @_; 52 my ($widget, $sdlev) = @_;
51} 53}
52 54
55sub x { $_[0]->{x} = $_[1] if $_[1]; $_[0]->{x} }
56sub y { $_[0]->{y} = $_[1] if $_[1]; $_[0]->{y} }
57
53sub draw { 58sub draw {
59 my ($self) = @_;
60
61 glPushMatrix;
62 glTranslate ($self->{x} || 0, $self->{y} || 0, 0);
63 $self->_draw;
64 glPopMatrix;
65}
66
67sub _draw {
54 my ($widget) = @_; 68 my ($widget) = @_;
55} 69}
56 70
57sub bbox { 71sub bbox {
58 my ($widget) = @_; 72 my ($widget) = @_;
70 $self->{texture} = new_from_ttf Crossfire::Client::Texture $ttf, $text; 84 $self->{texture} = new_from_ttf Crossfire::Client::Texture $ttf, $text;
71 85
72 $self 86 $self
73} 87}
74 88
75sub draw { 89sub _draw {
76 my ($self) = @_; 90 my ($self) = @_;
77 91
78 my $tex = $self->{texture}; 92 my $tex = $self->{texture};
79 93
80 glEnable GL_TEXTURE_2D; 94 glEnable GL_TEXTURE_2D;
102sub add_line { 116sub add_line {
103 my ($self, $line) = @_; 117 my ($self, $line) = @_;
104 push @{$self->{lines}}, $line; 118 push @{$self->{lines}}, $line;
105} 119}
106 120
107sub draw { 121sub _draw {
108 my ($self) = @_; 122 my ($self) = @_;
109 123
110} 124}
111 125
112package Crossfire::Client::Widget::MapWidget; 126package Crossfire::Client::Widget::MapWidget;
123} 137}
124 138
125sub key_up { 139sub key_up {
126} 140}
127 141
128sub draw { 142sub _draw {
129 glEnable GL_TEXTURE_2D; 143 glEnable GL_TEXTURE_2D;
130 glEnable GL_BLEND; 144 glEnable GL_BLEND;
131 145
132 my $map = $::CONN->{map}; 146 my $map = $::CONN->{map};
133 147

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines