glapp 0.0.6

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,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
@@ -0,0 +1,40 @@
1
+ h1. GLApp - A tiny wrapper for ruby-opengl
2
+
3
+ It's simple:
4
+
5
+ # require "glapp"
6
+ # Include GLApp
7
+ # Override as many of the callbacks as you need:
8
+
9
+ * setup
10
+ * update(seconds)
11
+ * draw
12
+ * keyboard_down(key, modifiers)
13
+ * keyboard_up(key, modifiers)
14
+ * special_keyboard_down(key, modifiers)
15
+ * special_keyboard_up(key, modifiers)
16
+ * mouse_click(button, state, x, y)
17
+ * mouse_dragging_motion(x, y)
18
+ * mouse_passive_motion(x, y)
19
+ # If you need more control, override the default behavior of these:
20
+
21
+ * setup_context
22
+ * pre_draw
23
+ * post_draw
24
+ * resize
25
+ # Call show with width, height, title, and whether to be full-screen
26
+
27
+ Look at the scripts in the examples/ directory.
28
+ In fact, here's one:
29
+
30
+ require 'glapp'
31
+
32
+ class MyGame
33
+ include GLApp
34
+ def draw
35
+ glTranslate(0, 0, -5)
36
+ glutSolidCube(2)
37
+ end
38
+ end
39
+
40
+ MyGame.new.show 800, 600, "My Game"
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "glapp"
8
+ gem.summary = %Q{ruby-opengl wrapper for writing quick applets}
9
+ gem.email = "tom@alltom.com"
10
+ gem.homepage = "http://github.com/alltom/glapp"
11
+ gem.authors = ["Tom Lieber"]
12
+ gem.add_dependency("ruby-opengl", ">= 0.60.0")
13
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
14
+ end
15
+
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
+ end
19
+
20
+ require 'rake/testtask'
21
+ Rake::TestTask.new(:test) do |test|
22
+ test.libs << 'lib' << 'test'
23
+ test.pattern = 'test/**/*_test.rb'
24
+ test.verbose = true
25
+ end
26
+
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.pattern = 'test/**/*_test.rb'
32
+ test.verbose = true
33
+ end
34
+ rescue LoadError
35
+ task :rcov do
36
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
+ end
38
+ end
39
+
40
+
41
+ task :default => :test
42
+
43
+ require 'rake/rdoctask'
44
+ Rake::RDocTask.new do |rdoc|
45
+ if File.exist?('VERSION.yml')
46
+ config = YAML.load(File.read('VERSION.yml'))
47
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
48
+ else
49
+ version = ""
50
+ end
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "glapp #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
57
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.6
@@ -0,0 +1,4 @@
1
+ P6
2
+ 240 50
3
+ 255
4
+ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!B�!B�!B�!B�!B�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!!�!!�!!�!!�!B�!B�!B�!B�!B�!!�!!�!B�!B�!B�!B�!B���������!!�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!!�!!�!!�!!�!!�!B�!B�!!�祄!!�!B�cc�!B�!B�!B�!B���!!�!!�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!!�!!�!!�!!��cB祄祄!!�!B�cc�cc�!B�!B�!B�!!�!!�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!!�!B�!!��cB祄祄祄!B�cc�cc�cc�!B�!B�!B�!!�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!B�!B�!B�!!��cB�cB!B�!B�cc�cc�cc�cc�cc�!B�!B�!B�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�cc祥�cc�cc�!B�!B�!B�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!B�!B�!B�!B�!B�!B�!B�cc�cc�cc�cc�cc�cc�!!�!!�!!�!B�cc�cc�!B�!B�!B���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!B�!B�!B�!B�!B�!B�!B�!B�!B�cc����cc�!B�!!�!!������祥�cc�!B�!B�!B�cc�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!B�!!�!!�!!�!!�!!�!!�!!�!B�!B�!B�cc�!B�!B�!!������������祥�!!�!B�!Bƥ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!B�!B�!B�!B�!!����������������cc�!!�!B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������!!�!!�!!�!!�!!�!B�!B�!B�!B�!Bƥ��������������!!!���!!!���������������������������������������������������������������������������������������������������������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�����������������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�����������������������������������������������������������������������!!�!!�!!�!!�������������������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�����������������������������������������!!�!!�!!�!!�!B�!B�!B�!B�cc�������������!!!cc�!!!cc���������������������������������������������������������������������������������!!�!!�������������������������������������������������������������!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!!�!!�������������������������������������������������������!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!!�!!�����������������������������������������������������������!!�!!�!!�!!�!B�!B�!B�!B�!!�!!�!!�������������������������������������������������������!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!!�!!�����������������������������������!B�!B�!!�!!�!!�!!�!BƥcB祄祄���������������cB���!!!!!!������������������������������������������������������������������������������!!�!!�!!���������������������������������������������������������!!�!B�!B�cc�cc�cc�cc�!B�!B�!B�!B�!B�!B�!B�!!���������������������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������������������������������!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!���������������������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�������������������������������!B�!B�!B�!B�!!�!!�!!��cB祄���祄祄祄������祄祄!!!!!!cc�����������������������������������������������������������!!�!!�!B�!B�������������!!�!!�!!�!B���������������������������������������������������!!�!!�!B�cc�cc�cc�cc�cc�cc�cc�!B�!B�!B�!B�!B�!B�!B�!!���������������������������������������������!!�!!�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������������������������!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!!���������������������������������������������!!�!!�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!!���������������������������!B�!B�!B�!!�!!�!!�!!�!!��cB祄祄!!!祄祄祄祄祄祄�cB����������������������������������������������������������������!!�!B�!B�!B�!B���������!!�!!�!!�!B�������������������������������������������������!!�!B�cc�cc�cc�cc�cc�cc�cc����cc�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�cc����cc�!B�!B�!B�!B�!B�!B�!B�!B�!!�������������������������������������������!!�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!!�����������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�cc����cc�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������!B�!B�!!�!!�!!�!!�!!�!!�!!�!!��cB�cB祄�cB祄祄祄�cB�cB������������������������������������������������������������������!!�!!�!B�!B�!B�!B�!B���!!�!!�!!�!!�!B�!B���������������������������������������������!!�cc�cc�cc�!B�!B�!B�!B�cc�cc�cc�cc�cc�cc�cc�!B�!B�!B�!B�!B�!!���������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�cc�cc�!B�!B�!B�!B�!B�!!���������������������������������������!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!���������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�cc�cc�!B�!B�!B�!B�!B�!!�����������������������!B�!!���������!!�!!�!!�!!�!!�!!��cB�cB�cB�cB�cB������������������������������������������������������������������������!!�!B�!B�!B�!B�!B�!!�!!�!!�!!�!!�!B�!B�������������������������������������������!!�!B�cc�!B�!B�!B�!B�!B�!B�!B�cc�cc�cc�cc�������cc�!B�!B�!B�!B�!!�������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�������cc�!B�!B�!B�!B�!!�������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�������cc�!B�!B�!B�!B�!!���������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!���������������������������������������������������������������������!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!!�!!�!B�!B�cc�!B�����������������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�cc�������������cc�!B�!B�!B�!B�!!���������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�������������cc�!B�!B�!B�!B�!!���������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�������cc�!B�!B�!B�!B�!B�!B�!!���������������������������������!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�������������cc�!B�!B�!B�!B�!!�������������������������������!!�!!�!!��cB祄祄!!�!BƥcB祄���cB�����祥ƥ��������������������������������������������������������������!!�!!�!!�!B�!!�������!!�!B�!B�!B�!B�!Bƥ��!B���������������������������������������!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�cc�������������cc�!B�!B�!B�!B�!!�������������������������������!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�������������cc�!B�!B�cc�cc�!!�������������������������������!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�������cc�!B�!B�!B�!B�!B�!B�!!�������������������������������!!�!!�!B�!B�cc�cc�cc�cc�!B�!B�!B�!B�!B�!B�cc�������������cc�!B�!B�!B�!B�!!�����������������������������!!�!!�!!��cB祄祄!!�!BƥcB祄���������cc���������祥���������������������������������������������������!B�!B�!B���!!�!!�!B�!B�!Bƥ�����!!�!!���祥�!B�cc�!B�!B���������!!�����������������������������!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�cc�������cc�!B�!B�!B�!B�!B�!!�������������������������������!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�������cc�!B�!B�!B�cc�cc�!!�����������������������������!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�!B�!B�!B�!B�!B�!B�!B�!!�������������������������������!!�!B�cc�cc�cc�cc�cc�cc�cc�!B�!B�!B�!B�!B�!B�cc�������cc�!B�!B�!B�!B�!B�!!�����������������������������!!���cBcc�������������cB祄祄���祄cc���祥�cc������������������������������������������������������!!�!B�!B�!B�!!�!!�������!Bƥ�����!!���祥�!!�!B�!B�!B�!B�������!!�!B���������������������������!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�cc�cc�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�!B�!B�!B�cc�cc�!B�!!���������������������������!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!B�!!�cc�cc�cc�!B�cc�cc�cc�cc�!B�!B�!B�!B�!B�cc�cc�!B�!B�!B�!B�!B�!B�!!���������������������������������cc�������������������cB祄祄祄cc����cc�����������������������������������������������������������!!�!B�!B�!!�!!�cc���������������祥�!!�!B�!B�!B�!B�!!�!!�!!�!!�!!�!B���������������������������!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�������������������������������!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�cc�!!���������������������������!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!B�!!�cc�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!���������������������������������!!�cc������������������祥ƥcB祄!B�cc�cc���ƥ�ƥ������������������������������������������������������!!�!B�!!�!B�!B�!Bƥ��������������������������!!�!B�!!�!!�!!�!!�!!�!B�������������������������!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�cc�cc�!B�!!���������������������������!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������������cc���������������祥ƥ��!B�!B���cc���ƥ��cc�����������������������������������������������������!B�!!�!!�!!�!!�!B�!B�!!����������������������cB祄!!�!!�!!�!!�!!�!B�!B�������������������������!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�cc�cc�cc�cc�cc�cc�cc�!B�!!�������������������������!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!B�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������������cc�cc������祥���祥�cc�!B�!B�����cc�cc�������������������������������������������������!!���!B�!!�!!�!!�!!�!!�!B�!B����cc����������cc�cc��cB祄祄cc�!!�!!�!!�!B�!B�!B�����������������������!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�cc�cc�cc�cc�cc�cc�cc�!B�!!���������������������������!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!B�!B�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!���������������������������������������cc������祥ƥ��cc���!!�!B���������������������������������������������������������!!�!!�!!�!!�!!��cB祄!!�!!�!B�������cc�cc�cc�!B�cc�cc�cc�cc�!B�!!�!!�!B�!B�!B�������������������������!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!���������������������������!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������������������cc�cc�cc�cc�����!!�!B�����������������������������������������������������������!!�!!�!!�!!���cB祄!!�祄�������!!�!B�!B�!B�cc�cc�!B�!B�!B�!B�!B�cc�!B�������������������������!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�������������������������������!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!���������������������������!!�!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�������������������������������!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�������������������������������������������!!�!!�!B�����cc�!!�!B�������������������������������������������������������������!!�!!�!!!!!!��cB祄�cB�cB!B�cc�cc�cc�!B�!B�!B�!B�!B�!B�!Bƥ��cc�!B�������������������������!!�!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!B�!!�������������������������������!!�!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!B�!!�����������������������������!!�!!�!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�������������������������������!!�!!�!!�!!�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!B�!!�������������������������������������������cc����!!�!B���cc����!!�!Bƥ������������������������������������������������������������!!�cc����!!�!B�!!!cc��cB!!�cc�cc�cc����cc�cc�!B�!B�!B�!B�cc�cc�!B���������������������������!!�!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!!�!B�!!�������������������������������!!�!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!!�!B�!!�����������������������������!!�!!�!!�!!�!!�!B�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!���������������������������������!!�!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!!�!B�!!�����������������������������������������cc���ƥ�������祥�cc���������祥�����������������������������������������������������������cc���ƥ�������祥�cc�cc�!B�!B�cc�cc�cc�!B�!B�!B�!B�!B�!B�!B�!B�����������������������������!!�!!�!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!B�!!�!B�!B�!!���������������������������������!!�!!�!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!B�!!�!B�!B�!!�������������������������������!!�!B�!!�!!�!!�!!�!B�!!�!B�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�����������������������������������!!�!!�!!�!!�!!�!!�!!�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B�!!�!B�!!�!B�!B�!!�������������������������������������������cc�cc�cc���ƥ��cc�cc�cc���ƥ��cc�����������������������������������������������������������cc�cc�cc���ƥ��cc�cc�!B�cc�!B�!B�!B�!B�!B�!B�!B�!B�!B�!B���������������������������������!!�!!�!!�!!�!!�!!�!!�!B�!B�!!�!B�!B�!B�!B�!B�!!�!B�!!�!B�!!�!!�!!�!!�����������������������������������!!�!!�!!�!!�!!�!!�!!�!B�!B�!!�!B�!B�!B�!B�!B�!!�!B�!!�!B�!!�!!�!!�!!���������������������������������!!�!!�!!�!!�!!�!!�!!�!B�!!�!B�!!�!B�!!�!B�!!�!B�!!�!B�!!�!B�!!�!B�!!�������������������������������������!!�!!�!!�!!�!!�!!�!!�!B�!B�!!�!B�!B�!B�!B�!B�!!�!B�!!�!B�!!�!!�!!�!!���������������������������������������������!!!����!!!���ƥ�Ƅ���������������������������������������������������������!!!����!!!�������!B�!B�!B�!B�!B�!B�!B�!B���������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!B�!!�!B�!!�!B�!!�!B�!!�!B�!!�!!�!!�!!���������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!B�!!�!B�!!�!B�!!�!B�!!�!B�!!�!!�!!�!!�����������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!B�!!�!B�!!�!B�!!�!B�!!�!!�!!�!!�!!�����������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!B�!!�!B�!!�!B�!!�!B�!!�!B�!!�!!�!!�!!���������������������������������������������!!!����������������!!!�������������������������������������������������������������!!!����������������!!!���!B�!B�!B�!B�!B������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!B�!!�!!�!!�!B�!!�!!�!!�!!�!!�!!�����������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!B�!!�!!�!!�!B�!!�!!�!!�!!�!!�!!���������������������������������������!!�!B�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!���������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!B�!!�!!�!!�!B�!!�!!�!!�!!�!!�!!�����������������������������������������������!!!����������Ƅ�����ƥ���������������������������������������������������!!!����������Ƅ������!!�!!�!!������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!���������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�����������������������������������������!!�!!�!B�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�������������������������������������������������!!!���������!!!��cc�cc���Ƅ�����������������������������������������������!!!���������!!!��cc�cc����!!�!!���������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!���������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�����������������������������������������������!!�!!�!!�!B�!B�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�����������������������������������������������������!!!�������!!!��cc�cc�cc����������������������������������������������!!!�������!!!��cc�cc�cc����������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!���������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�����������������������������������������������������!!�!!�!!�!B�!B�!B�!B�!!�!!�!!�!!�!!�������������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�!!�����������������������������������������������������������!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!������������������������������������!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!������������������������������������������!!�!!�!!�!!�!!�!!�!!�������������������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�������������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�������������������������������������������������������������������������!!�!!�!!�!!�!!�!!�!!�����������������������������������
@@ -0,0 +1,174 @@
1
+ require "rubygems"
2
+ require "glapp"
3
+
4
+ include GLApp
5
+
6
+ class Texture
7
+ attr_reader :num, :width, :height
8
+
9
+ # expects a P6 PPM, with no comments, and values 0-255
10
+ # mask is can be an RGB triple (ex: [255, 0, 255])
11
+ def initialize(filename, mask = nil)
12
+ # read the texture file
13
+ format, size, depth, pixels = File.read(filename).split(/\n/, 4)
14
+ @width, @height = size.split.map{|c| c.to_i}
15
+
16
+ # convert to ARGB, applying a mask if given
17
+ pixels = pack_pixarr(unpack_ppm(pixels, mask))
18
+
19
+ # create the OpenGL texture
20
+ # I hear it's more efficient if the dimensions are powers of 2
21
+ @num = glGenTextures(1).first
22
+ glBindTexture(GL_TEXTURE_2D, @num)
23
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
24
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
25
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, @width, @height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels)
26
+ end
27
+
28
+ private
29
+
30
+ def unpack_ppm(ppm, mask = nil)
31
+ arr = []
32
+ each_triple(ppm.unpack("C*")) do |triple|
33
+ arr << triple + [triple == mask ? 0 : 255]
34
+ end
35
+ arr
36
+ end
37
+
38
+ def pack_pixarr(arr)
39
+ arr.flatten.pack("C*")
40
+ end
41
+
42
+ def each_triple(arr)
43
+ buf = []
44
+ arr.each do |i|
45
+ buf << i
46
+ if buf.length == 3
47
+ yield buf
48
+ buf = []
49
+ end
50
+ end
51
+ end
52
+
53
+ end
54
+
55
+ class Sprite
56
+ def initialize(texture, x, y, w, h)
57
+ @tex = texture
58
+ @x, @y, @w, @h = x, y, w, h
59
+ end
60
+
61
+ def render
62
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
63
+ glEnable(GL_BLEND)
64
+
65
+ glMatrixMode(GL_TEXTURE)
66
+ glPushMatrix
67
+ glLoadIdentity
68
+ glOrtho(0, 2*@tex.width, 0, 2*@tex.height, -1, 1)
69
+
70
+ glBindTexture(GL_TEXTURE_2D, @tex.num)
71
+ glBegin(GL_QUADS)
72
+ glColor3f(1.0, 1.0, 1.0)
73
+ glTexCoord2d(@x, @y)
74
+ glVertex2d(-@w/2, -@h/2)
75
+ glTexCoord2d(@x + @w, @y)
76
+ glVertex2d(@w/2, -@h/2)
77
+ glTexCoord2d(@x + @w, @y + @h)
78
+ glVertex2d(@w/2, @h/2)
79
+ glTexCoord2d(@x, @y + @h)
80
+ glVertex2d(-@w/2, @h/2)
81
+ glEnd
82
+
83
+ glMatrixMode(GL_TEXTURE)
84
+ glPopMatrix
85
+ glMatrixMode(GL_MODELVIEW)
86
+ glDisable(GL_BLEND)
87
+ end
88
+ end
89
+
90
+ # state machine encoding frame transitions for hedgehog animation
91
+ class HedgehogAction
92
+ attr_reader :frame
93
+
94
+ def initialize
95
+ @frame = 0
96
+ @frametime = 0
97
+ @state = :standing
98
+ end
99
+
100
+ def duck
101
+ if @state == :standing
102
+ @frame = 1
103
+ @state = :ducking
104
+ end
105
+ end
106
+
107
+ def stand
108
+ if @state != :standing
109
+ @frame = 1
110
+ @state = :getting_up
111
+ end
112
+ end
113
+
114
+ def update(seconds)
115
+ @frametime += seconds
116
+
117
+ while @frametime > 0.1
118
+ @frametime -= 0.1
119
+ if @state == :getting_up
120
+ @frame = 0
121
+ @state = :standing
122
+ elsif @state == :ducking
123
+ @frame = 2
124
+ @state = :spinning
125
+ elsif @state == :spinning
126
+ @frame = (((@frame - 2) + 1) % 4) + 2
127
+ end
128
+ end
129
+ end
130
+ end
131
+
132
+ def setup
133
+ glEnable(GL_TEXTURE_2D)
134
+
135
+ # cannot allocate textures until OpenGL window is created
136
+ # so be sure to do this in setup at the earliest
137
+ hedgehog = Texture.new("hedgehog.ppm", [1, 170, 225])
138
+ @sprites = (0..5).map { |i| Sprite.new(hedgehog, i*40, 0, 40, 50) }
139
+ @animator = HedgehogAction.new
140
+ end
141
+
142
+ def keyboard_down(key, modifiers)
143
+ @animator.duck
144
+ end
145
+
146
+ def keyboard_up(key, modifiers)
147
+ exit if key == 27 # escape
148
+ @animator.stand
149
+ end
150
+
151
+ def update(seconds)
152
+ @animator.update(seconds)
153
+ end
154
+
155
+ def pre_draw
156
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
157
+
158
+ # change coordinate system to match screen pixels
159
+ glMatrixMode(GL_PROJECTION)
160
+ glLoadIdentity
161
+ glOrtho(0, width, height, 0, -1000, 1000)
162
+ glMatrixMode(GL_MODELVIEW)
163
+ glLoadIdentity
164
+ end
165
+
166
+ def draw
167
+ # draw a hedgehog in the center of the screen
168
+ glPushMatrix
169
+ glTranslate(width/2, height/2, 0)
170
+ @sprites[@animator.frame].render
171
+ glPopMatrix
172
+ end
173
+
174
+ show 300, 300, "sprite demo"
@@ -0,0 +1,56 @@
1
+ require "rubygems"
2
+ require "glapp"
3
+
4
+ class Triangle
5
+ attr_accessor :angle
6
+
7
+ def initialize(angle)
8
+ @angle = angle
9
+ end
10
+
11
+ def self.boom(num)
12
+ slice = (2.0 * Math::PI) / num.to_f
13
+ (1..num).map { |i| Triangle.new(slice * i) }
14
+ end
15
+
16
+ def draw
17
+ glPushMatrix
18
+ glTranslate 0, 0.5, -5
19
+ glRotate 110, 1, 0, 0
20
+ glTranslate 3.0 * Math::sin(@angle), 3.0 * Math::cos(@angle), 0
21
+ glRotate @angle * 90, 1, 1, 1
22
+ glBegin GL_TRIANGLES
23
+ glColor 1, 0, 0
24
+ glVertex 0, 1, 0
25
+
26
+ glColor 0, 1, 0
27
+ glVertex -1, -1, 0
28
+
29
+ glColor 0, 0, 1
30
+ glVertex 1, -1, 0
31
+ glEnd
32
+ glPopMatrix
33
+ end
34
+ end
35
+
36
+ class TriangleDemo
37
+ include GLApp
38
+
39
+ def setup
40
+ @triangles = Triangle.boom(10)
41
+ end
42
+
43
+ def update(seconds)
44
+ @triangles.each { |tri| tri.angle += seconds }
45
+ end
46
+
47
+ def draw
48
+ @triangles.each { |tri| tri.draw }
49
+ end
50
+
51
+ def keyboard_up(key, modifiers)
52
+ exit if key == 27 # escape
53
+ end
54
+ end
55
+
56
+ TriangleDemo.new.show 800, 300, "triangle demo"
@@ -0,0 +1,55 @@
1
+ # the same demo as triangles.rb except all of the hook methods are in
2
+ # the top-level instead of in a class
3
+
4
+ require "rubygems"
5
+ require "glapp"
6
+
7
+ include GLApp
8
+
9
+ class Triangle
10
+ attr_accessor :angle
11
+
12
+ def initialize(angle)
13
+ @angle = angle
14
+ end
15
+
16
+ def self.boom(num)
17
+ slice = (2.0 * Math::PI) / num.to_f
18
+ (1..num).map { |i| Triangle.new(slice * i) }
19
+ end
20
+
21
+ def draw
22
+ glPushMatrix
23
+ glTranslate(0, 0.5, -5)
24
+ glRotate(110, 1, 0, 0)
25
+ glTranslate(3.0 * Math::sin(@angle), 3.0 * Math::cos(@angle), 0)
26
+ glRotate(@angle * 90, 1, 1, 1)
27
+ glBegin(GL_TRIANGLES)
28
+ glColor(1, 0, 0)
29
+ glVertex(0, 1, 0)
30
+
31
+ glColor(0, 1, 0)
32
+ glVertex(-1, -1, 0)
33
+
34
+ glColor(0, 0, 1)
35
+ glVertex(1, -1, 0)
36
+ glEnd
37
+ glPopMatrix
38
+ end
39
+ end
40
+
41
+ def update(seconds)
42
+ @triangles.each { |tri| tri.angle += seconds }
43
+ end
44
+
45
+ def draw
46
+ @triangles.each { |tri| tri.draw }
47
+ end
48
+
49
+ def keyboard_up(key, modifiers)
50
+ exit if key == 27 # escape
51
+ end
52
+
53
+ @triangles = Triangle.boom(10)
54
+
55
+ show 800, 300, "triangle demo"
@@ -0,0 +1,53 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{glapp}
8
+ s.version = "0.0.6"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tom Lieber"]
12
+ s.date = %q{2010-07-10}
13
+ s.email = %q{tom@alltom.com}
14
+ s.extra_rdoc_files = [
15
+ "README.textile"
16
+ ]
17
+ s.files = [
18
+ ".gitignore",
19
+ "README.textile",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "examples/hedgehog.ppm",
23
+ "examples/sprite.rb",
24
+ "examples/triangles.rb",
25
+ "examples/triangles2.rb",
26
+ "glapp.gemspec",
27
+ "lib/glapp.rb"
28
+ ]
29
+ s.homepage = %q{http://github.com/alltom/glapp}
30
+ s.rdoc_options = ["--charset=UTF-8"]
31
+ s.require_paths = ["lib"]
32
+ s.rubygems_version = %q{1.3.6}
33
+ s.summary = %q{ruby-opengl wrapper for writing quick applets}
34
+ s.test_files = [
35
+ "examples/sprite.rb",
36
+ "examples/triangles.rb",
37
+ "examples/triangles2.rb"
38
+ ]
39
+
40
+ if s.respond_to? :specification_version then
41
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
45
+ s.add_runtime_dependency(%q<ruby-opengl>, [">= 0.60.0"])
46
+ else
47
+ s.add_dependency(%q<ruby-opengl>, [">= 0.60.0"])
48
+ end
49
+ else
50
+ s.add_dependency(%q<ruby-opengl>, [">= 0.60.0"])
51
+ end
52
+ end
53
+
@@ -0,0 +1,179 @@
1
+ require 'rubygems'
2
+ require 'opengl'
3
+
4
+ module GLApp
5
+ attr_reader :width, :height, :title
6
+
7
+ def show(width, height, title = "glapp", fullscreen = false)
8
+ glutInit
9
+ glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)
10
+
11
+ @width = width
12
+ @height = height
13
+ @title = title
14
+
15
+ fullscreen ? go_fullscreen : go_windowed
16
+ setup
17
+
18
+ setup_context
19
+ wire
20
+ glutMainLoop
21
+ end
22
+
23
+ def go_windowed
24
+ if glutGameModeGet(GLUT_GAME_MODE_ACTIVE) != 0
25
+ glutLeaveGameMode
26
+ end
27
+
28
+ unless @window
29
+ glutInitWindowSize(width, height)
30
+ @window = glutCreateWindow(title)
31
+ end
32
+ end
33
+
34
+ def go_fullscreen
35
+ glutGameModeString([width, height].join("x"))
36
+
37
+ if glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)
38
+ glutEnterGameMode
39
+ if glutGameModeGet(GLUT_GAME_MODE_ACTIVE) == 0
40
+ go_windowed
41
+ end
42
+ else
43
+ go_windowed
44
+ end
45
+ end
46
+
47
+ module Helpers
48
+ def clear
49
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
50
+ end
51
+ end
52
+
53
+ # begin hooks
54
+
55
+ def setup_context
56
+ glEnable(GL_DEPTH_TEST)
57
+ glEnable(GL_BLEND)
58
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
59
+ glutIgnoreKeyRepeat(1)
60
+ end
61
+
62
+ def setup
63
+ end
64
+
65
+ def pre_draw
66
+ glMatrixMode(GL_PROJECTION)
67
+ glLoadIdentity
68
+ gluPerspective(30.0, width / height, 0.1, 1000.0)
69
+
70
+ glMatrixMode(GL_MODELVIEW)
71
+ glLoadIdentity
72
+ end
73
+
74
+ def draw
75
+ end
76
+
77
+ def post_draw
78
+ glutSwapBuffers
79
+ end
80
+
81
+ def update(seconds)
82
+ end
83
+
84
+ def keyboard_down(key, modifiers)
85
+ end
86
+
87
+ def keyboard_up(key, modifiers)
88
+ end
89
+
90
+ def special_keyboard_down(key, modifiers)
91
+ end
92
+
93
+ def special_keyboard_up(key, modifiers)
94
+ end
95
+
96
+ def mouse_click(button, state, x, y)
97
+ end
98
+
99
+ def mouse_dragging_motion(x, y)
100
+ end
101
+
102
+ def mouse_passive_motion(x, y)
103
+ end
104
+
105
+ def mouse_motion(x, y)
106
+ end
107
+
108
+ def resize
109
+ # Reset the coordinate system
110
+ glMatrixMode(GL_PROJECTION)
111
+ glLoadIdentity
112
+
113
+ # Set the viewport to be the entire window
114
+ glViewport(0, 0, width, height)
115
+
116
+ # Set the correct perspective
117
+ gluPerspective(45, width.to_f / height.to_f, 1, 1000)
118
+ glMatrixMode(GL_MODELVIEW)
119
+ glLoadIdentity
120
+ gluLookAt(0, 0, 5,
121
+ 0, 0, -1,
122
+ 0, 1, 0)
123
+ end
124
+
125
+ # end hooks
126
+
127
+ def wire
128
+ glutDisplayFunc(lambda do
129
+ pre_draw
130
+ draw
131
+ post_draw
132
+ end)
133
+
134
+ glutIdleFunc(lambda do
135
+ time = Time.now
136
+ @last_time ||= time
137
+ delta = time - @last_time
138
+ update(delta)
139
+ @last_time = time
140
+ glutPostRedisplay
141
+ end)
142
+
143
+ glutKeyboardFunc(lambda do |key, x, y|
144
+ keyboard_down(key, glutGetModifiers)
145
+ end)
146
+
147
+ glutKeyboardUpFunc(lambda do |key, x, y|
148
+ keyboard_up(key, glutGetModifiers)
149
+ end)
150
+
151
+ glutSpecialFunc(lambda do |key, x, y|
152
+ special_keyboard_down(key, glutGetModifiers)
153
+ end)
154
+
155
+ glutSpecialUpFunc(lambda do |key, x, y|
156
+ special_keyboard_up(key, glutGetModifiers)
157
+ end)
158
+
159
+ glutMouseFunc(lambda do |button, state, x, y|
160
+ mouse_click(button, state, x, y)
161
+ end)
162
+
163
+ glutMotionFunc(lambda do |x, y|
164
+ mouse_dragging_motion(x, y)
165
+ mouse_motion(x, y)
166
+ end)
167
+
168
+ glutPassiveMotionFunc(lambda do |x, y|
169
+ mouse_passive_motion(x, y)
170
+ mouse_motion(x, y)
171
+ end)
172
+
173
+ glutReshapeFunc(lambda do |width, height|
174
+ @width = width
175
+ @height = height
176
+ resize
177
+ end)
178
+ end
179
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: glapp
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 6
9
+ version: 0.0.6
10
+ platform: ruby
11
+ authors:
12
+ - Tom Lieber
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-07-10 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: ruby-opengl
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 60
30
+ - 0
31
+ version: 0.60.0
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description:
35
+ email: tom@alltom.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - README.textile
42
+ files:
43
+ - .gitignore
44
+ - README.textile
45
+ - Rakefile
46
+ - VERSION
47
+ - examples/hedgehog.ppm
48
+ - examples/sprite.rb
49
+ - examples/triangles.rb
50
+ - examples/triangles2.rb
51
+ - glapp.gemspec
52
+ - lib/glapp.rb
53
+ has_rdoc: true
54
+ homepage: http://github.com/alltom/glapp
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options:
59
+ - --charset=UTF-8
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ requirements: []
77
+
78
+ rubyforge_project:
79
+ rubygems_version: 1.3.6
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: ruby-opengl wrapper for writing quick applets
83
+ test_files:
84
+ - examples/sprite.rb
85
+ - examples/triangles.rb
86
+ - examples/triangles2.rb