Class: SectionStatus
- Inherits:
-
ViewBase
- Object
- AkaneSound
- ViewBase
- SectionStatus
- Defined in:
- lib/akane_sound/class.section_status.rb
Instance Attribute Summary collapse
-
#msg ⇒ Object
Returns the value of attribute msg.
-
#msg_rect ⇒ Object
Returns the value of attribute msg_rect.
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(x, y, w, h, col) ⇒ SectionStatus
constructor
A new instance of SectionStatus.
- #update ⇒ Object
- #update_size(x, y, w, h) ⇒ Object
Methods inherited from AkaneSound
Constructor Details
#initialize(x, y, w, h, col) ⇒ SectionStatus
Returns a new instance of SectionStatus.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/akane_sound/class.section_status.rb', line 3 def initialize(x, y, w, h, col) @txt_color = Util.to_col_ar(@@config[:text_color]) @vol_rect @vol_texture @vol_text_rect @timer_passed_texture @timer_passed_rect @timer_total_texture @timer_total_rect @progress_bar_rect @shuffle_on = @@font_bold.render_blended('[SHUFFLE]', @txt_color) @shuffle_off = @@font.render_blended('[SHUFFLE]', @txt_color) @repeat_on = @@font_bold.render_blended('[REPEAT]', @txt_color) @repeat_off = @@font.render_blended('[REPEAT]', @txt_color) @next_on = @@font_bold.render_blended('[NEXT]', @txt_color) @next_off = @@font.render_blended('[NEXT]', @txt_color) super set_view set_status("Welcome to Akane") update_volume_rect update_volume_texture update_data end |
Instance Attribute Details
#msg ⇒ Object
Returns the value of attribute msg.
2 3 4 |
# File 'lib/akane_sound/class.section_status.rb', line 2 def msg @msg end |
#msg_rect ⇒ Object
Returns the value of attribute msg_rect.
2 3 4 |
# File 'lib/akane_sound/class.section_status.rb', line 2 def msg_rect @msg_rect end |
Instance Method Details
#draw ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/akane_sound/class.section_status.rb', line 85 def draw super @@renderer. = @view_base @@renderer.fill_rect(SDL2::Rect[0, 0, @view_base.w, @view_base.h]) # draw status stuff @@renderer. = @view @@renderer.copy(@@renderer.create_texture_from(@@msg), nil, @@msg_rect) # draw volume @@renderer.copy(@vol_texture, nil, @vol_text_rect) if @@sound.volume < 101 @@renderer.draw_color = [@@config[:volume_bar_color][:red], @@config[:volume_bar_color][:green], @@config[:volume_bar_color][:blue], @@config[:volume_bar_color][:alpha]] else @@renderer.draw_color = [@@config[:volume_bar_max_color][:red], @@config[:volume_bar_max_color][:green], @@config[:volume_bar_max_color][:blue], @@config[:volume_bar_max_color][:alpha]] end @@renderer.fill_rect(@vol_rect) # draw timers @@renderer.copy(@timer_passed_texture, nil, @timer_passed_rect) @@renderer.copy(@timer_total_texture, nil, @timer_total_rect) # draw track info # sampling rate @@renderer.copy(@sampling_rate_texture, nil, @sampling_rate_rect) # bps @@renderer.copy(@bps_texture, nil, @bps_rect) # draw flags if @@sound.mode[:shuffle] @@renderer.copy(@@renderer.create_texture_from(@shuffle_on), nil, SDL2::Rect[210, 18, @shuffle_on.w, @shuffle_on.h]) else @@renderer.copy(@@renderer.create_texture_from(@shuffle_off), nil, SDL2::Rect[210, 18, @shuffle_off.w, @shuffle_off.h]) end if @@sound.mode[:repeat] @@renderer.copy(@@renderer.create_texture_from(@repeat_on), nil, SDL2::Rect[210+@shuffle_on.w+2, 18, @repeat_on.w, @repeat_on.h]) else @@renderer.copy(@@renderer.create_texture_from(@repeat_off), nil, SDL2::Rect[210+@shuffle_on.w+2, 18, @repeat_off.w, @repeat_off.h]) end if @@sound.mode[:next] @@renderer.copy(@@renderer.create_texture_from(@next_on), nil, SDL2::Rect[210+@shuffle_on.w+2+@repeat_on.w+2, 18, @next_on.w, @next_on.h]) else @@renderer.copy(@@renderer.create_texture_from(@next_off), nil, SDL2::Rect[210+@shuffle_on.w+2+@repeat_on.w+2, 18, @next_off.w, @next_off.h]) end # draw progess bar @@renderer.draw_color = [@@config[:prog_bar_color][:red], @@config[:prog_bar_color][:green], @@config[:prog_bar_color][:blue], @@config[:prog_bar_color][:alpha]] @@renderer.fill_rect(@progress_bar_rect) end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/akane_sound/class.section_status.rb', line 27 def update if @@inp.pause == 1 @@sound.play_track end if @@inp.stop == 1 @@sound.stop_track end if @@inp.vol_down == 1 || @@inp.vol_down >= 20 @@sound.volume -= 1 if @@inp.vol_down == 22 @@inp.vol_down = 20 end @@sound.volume = 0 if @@sound.volume < 0 update_volume_rect update_volume_texture @@sound.set_vol end if @@inp.vol_up == 1 || @@inp.vol_up >= 20 @@sound.volume += 1 if @@inp.vol_up == 22 @@inp.vol_up = 20 end @@sound.volume = 128 if @@sound.volume > 128 update_volume_rect update_volume_texture @@sound.set_vol end if @@inp.toggle_shuffle == 1 @@sound.toggle_shuffle end if @@inp.toggle_repeat == 1 @@sound.toggle_repeat end if @@inp.toggle_next == 1 @@sound.toggle_next end if @@sound.state != "not playing" if @@inp.next == 1 @@sound.skip("next", 1) end if @@inp.prev == 1 @@sound.skip("previous", 1) end end update_timers update_data end |
#update_size(x, y, w, h) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/akane_sound/class.section_status.rb', line 76 def update_size(x, y, w, h) super set_view update_volume_rect update_volume_texture update_data end |