jruby-slick 1.0a → 1.0b
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.
- data/.gitignore +2 -1
- data/bin/jruby-slick.rb +3 -1
- data/jruby-slick/tasks/jruby-slick.rake +34 -0
- data/jruby-slick/template/example.rb +26 -0
- metadata +3 -2
data/.gitignore
CHANGED
data/bin/jruby-slick.rb
CHANGED
@@ -5,4 +5,6 @@ require 'rake'
|
|
5
5
|
gem_dir = Gem::Specification.find_by_name("jruby-slick").gem_dir
|
6
6
|
|
7
7
|
Rake.application.rake_require "jruby-slick", ["#{gem_dir}/jruby-slick/tasks"]
|
8
|
-
Rake::Task['download_slick'].invoke
|
8
|
+
Rake::Task['download_slick'].invoke
|
9
|
+
Rake::Task['setup_natives'].invoke
|
10
|
+
Rake::Task['build_example'].invoke
|
@@ -2,6 +2,7 @@ require 'net/http'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'rubygems'
|
4
4
|
require 'zip/zipfilesystem'
|
5
|
+
require 'rbconfig'
|
5
6
|
desc 'Download Slick Distribution'
|
6
7
|
|
7
8
|
task :download_slick do
|
@@ -21,4 +22,37 @@ task :download_slick do
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
File.delete("temp.zip")
|
25
|
+
end
|
26
|
+
|
27
|
+
task :setup_natives do
|
28
|
+
FileUtils.mkdir_p "bin" unless File.exists? "bin"
|
29
|
+
target = RbConfig::CONFIG['target_os'].downcase
|
30
|
+
platform = ''
|
31
|
+
if target.index('mswin')
|
32
|
+
platform = 'mingw'
|
33
|
+
elsif target.index('darwin')
|
34
|
+
platform = 'mac'
|
35
|
+
elsif target.index('linux')
|
36
|
+
platform = 'linux'
|
37
|
+
end
|
38
|
+
|
39
|
+
Dir['vendor/slick/*.jar'].each do |jar_file|
|
40
|
+
if jar_file.index('natives-') && jar_file.gsub('vendor/slick/natives-', '').gsub('.jar', '') == platform
|
41
|
+
Zip::ZipFile.open(jar_file) do |natives|
|
42
|
+
natives.each do |f|
|
43
|
+
path = "bin/#{f.to_s}"
|
44
|
+
File.delete path if File.exists? path
|
45
|
+
f.extract "bin/#{f.to_s}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
task :build_example do
|
53
|
+
gem_dir = Gem::Specification.find_by_name("jruby-slick").gem_dir
|
54
|
+
|
55
|
+
unless File.exists? "bin/example.rb"
|
56
|
+
FileUtils.cp "#{gem_dir}/jruby-slick/template/example.rb", "bin/example.rb"
|
57
|
+
end
|
24
58
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.push File.expand_path('../../vendor/slick', __FILE__)
|
2
|
+
|
3
|
+
require 'java'
|
4
|
+
require 'lwjgl.jar'
|
5
|
+
require 'slick.jar'
|
6
|
+
|
7
|
+
java_import org.newdawn.slick.AppGameContainer
|
8
|
+
java_import org.newdawn.slick.GameContainer
|
9
|
+
java_import org.newdawn.slick.Graphics
|
10
|
+
java_import org.newdawn.slick.Image
|
11
|
+
java_import org.newdawn.slick.SlickException
|
12
|
+
java_import org.newdawn.slick.Input
|
13
|
+
java_import org.newdawn.slick.state.StateBasedGame
|
14
|
+
|
15
|
+
class ExampleGame < StateBasedGame
|
16
|
+
def initialize
|
17
|
+
super "Example Slick2d"
|
18
|
+
end
|
19
|
+
|
20
|
+
def initStatesList(gc)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
app = AppGameContainer.new(ExampleGame.new)
|
25
|
+
app.setDisplayMode(GunzABlazin.width, GunzABlazin.height, false)
|
26
|
+
app.start()
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-slick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.0b
|
5
5
|
prerelease: 3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -36,6 +36,7 @@ extensions: []
|
|
36
36
|
extra_rdoc_files: []
|
37
37
|
files:
|
38
38
|
- jruby-slick/tasks/jruby-slick.rake
|
39
|
+
- jruby-slick/template/example.rb
|
39
40
|
- bin/jruby-slick.rb
|
40
41
|
- .gitignore
|
41
42
|
- Rakefile
|