hasu 0.0.10 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/hasu.gemspec +2 -0
- data/lib/hasu/version.rb +1 -1
- data/lib/hasu/window.rb +70 -0
- data/lib/hasu.rb +1 -69
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
Yjk1ZjgxNjc1ZGQ4YWE5M2YzMmMzODVjY2E4NjQ0YjdkODRlYjY5NzFlYjdj
|
10
|
-
ZGYyYzVkNzJhMjE0ODdjMmVhNjUyN2Q0M2I2YTc4OWMwN2ZlY2YzNThiMzM0
|
11
|
-
ZDk4YzIxNDZkMzA3NGI2NzljYmY0MjdmNWU0MzhiMzBmMWNiMjI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
N2U0ZWM5MjUzN2JhYjI2NzU0NmNmYzM2MmUwZjM1NGYzOWQ4MGVmMmM0NjE3
|
14
|
-
NzZlYjBhYmJkMmE0ZWYxOGE5MzdlYmY3NTdmODdiODM4ZDIzMGQwNzgyMjdh
|
15
|
-
YzlmZWExOWIwOTU1OWZlZTg0YzRmZWI5ZWE4YTMyZWNkOWNjNjk=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35249a856464e8809000bde2e9b4dd28eb07510e
|
4
|
+
data.tar.gz: fe2f1e7999dabc8b5670d9b5a3ca721aa30c7503
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b9171e603e8c43e26d45fcdcd750b10894a3a2da3364c4da580940f407aaf9cd49d6462df57353c4d6a785a79b3d075407ef513dbcc9f4057c89895cebe7d51b
|
7
|
+
data.tar.gz: 662909799dd4357f76e3f71344c2624053d272a2fa12606a512fd3fa5f9e12cd822ddf8f5b33c808f2c4b2459296bd70a282a4d049eeeb4f08995972c41ba1ff
|
data/hasu.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_dependency "gosu"
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
24
|
spec.add_development_dependency "rake"
|
23
25
|
end
|
data/lib/hasu/version.rb
CHANGED
data/lib/hasu/window.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
class Hasu::Window < Gosu::Window
|
2
|
+
def self.inherited(other)
|
3
|
+
includer = caller.first.split(":").first
|
4
|
+
Hasu.reloads[includer] = File.mtime(includer)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.run
|
8
|
+
unless @running
|
9
|
+
@running = true
|
10
|
+
new.show
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(*)
|
15
|
+
super
|
16
|
+
reset
|
17
|
+
end
|
18
|
+
|
19
|
+
def update(*)
|
20
|
+
if Hasu.reload!
|
21
|
+
Hasu.error = nil
|
22
|
+
end
|
23
|
+
unless Hasu.error
|
24
|
+
super
|
25
|
+
end
|
26
|
+
rescue => e
|
27
|
+
Hasu.error = e
|
28
|
+
end
|
29
|
+
|
30
|
+
def reset
|
31
|
+
super if defined?(super)
|
32
|
+
Hasu.error = nil
|
33
|
+
rescue => e
|
34
|
+
Hasu.error = e
|
35
|
+
end
|
36
|
+
|
37
|
+
def draw(*)
|
38
|
+
if Hasu.error
|
39
|
+
([Hasu.error.inspect] + Hasu.error.backtrace).each_with_index do |line, i|
|
40
|
+
_hasu_font.draw(line.gsub("\n",''), 10, 10 + i * 16, 0)
|
41
|
+
end
|
42
|
+
else
|
43
|
+
begin
|
44
|
+
super
|
45
|
+
rescue => e
|
46
|
+
Hasu.error = e
|
47
|
+
draw
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def _hasu_font
|
53
|
+
@_hasu_font ||= Gosu::Font.new(self, Gosu::default_font_name, 16)
|
54
|
+
end
|
55
|
+
|
56
|
+
def button_down(id)
|
57
|
+
case id
|
58
|
+
when Gosu::KbEscape
|
59
|
+
close
|
60
|
+
when Gosu::Window.char_to_button_id('r')
|
61
|
+
reset
|
62
|
+
else
|
63
|
+
begin
|
64
|
+
super(id)
|
65
|
+
rescue => e
|
66
|
+
Hasu.error = e
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/hasu.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "hasu/version"
|
2
|
+
require "hasu/window"
|
2
3
|
|
3
4
|
module Hasu
|
4
5
|
def self.reloads
|
@@ -29,13 +30,6 @@ module Hasu
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
|
-
def self.run(window)
|
33
|
-
unless @running
|
34
|
-
@running = true
|
35
|
-
window.new.show
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
33
|
def self.reload!
|
40
34
|
to_reload = reloads.select{|f,t| File.exists?(f) && File.mtime(f) > t}
|
41
35
|
|
@@ -44,66 +38,4 @@ module Hasu
|
|
44
38
|
load(file)
|
45
39
|
end
|
46
40
|
end
|
47
|
-
|
48
|
-
def self.prepended(other)
|
49
|
-
includer = caller.first.split(":").first
|
50
|
-
reloads[includer] = File.mtime(includer)
|
51
|
-
end
|
52
|
-
|
53
|
-
def initialize(*)
|
54
|
-
super
|
55
|
-
reset
|
56
|
-
end
|
57
|
-
|
58
|
-
def update(*)
|
59
|
-
if Hasu.reload!
|
60
|
-
Hasu.error = nil
|
61
|
-
end
|
62
|
-
unless Hasu.error
|
63
|
-
super
|
64
|
-
end
|
65
|
-
rescue => e
|
66
|
-
Hasu.error = e
|
67
|
-
end
|
68
|
-
|
69
|
-
def reset
|
70
|
-
super if defined?(super)
|
71
|
-
Hasu.error = nil
|
72
|
-
rescue => e
|
73
|
-
Hasu.error = e
|
74
|
-
end
|
75
|
-
|
76
|
-
def draw(*)
|
77
|
-
if Hasu.error
|
78
|
-
([Hasu.error.inspect] + Hasu.error.backtrace).each_with_index do |line, i|
|
79
|
-
_hasu_font.draw(line.gsub("\n",''), 10, 10 + i * 16, 0)
|
80
|
-
end
|
81
|
-
else
|
82
|
-
begin
|
83
|
-
super
|
84
|
-
rescue => e
|
85
|
-
Hasu.error = e
|
86
|
-
draw
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def _hasu_font
|
92
|
-
@_hasu_font ||= Gosu::Font.new(self, Gosu::default_font_name, 16)
|
93
|
-
end
|
94
|
-
|
95
|
-
def button_down(id)
|
96
|
-
case id
|
97
|
-
when Gosu::KbEscape
|
98
|
-
close
|
99
|
-
when Gosu::Window.char_to_button_id('r')
|
100
|
-
reset
|
101
|
-
else
|
102
|
-
begin
|
103
|
-
super(id)
|
104
|
-
rescue => e
|
105
|
-
Hasu.error = e
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
41
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hasu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Fairley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: gosu
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -28,14 +42,14 @@ dependencies:
|
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - '>='
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - '>='
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
description: Prototype Gosu games with ease
|
@@ -55,6 +69,7 @@ files:
|
|
55
69
|
- hasu.gemspec
|
56
70
|
- lib/hasu.rb
|
57
71
|
- lib/hasu/version.rb
|
72
|
+
- lib/hasu/window.rb
|
58
73
|
homepage: https://github.com/michaelfairley/hasu
|
59
74
|
licenses:
|
60
75
|
- MIT
|
@@ -65,19 +80,18 @@ require_paths:
|
|
65
80
|
- lib
|
66
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
82
|
requirements:
|
68
|
-
- -
|
83
|
+
- - '>='
|
69
84
|
- !ruby/object:Gem::Version
|
70
85
|
version: '0'
|
71
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
87
|
requirements:
|
73
|
-
- -
|
88
|
+
- - '>='
|
74
89
|
- !ruby/object:Gem::Version
|
75
90
|
version: '0'
|
76
91
|
requirements: []
|
77
92
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.0.
|
93
|
+
rubygems_version: 2.0.3
|
79
94
|
signing_key:
|
80
95
|
specification_version: 4
|
81
96
|
summary: Prototype Gosu games with ease
|
82
97
|
test_files: []
|
83
|
-
has_rdoc:
|