redmocha 0.3.7-java → 0.3.8-java
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.
- checksums.yaml +4 -4
- data/lib/redmocha.rb +53 -96
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85dc21e547207e63e498a5e8d68857d8e44bbbc9
|
4
|
+
data.tar.gz: ca893e9a00d2451163cfb0fce8ee5a0e3356754d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ada429cf2b0140c0e90ab5e80cd6aaa0b239ded9cc135d55f580fff436cc617cbef287d72709db005b98d6656182320a7d17736cad66c3b02029da88f54df415
|
7
|
+
data.tar.gz: aab562f4f33ebeb106c4559363bfd6d26d6383091cc31ab1a295a88a2e691f1c0e65dc7e5acaca6a8d9d5e541a5c5f0ab2b0144a11e518b96c5e16e341773571
|
data/lib/redmocha.rb
CHANGED
@@ -26,133 +26,90 @@ Dir["#{path}/includes/\*.rb"].each do |rb|
|
|
26
26
|
require_relative rb.sub("#{path}/", "").sub(".rb", "")
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
java_import klass.join("::")
|
33
|
-
end
|
34
|
-
|
35
|
-
def rm_include(interface)
|
36
|
-
interface = interface.to_s.split("::")
|
37
|
-
interface[interface.length-1] = interface.last.underscore.split("_").map { |w| w.upcase.join("_") }
|
38
|
-
include interface.join("::")
|
39
|
-
end
|
40
|
-
|
41
|
-
class RMScreen
|
42
|
-
include com.badlogic.gdx.Screen
|
43
|
-
|
44
|
-
def initialize(game)
|
45
|
-
@game = game
|
46
|
-
end
|
47
|
-
|
48
|
-
protected
|
49
|
-
|
50
|
-
def clear
|
51
|
-
com.badlogic.gdx.Gdx.gl.glClearColor(0.0, 0.0, 0.0, 1.0)
|
52
|
-
com.badlogic.gdx.Gdx.gl.glClear(com.badlogic.gdx.graphics.GL20::GL_COLOR_BUFFER_BIT)
|
53
|
-
end
|
54
|
-
|
55
|
-
def render(delta)
|
56
|
-
@game.batch.begin
|
57
|
-
clear
|
58
|
-
@game.font.draw(@game.batch, "RedMocha beats white mocha fam!", 20, 20)
|
59
|
-
@game.batch.end
|
60
|
-
end
|
61
|
-
|
62
|
-
def show
|
63
|
-
end
|
29
|
+
class RMGame
|
30
|
+
include com.badlogic.gdx.ApplicationListener
|
31
|
+
attr_reader :batch, :font, :shape, :config
|
64
32
|
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
def dispose
|
69
|
-
end
|
70
|
-
|
71
|
-
def pause
|
72
|
-
end
|
73
|
-
|
74
|
-
def resize(width, height)
|
75
|
-
end
|
76
|
-
|
77
|
-
def resume
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
class RMGame < com.badlogic.gdx.Game
|
82
|
-
attr_accessor :batch, :font, :title, :width, :height, :screen
|
83
|
-
|
33
|
+
# When Application is first created
|
84
34
|
def create
|
85
35
|
@batch = com.badlogic.gdx.graphics.g2d.SpriteBatch.new
|
86
36
|
@font = com.badlogic.gdx.graphics.g2d.BitmapFont.new
|
87
|
-
@screen = RMScreen.new(self)
|
88
|
-
self.set_screen(@screen)
|
89
37
|
end
|
90
38
|
|
39
|
+
# Everytime Appication renders itself
|
91
40
|
def render
|
92
|
-
|
41
|
+
update
|
42
|
+
@batch.begin
|
43
|
+
@shape.begin unless @shape.nil?
|
44
|
+
display
|
45
|
+
@shape.end unless @shape.nil?
|
46
|
+
@batch.end
|
93
47
|
end
|
94
48
|
|
95
|
-
|
96
|
-
|
97
|
-
@
|
49
|
+
# Enable ShapeRenderer
|
50
|
+
def enable_shape_drawer
|
51
|
+
@shape = com.badlogic.gdx.graphics.glutils.ShapeRenderer.new if @shape.nil?
|
98
52
|
end
|
99
53
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
54
|
+
# Disable ShapeRenderer
|
55
|
+
def disable_shape_drawer
|
56
|
+
unless @shape.nil?
|
57
|
+
@shape.dispose
|
58
|
+
@shape = nil
|
105
59
|
end
|
106
60
|
end
|
107
61
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
@
|
112
|
-
@
|
113
|
-
@height = height
|
62
|
+
# Get rid of resources used by Application
|
63
|
+
def dispose
|
64
|
+
@shape.dispose unless @shape.nil?
|
65
|
+
@batch.dispose unless @batch.nil?
|
66
|
+
@font.dispose unless @font.nil?
|
114
67
|
end
|
115
|
-
end
|
116
68
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
def create(title = "RedMocha Game", width = 800, height = 600)
|
121
|
-
@batch = com.badlogic.gdx.graphics.g2d.SpriteBatch.new
|
122
|
-
@title = title
|
123
|
-
@width = width
|
124
|
-
@height = height
|
69
|
+
# Run the Application
|
70
|
+
def run
|
71
|
+
com.badlogic.gdx.backends.lwjgl.LwjglApplication.new(self, @config)
|
125
72
|
end
|
126
73
|
|
127
|
-
|
74
|
+
# Clear the screen with a certain color and alpha
|
75
|
+
def clear(r, g, b, a)
|
76
|
+
com.badlogic.gdx.Gdx.gl.glClearColor(r, g, b, a)
|
77
|
+
com.badlogic.gdx.Gdx.gl.glClear(com.badlogic.gdx.graphics.GL20.GL_COLOR_BUFFER_BIT)
|
128
78
|
end
|
129
79
|
|
130
|
-
|
131
|
-
|
80
|
+
# User updates entities in game
|
81
|
+
def update
|
82
|
+
dispose
|
83
|
+
raise NotImplementedError, "Must implement update method"
|
132
84
|
end
|
133
85
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
86
|
+
# User displays entities of game
|
87
|
+
def display
|
88
|
+
dispose
|
89
|
+
raise NotImplementedError, "Must implement display method"
|
138
90
|
end
|
139
91
|
|
140
|
-
|
92
|
+
# Inherit these only when needed
|
93
|
+
|
94
|
+
# When Application pauses
|
95
|
+
def pause
|
141
96
|
end
|
142
97
|
|
98
|
+
# When Application resumes
|
143
99
|
def resume
|
144
100
|
end
|
145
101
|
|
146
|
-
|
147
|
-
|
102
|
+
# Do something when Application is resized to certain dimensions
|
103
|
+
def resize(width, height)
|
148
104
|
end
|
149
105
|
|
150
|
-
|
151
|
-
|
152
|
-
|
106
|
+
protected
|
107
|
+
|
108
|
+
def initialize(title, width, height)
|
109
|
+
@config = com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration.new
|
110
|
+
@config.title = title
|
111
|
+
@config.width = width
|
112
|
+
@config.height = height
|
153
113
|
end
|
154
114
|
end
|
155
115
|
|
156
|
-
class RMConfig < com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration
|
157
|
-
|
158
|
-
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmocha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Julio Berina
|
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
46
|
version: '0'
|
47
47
|
requirements: []
|
48
48
|
rubyforge_project:
|
49
|
-
rubygems_version: 2.6.
|
49
|
+
rubygems_version: 2.6.8
|
50
50
|
signing_key:
|
51
51
|
specification_version: 4
|
52
52
|
summary: JRuby wrapper for LibGDX
|