… | |
… | |
1255 | |
1255 | |
1256 | package CFClient::UI::CheckBox; |
1256 | package CFClient::UI::CheckBox; |
1257 | |
1257 | |
1258 | our @ISA = CFClient::UI::DrawBG::; |
1258 | our @ISA = CFClient::UI::DrawBG::; |
1259 | |
1259 | |
|
|
1260 | my @tex = |
|
|
1261 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } |
|
|
1262 | qw(c1_checkbox_bg.png c1_checkbox_active.png); |
|
|
1263 | |
1260 | use SDL; |
1264 | use SDL; |
1261 | use SDL::OpenGL; |
1265 | use SDL::OpenGL; |
1262 | |
1266 | |
1263 | sub new { |
1267 | sub new { |
1264 | my $class = shift; |
1268 | my $class = shift; |
… | |
… | |
1301 | $self->SUPER::_draw; |
1305 | $self->SUPER::_draw; |
1302 | |
1306 | |
1303 | glTranslate $self->{padding} + 0.375, $self->{padding} + 0.375, 0; |
1307 | glTranslate $self->{padding} + 0.375, $self->{padding} + 0.375, 0; |
1304 | |
1308 | |
1305 | my $s = (List::Util::min @$self{qw(w h)}) - $self->{padding} * 2; |
1309 | my $s = (List::Util::min @$self{qw(w h)}) - $self->{padding} * 2; |
1306 | |
1310 | |
1307 | glColor @{ $FOCUS == $self ? $self->{active_fg} : $self->{fg} }; |
1311 | glColor @{ $FOCUS == $self ? $self->{active_fg} : $self->{fg} }; |
1308 | |
1312 | |
1309 | glBegin GL_LINE_LOOP; |
1313 | glEnable GL_BLEND; |
1310 | glVertex 0 , 0; |
1314 | glEnable GL_TEXTURE_2D; |
1311 | glVertex 0 , $s; |
1315 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
1312 | glVertex $s, $s; |
|
|
1313 | glVertex $s, 0; |
|
|
1314 | glEnd; |
|
|
1315 | |
1316 | |
1316 | if ($self->{state}) { |
1317 | my $tex = $self->{state} ? $tex[1] : $tex[0]; |
1317 | glBegin GL_LINES; |
1318 | |
1318 | glVertex 0 , 0; |
1319 | $tex->draw_quad (0, 0, $s, $s); |
1319 | glVertex $s, $s; |
1320 | |
1320 | glVertex $s, 0; |
1321 | glDisable GL_TEXTURE_2D; |
1321 | glVertex 0 , $s; |
1322 | glDisable GL_BLEND; |
1322 | glEnd; |
|
|
1323 | } |
|
|
1324 | } |
1323 | } |
1325 | |
1324 | |
1326 | ############################################################################# |
1325 | ############################################################################# |
1327 | |
1326 | |
1328 | package CFClient::UI::Slider; |
1327 | package CFClient::UI::Slider; |