… | |
… | |
2233 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text); |
2233 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text); |
2234 | } |
2234 | } |
2235 | |
2235 | |
2236 | glColor_premultiply @{$self->{active_fg}}; |
2236 | glColor_premultiply @{$self->{active_fg}}; |
2237 | glBegin GL_LINES; |
2237 | glBegin GL_LINES; |
2238 | glVertex 0.5 + $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy}; |
2238 | glVertex $self->{cur_x} + $self->{ox} + .5, $self->{cur_y} + $self->{oy}; |
2239 | glVertex 0.5 + $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy} + $self->{cur_h}; |
2239 | glVertex $self->{cur_x} + $self->{ox} + .5, $self->{cur_y} + $self->{oy} + $self->{cur_h}; |
2240 | glEnd; |
2240 | glEnd; |
2241 | |
2241 | |
2242 | glLineWidth 3; |
2242 | glLineWidth 3; |
2243 | glColor @{$self->{active_outline}}; |
2243 | glColor @{$self->{active_outline}}; |
2244 | glRect_lineloop 0, 0, $self->{w} - 1, $self->{h} - 1; |
2244 | glRect_lineloop 1.5, 1.5, $self->{w} - 1.5, $self->{h} - 1.5; |
2245 | glLineWidth 1; |
2245 | glLineWidth 1; |
2246 | |
2246 | |
2247 | } else { |
2247 | } else { |
2248 | glColor @{$self->{outline}}; |
2248 | glColor @{$self->{outline}}; |
2249 | glTranslate .375, .375; |
|
|
2250 | glBegin GL_LINE_STRIP; |
2249 | glBegin GL_LINE_STRIP; |
2251 | glVertex 0, $self->{h} * .5; |
2250 | glVertex .5, $self->{h} * .5; |
2252 | glVertex 0, $self->{h} - 3; |
2251 | glVertex .5, $self->{h} - 2.5; |
2253 | glVertex $self->{w} - 1, $self->{h} - 3; |
2252 | glVertex $self->{w} - .5, $self->{h} - 2.5; |
2254 | glVertex $self->{w} - 1, $self->{h} * .5; |
2253 | glVertex $self->{w} - .5, $self->{h} * .5; |
2255 | glEnd; |
2254 | glEnd; |
2256 | } |
2255 | } |
2257 | } |
2256 | } |
2258 | |
2257 | |
2259 | ############################################################################# |
2258 | ############################################################################# |
… | |
… | |
2508 | sub _draw { |
2507 | sub _draw { |
2509 | my ($self) = @_; |
2508 | my ($self) = @_; |
2510 | |
2509 | |
2511 | $self->SUPER::_draw; |
2510 | $self->SUPER::_draw; |
2512 | |
2511 | |
2513 | glTranslate $self->{padding_x} + 0.375, $self->{padding_y} + 0.375, 0; |
2512 | glTranslate $self->{padding_x}, $self->{padding_y}, 0; |
2514 | |
2513 | |
2515 | my ($w, $h) = @$self{qw(w h)}; |
2514 | my ($w, $h) = @$self{qw(w h)}; |
2516 | |
2515 | |
2517 | my $s = List::Util::min $w - $self->{padding_x} * 2, $h - $self->{padding_y} * 2; |
2516 | my $s = List::Util::min $w - $self->{padding_x} * 2, $h - $self->{padding_y} * 2; |
2518 | |
2517 | |
… | |
… | |
2837 | |
2836 | |
2838 | glEnable GL_BLEND; |
2837 | glEnable GL_BLEND; |
2839 | glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA; |
2838 | glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA; |
2840 | |
2839 | |
2841 | if ($self->{value} >= 0) { |
2840 | if ($self->{value} >= 0) { |
2842 | my $s = 3 + ($self->{w} - 6) * $self->{value}; |
2841 | my $s = int 2 + ($self->{w} - 4) * $self->{value}; |
2843 | |
2842 | |
2844 | glColor_premultiply @{$self->{bar}}; |
2843 | glColor_premultiply @{$self->{bar}}; |
2845 | glRect 2, 2, $s, $self->{h} - 2; |
2844 | glRect 2, 2, $s, $self->{h} - 2; |
2846 | glColor_premultiply @{$self->{bg}}; |
2845 | glColor_premultiply @{$self->{bg}}; |
2847 | glRect $s + 1, 0, $self->{w} - 2, $self->{h} - 2; |
2846 | glRect $s, 2, $self->{w} - 2, $self->{h} - 2; |
2848 | } |
2847 | } |
2849 | |
2848 | |
2850 | glColor_premultiply @{$self->{outline}}; |
2849 | glColor_premultiply @{$self->{outline}}; |
2851 | glRect_lineloop 1, 1, $self->{w} - 2, $self->{h} - 2; |
2850 | glRect_lineloop 1.5, 1.5, $self->{w} - 1.5, $self->{h} - 1.5; |
2852 | |
2851 | |
2853 | glDisable GL_BLEND; |
2852 | glDisable GL_BLEND; |
2854 | |
2853 | |
2855 | { |
2854 | { |
2856 | local $self->{bg}; # do not draw background |
2855 | local $self->{bg}; # do not draw background |
… | |
… | |
2896 | } |
2895 | } |
2897 | |
2896 | |
2898 | sub set_value { |
2897 | sub set_value { |
2899 | my ($self, $lvl, $exp) = @_; |
2898 | my ($self, $lvl, $exp) = @_; |
2900 | |
2899 | |
2901 | <<<<<<< UI.pm |
|
|
2902 | $self->{lvl} = $lvl; |
2900 | $self->{lvl} = $lvl; |
2903 | $self->{exp} = $exp; |
2901 | $self->{exp} = $exp; |
2904 | |
2902 | |
2905 | ======= |
|
|
2906 | $self->{lvl} = $exp; |
|
|
2907 | $self->{exp} = $exp; |
|
|
2908 | |
|
|
2909 | >>>>>>> 1.434 |
|
|
2910 | my $v = -1; |
2903 | my $v = -1; |
2911 | |
2904 | |
2912 | if ($::CONN && (my $table = $::CONN->{exp_table})) { |
2905 | if ($::CONN && (my $table = $::CONN->{exp_table})) { |
2913 | my $l0 = $table->[$lvl - 1]; |
2906 | my $l0 = $table->[$lvl - 1]; |
2914 | my $l1 = $table->[$lvl]; |
2907 | my $l1 = $table->[$lvl]; |
… | |
… | |
3624 | } |
3617 | } |
3625 | |
3618 | |
3626 | sub _draw { |
3619 | sub _draw { |
3627 | my ($self) = @_; |
3620 | my ($self) = @_; |
3628 | |
3621 | |
3629 | glTranslate 0.375, 0.375; |
|
|
3630 | |
|
|
3631 | my ($w, $h) = @$self{qw(w h)}; |
3622 | my ($w, $h) = @$self{qw(w h)}; |
3632 | |
3623 | |
3633 | glColor 1, 0.8, 0.4; |
3624 | glColor 1, 0.8, 0.4; |
3634 | glRect 0, 0, $w, $h; |
3625 | glRect 0, 0, $w, $h; |
3635 | |
3626 | |
3636 | glColor 0, 0, 0; |
3627 | glColor 0, 0, 0; |
3637 | glRect_lineloop 0, 0, $w, $h; |
3628 | glRect_lineloop .5, .5, $w + .5, $h + .5; |
3638 | |
3629 | |
3639 | glTranslate 2 - 0.375, 2 - 0.375; |
3630 | glTranslate 2, 2; |
3640 | |
3631 | |
3641 | $self->SUPER::_draw; |
3632 | $self->SUPER::_draw; |
3642 | } |
3633 | } |
3643 | |
3634 | |
3644 | ############################################################################# |
3635 | ############################################################################# |
… | |
… | |
3971 | my $class = shift; |
3962 | my $class = shift; |
3972 | |
3963 | |
3973 | my $self = $class->SUPER::new ( |
3964 | my $self = $class->SUPER::new ( |
3974 | buttonbar => (new CFPlus::UI::Buttonbar), |
3965 | buttonbar => (new CFPlus::UI::Buttonbar), |
3975 | multiplexer => (new CFPlus::UI::Multiplexer expand => 1), |
3966 | multiplexer => (new CFPlus::UI::Multiplexer expand => 1), |
3976 | active_outline => [1, 1, 0], |
3967 | active_outline => [.7, .7, 0.2], |
3977 | # filter => # will be put between multiplexer and $self |
3968 | # filter => # will be put between multiplexer and $self |
3978 | @_, |
3969 | @_, |
3979 | ); |
3970 | ); |
3980 | |
3971 | |
3981 | $self->{filter}->add ($self->{multiplexer}) if $self->{filter}; |
3972 | $self->{filter}->add ($self->{multiplexer}) if $self->{filter}; |
… | |
… | |
4062 | |
4053 | |
4063 | $self->SUPER::_draw (); |
4054 | $self->SUPER::_draw (); |
4064 | |
4055 | |
4065 | if (my $cur = $self->{multiplexer}{current}) { |
4056 | if (my $cur = $self->{multiplexer}{current}) { |
4066 | if ($cur = $cur->{c_tab_}) { |
4057 | if ($cur = $cur->{c_tab_}) { |
4067 | glTranslate $cur->{x}, $cur->{y}; |
4058 | glTranslate $self->{buttonbar}{x} + $cur->{x}, |
|
|
4059 | $self->{buttonbar}{y} + $cur->{y}; |
4068 | glLineWidth 3; |
4060 | glLineWidth 3; |
|
|
4061 | #glEnable GL_BLEND; |
|
|
4062 | #glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA; |
4069 | glColor @{$self->{active_outline}}; |
4063 | glColor @{$self->{active_outline}}; |
4070 | glRect_lineloop 1, 1, $cur->{w} - 2, $cur->{h} - 2; |
4064 | glRect_lineloop 1.5, 1.5, $cur->{w} - 1.5, $cur->{h} - 1.5; |
4071 | glLineWidth 1; |
4065 | glLineWidth 1; |
|
|
4066 | #glDisable GL_BLEND; |
4072 | } |
4067 | } |
4073 | } |
4068 | } |
4074 | } |
4069 | } |
4075 | |
4070 | |
4076 | ############################################################################# |
4071 | ############################################################################# |