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.151 by root, Sun Apr 23 00:57:39 2006 UTC vs.
Revision 1.154 by root, Sun Apr 23 02:20:57 2006 UTC

1179 1179
1180sub set_fontsize { 1180sub set_fontsize {
1181 my ($self, $fontsize) = @_; 1181 my ($self, $fontsize) = @_;
1182 1182
1183 $self->{fontsize} = $fontsize; 1183 $self->{fontsize} = $fontsize;
1184 delete $self->{texture};
1184 $self->check_size; 1185 $self->check_size;
1186 $self->update;
1185} 1187}
1186 1188
1187sub _draw { 1189sub _draw {
1188 my ($self) = @_; 1190 my ($self) = @_;
1189 1191
2129 $self->emit (changed => $self->{state}); 2131 $self->emit (changed => $self->{state});
2130} 2132}
2131 2133
2132############################################################################# 2134#############################################################################
2133 2135
2136package CFClient::UI::Tooltip;
2137
2138our @ISA = CFClient::UI::Bin::;
2139
2140use CFClient::OpenGL;
2141
2142sub new {
2143 my $class = shift;
2144
2145 $class->SUPER::new (
2146 @_,
2147 can_events => 0,
2148 )
2149}
2150
2151sub set_text {
2152 my ($self, $text) = @_;
2153
2154 $self->{label} ||= new CFClient::UI::Label fontsize => 0.8, fg => [0, 0, 0];
2155 $self->{label}->set_text ($text);
2156 $self->add ($self->{label});
2157}
2158
2159sub size_request {
2160 my ($self) = @_;
2161
2162 my ($w, $h) = @{$self->child}{qw(req_w req_h)};
2163
2164 $w = List::Util::min $::WIDTH * 0.2, $w;
2165 $h = List::Util::max $::HEIGHT * 0.2, $h;
2166
2167 ($w + 4, $h + 4)
2168}
2169
2170sub _draw {
2171 my ($self) = @_;
2172
2173 glPushMatrix;
2174 glTranslate 0.375, 0.375;
2175
2176 my ($w, $h) = @$self{qw(w h)};
2177
2178 glColor 1, 0.8, 0.4;
2179 glBegin GL_QUADS;
2180 glVertex 0 , 0;
2181 glVertex 0 , $h;
2182 glVertex $w, $h;
2183 glVertex $w, 0;
2184 glEnd;
2185
2186 glColor 0, 0, 0;
2187 glBegin GL_LINE_LOOP;
2188 glVertex 0 , 0;
2189 glVertex 0 , $h;
2190 glVertex $w, $h;
2191 glVertex $w, 0;
2192 glEnd;
2193
2194 glPopMatrix;
2195
2196 glTranslate 2, 2;
2197 $self->SUPER::_draw;
2198}
2199
2200#############################################################################
2201
2134package CFClient::UI::Root; 2202package CFClient::UI::Root;
2135 2203
2136our @ISA = CFClient::UI::Container::; 2204our @ISA = CFClient::UI::Container::;
2137 2205
2138use CFClient::OpenGL; 2206use CFClient::OpenGL;
2213############################################################################# 2281#############################################################################
2214 2282
2215package CFClient::UI; 2283package CFClient::UI;
2216 2284
2217$ROOT = new CFClient::UI::Root; 2285$ROOT = new CFClient::UI::Root;
2218$TOOLTIP = new CFClient::UI::Label fontsize => 0.8, can_events => 0; 2286$TOOLTIP = new CFClient::UI::Tooltip;
2219 2287
22201 22881
2221 2289

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines