sottolio 0.1

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.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +31 -0
  5. data/LICENSE +676 -0
  6. data/README.md +26 -0
  7. data/Rakefile +12 -0
  8. data/bin/sottolio +29 -0
  9. data/example/game/include/CanvasText-0.4.js +500 -0
  10. data/example/game/include/canvasinput.js +379 -0
  11. data/example/game/include/howler.min.js +10 -0
  12. data/example/game/include/jquery.min.js +4 -0
  13. data/example/game/index.html +19 -0
  14. data/example/game/resources/backgrounds/city.jpg +0 -0
  15. data/example/game/resources/characters/ambrogia.png +0 -0
  16. data/example/game/resources/characters/rosalinda.png +0 -0
  17. data/example/game/resources/right_arrow.png +0 -0
  18. data/example/game/resources/sounds/Classmate.m4a +0 -0
  19. data/example/scripts/chapter_1.rb +64 -0
  20. data/example/scripts/chapter_2.rb +23 -0
  21. data/example/scripts/script.rb +2 -0
  22. data/lib/sottolio.rb +19 -0
  23. data/lib/sottolio/sottolio.rb +22 -0
  24. data/lib/sottolio/version.rb +21 -0
  25. data/opal/sottolio.rb +38 -0
  26. data/opal/sottolio/application.rb +134 -0
  27. data/opal/sottolio/database.rb +48 -0
  28. data/opal/sottolio/image_manager.rb +46 -0
  29. data/opal/sottolio/lock.rb +41 -0
  30. data/opal/sottolio/script.rb +93 -0
  31. data/opal/sottolio/sottolio.rb +29 -0
  32. data/opal/sottolio/sound_manager.rb +55 -0
  33. data/opal/sottolio/utils.rb +57 -0
  34. data/opal/sottolio/wrapper/background.rb +21 -0
  35. data/opal/sottolio/wrapper/canvas.rb +90 -0
  36. data/opal/sottolio/wrapper/canvas/canvas_button.rb +69 -0
  37. data/opal/sottolio/wrapper/canvas/canvas_input.rb +73 -0
  38. data/opal/sottolio/wrapper/canvas/canvas_text.rb +64 -0
  39. data/opal/sottolio/wrapper/character.rb +21 -0
  40. data/opal/sottolio/wrapper/image.rb +65 -0
  41. data/opal/sottolio/wrapper/sound.rb +55 -0
  42. data/sottolio.gemspec +20 -0
  43. metadata +114 -0
@@ -0,0 +1,21 @@
1
+ #--
2
+ # Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
3
+ #
4
+ # This file is part of sottolio.
5
+ #
6
+ # sottolio is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # sottolio is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with sottolio. If not, see <http://www.gnu.org/licenses/>.
18
+ #++
19
+ module Sottolio
20
+ class Character < Image; end
21
+ end
@@ -0,0 +1,65 @@
1
+ #--
2
+ # Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
3
+ #
4
+ # This file is part of sottolio.
5
+ #
6
+ # sottolio is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # sottolio is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with sottolio. If not, see <http://www.gnu.org/licenses/>.
18
+ #++
19
+ module Sottolio
20
+ class Image < Canvas
21
+ attr_accessor :image, :id, :x, :y, :width, :height
22
+
23
+ def initialize(element, image, id, x = 0, y = 0)
24
+ super element
25
+
26
+ @image = `new Image()`
27
+ `#@image.src = image`
28
+
29
+ @id = id
30
+ @x = x
31
+ @y = y
32
+ @width = `#@image.width`
33
+ @height = `#@image.height`
34
+ end
35
+
36
+ def draw(x = nil, y = nil, save = false)
37
+ super [{
38
+ src: @image,
39
+ x: x || @x,
40
+ y: y || @y
41
+ }]
42
+
43
+ @x = x if save
44
+ @y = y if save
45
+ end
46
+
47
+ def out?
48
+ (@width + @x) < 0 || (@x + width) > 1276
49
+ end
50
+
51
+ def slide(pre_callback = nil, callback = nil, to = :right, speed = 1)
52
+ move = -> {
53
+ unless out?
54
+ @x = @x + ((to == :left ? -1 : 1) * speed)
55
+ draw @x, @y, true
56
+ pre_callback.call if pre_callback
57
+ else
58
+ callback.call if callback
59
+ end
60
+ }
61
+
62
+ `setInterval(move, 1)`
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,55 @@
1
+ #--
2
+ # Copyright(C) 2013-2015 Giovanni Capuano <webmaster@giovannicapuano.net>
3
+ #
4
+ # This file is part of sottolio.
5
+ #
6
+ # sottolio is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # sottolio is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with sottolio. If not, see <http://www.gnu.org/licenses/>.
18
+ #++
19
+ module Sottolio
20
+ class Sound
21
+ attr_accessor :sound
22
+
23
+ def initialize(sounds, loop = false, volume = 0.5, on_end = -> {})
24
+ @sound = %x{
25
+ new Howl({
26
+ urls: #{[sounds].flatten},
27
+ autoplay: false,
28
+ loop: loop,
29
+ volume: volume,
30
+ onend: on_end
31
+ })
32
+ }
33
+ end
34
+
35
+ def play
36
+ `#@sound.play()`
37
+ end
38
+
39
+ def pause
40
+ `#@sound.pause()`
41
+ end
42
+
43
+ def stop
44
+ `#@sound.stop()`
45
+ end
46
+
47
+ def mute
48
+ `#@sound.mute()`
49
+ end
50
+
51
+ def unmute
52
+ `#@sound.unmute()`
53
+ end
54
+ end
55
+ end
data/sottolio.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ Kernel.load 'lib/sottolio/version.rb'
2
+
3
+ Gem::Specification.new { |s|
4
+ s.name = 'sottolio'
5
+ s.version = Sottolio::VERSION
6
+ s.author = 'Giovanni Capuano'
7
+ s.email = 'webmaster@giovannicapuano.net'
8
+ s.homepage = 'http://github.com/RoxasShadow/sottolio'
9
+ s.description = 'Engine to make visual novel games to be run inside your web browser.'
10
+ s.summary = 'sottolio is a game engine to create visual novels with ease. These games run everywhere, you only need a decent internet browser.'
11
+ s.license = 'GPL-3'
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
15
+ s.require_paths = ['lib']
16
+
17
+ s.add_dependency 'opal', '~> 0.8'
18
+
19
+ s.add_development_dependency 'rake', '~> 10.4'
20
+ }
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sottolio
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Giovanni Capuano
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ version_requirements: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '0.8'
19
+ name: opal
20
+ prerelease: false
21
+ requirement: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '0.8'
26
+ type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ version_requirements: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '10.4'
33
+ name: rake
34
+ prerelease: false
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '10.4'
40
+ type: :development
41
+ description: Engine to make visual novel games to be run inside your web browser.
42
+ email: webmaster@giovannicapuano.net
43
+ executables:
44
+ - sottolio
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - bin/sottolio
55
+ - example/game/include/CanvasText-0.4.js
56
+ - example/game/include/canvasinput.js
57
+ - example/game/include/howler.min.js
58
+ - example/game/include/jquery.min.js
59
+ - example/game/index.html
60
+ - example/game/resources/backgrounds/city.jpg
61
+ - example/game/resources/characters/ambrogia.png
62
+ - example/game/resources/characters/rosalinda.png
63
+ - example/game/resources/right_arrow.png
64
+ - example/game/resources/sounds/Classmate.m4a
65
+ - example/scripts/chapter_1.rb
66
+ - example/scripts/chapter_2.rb
67
+ - example/scripts/script.rb
68
+ - lib/sottolio.rb
69
+ - lib/sottolio/sottolio.rb
70
+ - lib/sottolio/version.rb
71
+ - opal/sottolio.rb
72
+ - opal/sottolio/application.rb
73
+ - opal/sottolio/database.rb
74
+ - opal/sottolio/image_manager.rb
75
+ - opal/sottolio/lock.rb
76
+ - opal/sottolio/script.rb
77
+ - opal/sottolio/sottolio.rb
78
+ - opal/sottolio/sound_manager.rb
79
+ - opal/sottolio/utils.rb
80
+ - opal/sottolio/wrapper/background.rb
81
+ - opal/sottolio/wrapper/canvas.rb
82
+ - opal/sottolio/wrapper/canvas/canvas_button.rb
83
+ - opal/sottolio/wrapper/canvas/canvas_input.rb
84
+ - opal/sottolio/wrapper/canvas/canvas_text.rb
85
+ - opal/sottolio/wrapper/character.rb
86
+ - opal/sottolio/wrapper/image.rb
87
+ - opal/sottolio/wrapper/sound.rb
88
+ - sottolio.gemspec
89
+ homepage: http://github.com/RoxasShadow/sottolio
90
+ licenses:
91
+ - GPL-3
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.4.8
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: sottolio is a game engine to create visual novels with ease. These games
113
+ run everywhere, you only need a decent internet browser.
114
+ test_files: []