… | |
… | |
225 | glPopMatrix; |
225 | glPopMatrix; |
226 | |
226 | |
227 | if ($self == $HOVER && $self->{can_hover}) { |
227 | if ($self == $HOVER && $self->{can_hover}) { |
228 | my ($x, $y) = @$self{qw(x y)}; |
228 | my ($x, $y) = @$self{qw(x y)}; |
229 | |
229 | |
230 | glColor 0, 0, 1, 0.2; |
230 | glColor 1, 0.8, 0.5, 0.2; |
231 | glEnable GL_BLEND; |
231 | glEnable GL_BLEND; |
232 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
232 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
233 | glBegin GL_QUADS; |
233 | glBegin GL_QUADS; |
234 | glVertex $x , $y; |
234 | glVertex $x , $y; |
235 | glVertex $x + $self->{w}, $y; |
235 | glVertex $x + $self->{w}, $y; |
… | |
… | |
1043 | glEnable GL_TEXTURE_2D; |
1043 | glEnable GL_TEXTURE_2D; |
1044 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1044 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1045 | |
1045 | |
1046 | glColor @{$self->{fg}}; |
1046 | glColor @{$self->{fg}}; |
1047 | |
1047 | |
1048 | my $x = |
1048 | $self->{ox} = int ( |
1049 | $self->{align} < 0 ? $self->{padding} |
1049 | $self->{align} < 0 ? $self->{padding} |
1050 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} |
1050 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} |
1051 | : ($self->{w} - $tex->{w}) * 0.5; |
1051 | : ($self->{w} - $tex->{w}) * 0.5 |
|
|
1052 | ); |
1052 | |
1053 | |
1053 | my $y = |
1054 | $self->{oy} = int ( |
1054 | $self->{valign} < 0 ? $self->{padding} |
1055 | $self->{valign} < 0 ? $self->{padding} |
1055 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} |
1056 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} |
1056 | : ($self->{h} - $tex->{h}) * 0.5; |
1057 | : ($self->{h} - $tex->{h}) * 0.5 |
|
|
1058 | ); |
1057 | |
1059 | |
1058 | $tex->draw_quad (int $x, int $y); |
1060 | $tex->draw_quad ($self->{ox}, $self->{oy}); |
1059 | |
1061 | |
1060 | glDisable GL_TEXTURE_2D; |
1062 | glDisable GL_TEXTURE_2D; |
1061 | glDisable GL_BLEND; |
1063 | glDisable GL_BLEND; |
1062 | } |
1064 | } |
1063 | |
1065 | |
… | |
… | |
1224 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text) |
1226 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text) |
1225 | } |
1227 | } |
1226 | |
1228 | |
1227 | glColor @{$self->{fg}}; |
1229 | glColor @{$self->{fg}}; |
1228 | glBegin GL_LINES; |
1230 | glBegin GL_LINES; |
1229 | glVertex $self->{cur_x}, $self->{cur_y}; |
|
|
1230 | glVertex $self->{cur_x}, $self->{cur_y} + $self->{cur_h}; |
1231 | glVertex $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy}; |
|
|
1232 | glVertex $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy} + $self->{cur_h}; |
1231 | glEnd; |
1233 | glEnd; |
1232 | } |
1234 | } |
1233 | } |
1235 | } |
1234 | |
1236 | |
1235 | package CFClient::UI::Entry; |
1237 | package CFClient::UI::Entry; |
… | |
… | |
1272 | |
1274 | |
1273 | $class->SUPER::new ( |
1275 | $class->SUPER::new ( |
1274 | padding => 4, |
1276 | padding => 4, |
1275 | fg => [1, 1, 1], |
1277 | fg => [1, 1, 1], |
1276 | bg => [1, 1, 1, 0.2], |
1278 | bg => [1, 1, 1, 0.2], |
1277 | active_fg => [1, 1, 0], |
1279 | active_fg => [0, 0, 1], |
1278 | can_hover => 1, |
1280 | can_hover => 1, |
1279 | @_ |
1281 | @_ |
1280 | ) |
1282 | ) |
1281 | } |
1283 | } |
1282 | |
1284 | |
… | |
… | |
1884 | |
1886 | |
1885 | my $mod = $ev->key_mod; |
1887 | my $mod = $ev->key_mod; |
1886 | my $sym = $ev->key_sym; |
1888 | my $sym = $ev->key_sym; |
1887 | |
1889 | |
1888 | if ($sym == SDLK_KP5) { |
1890 | if ($sym == SDLK_KP5) { |
1889 | $::CONN->user_send ("command stay fire"); |
1891 | $::CONN->user_send ("stay fire"); |
1890 | } elsif ($sym == SDLK_a) { |
1892 | } elsif ($sym == SDLK_a) { |
1891 | $::CONN->user_send ("command apply"); |
1893 | $::CONN->user_send ("apply"); |
1892 | } elsif ($sym == SDLK_QUOTE) { |
1894 | } elsif ($sym == SDLK_QUOTE) { |
1893 | $self->emit ('activate_console'); |
1895 | $self->emit ('activate_console'); |
1894 | } elsif ($sym == SDLK_SLASH) { |
1896 | } elsif ($sym == SDLK_SLASH) { |
1895 | $self->emit ('activate_console' => '/'); |
1897 | $self->emit ('activate_console' => '/'); |
1896 | } elsif (exists $DIR{$sym}) { |
1898 | } elsif (exists $DIR{$sym}) { |
1897 | if ($mod & KMOD_SHIFT) { |
1899 | if ($mod & KMOD_SHIFT) { |
1898 | $self->{shft}++; |
1900 | $self->{shft}++; |
1899 | $::CONN->user_send ("command fire $DIR{$sym}[0]"); |
1901 | $::CONN->user_send ("fire $DIR{$sym}[0]"); |
1900 | } elsif ($mod & KMOD_CTRL) { |
1902 | } elsif ($mod & KMOD_CTRL) { |
1901 | $self->{ctrl}++; |
1903 | $self->{ctrl}++; |
1902 | $::CONN->user_send ("command run $DIR{$sym}[0]"); |
1904 | $::CONN->user_send ("run $DIR{$sym}[0]"); |
1903 | } else { |
1905 | } else { |
1904 | $::CONN->user_send ("command $DIR{$sym}[1]"); |
1906 | $::CONN->user_send ("$DIR{$sym}[1]"); |
1905 | } |
1907 | } |
1906 | } |
1908 | } |
1907 | } |
1909 | } |
1908 | |
1910 | |
1909 | sub key_up { |
1911 | sub key_up { |
… | |
… | |
1911 | |
1913 | |
1912 | my $mod = $ev->key_mod; |
1914 | my $mod = $ev->key_mod; |
1913 | my $sym = $ev->key_sym; |
1915 | my $sym = $ev->key_sym; |
1914 | |
1916 | |
1915 | if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { |
1917 | if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { |
1916 | $::CONN->user_send ("command fire_stop"); |
1918 | $::CONN->user_send ("fire_stop"); |
1917 | } |
1919 | } |
1918 | if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { |
1920 | if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { |
1919 | $::CONN->user_send ("command run_stop"); |
1921 | $::CONN->user_send ("run_stop"); |
1920 | } |
1922 | } |
1921 | } |
1923 | } |
1922 | |
1924 | |
1923 | ############################################################################# |
1925 | ############################################################################# |
1924 | |
1926 | |