… | |
… | |
2149 | } |
2149 | } |
2150 | |
2150 | |
2151 | sub set_text { |
2151 | sub set_text { |
2152 | my ($self, $text) = @_; |
2152 | my ($self, $text) = @_; |
2153 | |
2153 | |
2154 | $self->{label} ||= new CFClient::UI::Label fontsize => 0.8; |
2154 | $self->{label} ||= new CFClient::UI::Label fontsize => 0.8, fg => [0, 0, 0]; |
2155 | $self->{label}->set_text ($text); |
2155 | $self->{label}->set_text ($text); |
2156 | $self->add ($self->{label}); |
2156 | $self->add ($self->{label}); |
2157 | } |
2157 | } |
2158 | |
2158 | |
2159 | sub size_request { |
2159 | sub size_request { |
2160 | my ($self) = @_; |
2160 | my ($self) = @_; |
2161 | |
2161 | |
2162 | my ($w, $h) = @{$self->child}{qw(req_w req_h)}; |
2162 | my ($w, $h) = @{$self->child}{qw(req_w req_h)}; |
2163 | |
2163 | |
2164 | $w = List::Util::min $::WIDTH * 0.2, $w; |
2164 | $w = List::Util::min $::WIDTH * 0.2, $w; |
|
|
2165 | $h = List::Util::max $::HEIGHT * 0.2, $h; |
2165 | |
2166 | |
2166 | ($w, $h) |
2167 | ($w + 4, $h + 4) |
|
|
2168 | } |
|
|
2169 | |
|
|
2170 | sub _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; |
2167 | } |
2198 | } |
2168 | |
2199 | |
2169 | ############################################################################# |
2200 | ############################################################################# |
2170 | |
2201 | |
2171 | package CFClient::UI::Root; |
2202 | package CFClient::UI::Root; |