akane_sound 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ class ViewBase < AkaneSound
2
+ def initialize(x, y, w, h, col)
3
+ @view_base = SDL2::Rect[x, y, w, h]
4
+ @col = col
5
+ end
6
+
7
+ def update
8
+ end
9
+
10
+ def update_size(x, y, w, h)
11
+ @view_base = SDL2::Rect[x, y, w, h]
12
+ end
13
+
14
+ def draw
15
+ @@renderer.viewport = @view_base
16
+ @@renderer.draw_color = [@col[:red],
17
+ @col[:green],
18
+ @col[:blue],
19
+ @col[:alpha]]
20
+ #TODO viewport?
21
+
22
+ end
23
+ end
24
+
@@ -0,0 +1,48 @@
1
+ module Util
2
+ def Util.binary_copy(dst_dir, filename)
3
+ file = File.open("./akane_sound/#{filename}", 'rb')
4
+ contents = file.read
5
+ file.close
6
+ File.open(dst_dir+filename, 'wb') { |file| file.write(contents) }
7
+ end
8
+ def Util.p(str)
9
+ if str.class == String
10
+ SDL2::MessageBox.show_simple_box(SDL2::MessageBox::ERROR, "Alert",
11
+ str, nil)
12
+ end
13
+ end
14
+ def Util.to_col_ar(hash)
15
+ ar = Array.new
16
+ hash.each { |key, val| ar.push val }
17
+ ar.pop 1
18
+ ar
19
+ end
20
+ def Util.ms_to_time_str(ms)
21
+ sec = ((ms.to_i/1000)%60).to_i
22
+ min = ((ms.to_i/1000-sec)/60).to_s
23
+ sec = sec.to_s
24
+ sec.prepend("0") if sec.length == 1
25
+ min.prepend("0") if min.length == 1
26
+ "#{min}:#{sec}"
27
+ end
28
+ =begin
29
+ def Util.ms_to_time_str(ms)
30
+ sec = ms.to_f/1000.0
31
+ min = sec/60.0
32
+ sec = ((min%60.0).round(2)*10).to_i
33
+ if min < 10
34
+ min = "0#{min.floor}"
35
+ else
36
+ min = min.floor
37
+ end
38
+ sec = '00' if sec == 100
39
+ "#{min}:#{sec}"
40
+ end
41
+ =end
42
+ def Util.int_scale(cur, max, scale_to)
43
+ ((cur.to_f/max)*scale_to.to_f).to_int
44
+ end
45
+ def Util.get_percentage(cur, max)
46
+ ((cur.to_f/max.to_f)*100.0).round(2)
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: akane_sound
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - tohya ryu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: audio player using sdl2. see github link for details
14
+ email: ryu@hirasaka.io
15
+ executables:
16
+ - akane_sound
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/akane_sound
21
+ - data/NotoSansCJKjp-Bold.otf
22
+ - data/NotoSansCJKjp-Medium.otf
23
+ - data/NotoSansCJKjp-Regular.otf
24
+ - data/akane_bg.png
25
+ - data/config.yaml
26
+ - data/save_data.yaml
27
+ - lib/akane_sound.rb
28
+ - lib/akane_sound/class.background.rb
29
+ - lib/akane_sound/class.element.rb
30
+ - lib/akane_sound/class.input.rb
31
+ - lib/akane_sound/class.section_dir.rb
32
+ - lib/akane_sound/class.section_playlist.rb
33
+ - lib/akane_sound/class.section_status.rb
34
+ - lib/akane_sound/class.setup.rb
35
+ - lib/akane_sound/class.sound.rb
36
+ - lib/akane_sound/class.upper_section_base.rb
37
+ - lib/akane_sound/class.view_base.rb
38
+ - lib/akane_sound/module.util.rb
39
+ homepage: https://github.com/ryu-sxp/akane_sound
40
+ licenses:
41
+ - GPL-3.0
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.7.6
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: audio player using sdl2
63
+ test_files: []