gosu 0.8.6-x64-mingw32

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 (63) hide show
  1. checksums.yaml +7 -0
  2. data/Gosu/Audio.hpp +171 -0
  3. data/Gosu/AutoLink.hpp +16 -0
  4. data/Gosu/Bitmap.hpp +96 -0
  5. data/Gosu/Buttons.hpp +265 -0
  6. data/Gosu/Color.hpp +204 -0
  7. data/Gosu/Directories.hpp +36 -0
  8. data/Gosu/Font.hpp +83 -0
  9. data/Gosu/Fwd.hpp +31 -0
  10. data/Gosu/Gosu.hpp +34 -0
  11. data/Gosu/Graphics.hpp +115 -0
  12. data/Gosu/GraphicsBase.hpp +110 -0
  13. data/Gosu/IO.hpp +269 -0
  14. data/Gosu/Image.hpp +122 -0
  15. data/Gosu/ImageData.hpp +61 -0
  16. data/Gosu/Input.hpp +149 -0
  17. data/Gosu/Inspection.hpp +14 -0
  18. data/Gosu/Math.hpp +135 -0
  19. data/Gosu/Platform.hpp +93 -0
  20. data/Gosu/Sockets.hpp +156 -0
  21. data/Gosu/TR1.hpp +56 -0
  22. data/Gosu/Text.hpp +71 -0
  23. data/Gosu/TextInput.hpp +70 -0
  24. data/Gosu/Timing.hpp +16 -0
  25. data/Gosu/Utility.hpp +28 -0
  26. data/Gosu/Version.hpp +19 -0
  27. data/Gosu/WinUtility.hpp +75 -0
  28. data/Gosu/Window.hpp +145 -0
  29. data/examples/ChipmunkIntegration.rb +275 -0
  30. data/examples/CptnRuby.rb +223 -0
  31. data/examples/GosuZen.rb +68 -0
  32. data/examples/MoreChipmunkAndRMagick.rb +155 -0
  33. data/examples/OpenGLIntegration.rb +226 -0
  34. data/examples/RMagickIntegration.rb +417 -0
  35. data/examples/TextInput.rb +154 -0
  36. data/examples/Tutorial.rb +131 -0
  37. data/examples/media/Beep.wav +0 -0
  38. data/examples/media/CptnRuby Gem.png +0 -0
  39. data/examples/media/CptnRuby Map.txt +25 -0
  40. data/examples/media/CptnRuby Tileset.png +0 -0
  41. data/examples/media/CptnRuby.png +0 -0
  42. data/examples/media/Cursor.png +0 -0
  43. data/examples/media/Earth.png +0 -0
  44. data/examples/media/Explosion.wav +0 -0
  45. data/examples/media/Landscape.svg +10 -0
  46. data/examples/media/LargeStar.png +0 -0
  47. data/examples/media/Smoke.png +0 -0
  48. data/examples/media/Soldier.png +0 -0
  49. data/examples/media/Space.png +0 -0
  50. data/examples/media/Star.png +0 -0
  51. data/examples/media/Starfighter.bmp +0 -0
  52. data/lib/gosu.rb +20 -0
  53. data/lib/gosu/patches.rb +81 -0
  54. data/lib/gosu/preview.rb +139 -0
  55. data/lib/gosu/run.rb +11 -0
  56. data/lib/gosu/swig_patches.rb +60 -0
  57. data/lib/gosu/zen.rb +89 -0
  58. data/lib64/2.1/gosu.so +0 -0
  59. data/lib64/FreeImage.dll +0 -0
  60. data/lib64/OpenAL32.dll +0 -0
  61. data/lib64/SDL2.dll +0 -0
  62. data/lib64/libsndfile.dll +0 -0
  63. metadata +110 -0
@@ -0,0 +1,131 @@
1
+ require 'rubygems'
2
+ require 'gosu'
3
+
4
+ module ZOrder
5
+ Background, Stars, Player, UI = *0..3
6
+ end
7
+
8
+ class Player
9
+ attr_reader :score
10
+
11
+ def initialize(window)
12
+ @image = Gosu::Image.new(window, "media/Starfighter.bmp", false)
13
+ @beep = Gosu::Sample.new(window, "media/Beep.wav")
14
+ @x = @y = @vel_x = @vel_y = @angle = 0.0
15
+ @score = 0
16
+ end
17
+
18
+ def warp(x, y)
19
+ @x, @y = x, y
20
+ end
21
+
22
+ def turn_left
23
+ @angle -= 4.5
24
+ end
25
+
26
+ def turn_right
27
+ @angle += 4.5
28
+ end
29
+
30
+ def accelerate
31
+ @vel_x += Gosu::offset_x(@angle, 0.5)
32
+ @vel_y += Gosu::offset_y(@angle, 0.5)
33
+ end
34
+
35
+ def move
36
+ @x += @vel_x
37
+ @y += @vel_y
38
+ @x %= 640
39
+ @y %= 480
40
+
41
+ @vel_x *= 0.95
42
+ @vel_y *= 0.95
43
+ end
44
+
45
+ def draw
46
+ @image.draw_rot(@x, @y, ZOrder::Player, @angle)
47
+ end
48
+
49
+ def collect_stars(stars)
50
+ stars.reject! do |star|
51
+ if Gosu::distance(@x, @y, star.x, star.y) < 35 then
52
+ @score += 10
53
+ @beep.play
54
+ true
55
+ else
56
+ false
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ class Star
63
+ attr_reader :x, :y
64
+
65
+ def initialize(animation)
66
+ @animation = animation
67
+ @color = Gosu::Color.new(0xff000000)
68
+ @color.red = rand(256 - 40) + 40
69
+ @color.green = rand(256 - 40) + 40
70
+ @color.blue = rand(256 - 40) + 40
71
+ @x = rand * 640
72
+ @y = rand * 480
73
+ end
74
+
75
+ def draw
76
+ img = @animation[Gosu::milliseconds / 100 % @animation.size]
77
+ img.draw(@x - img.width / 2.0, @y - img.height / 2.0,
78
+ ZOrder::Stars, 1, 1, @color, :add)
79
+ end
80
+ end
81
+
82
+ class GameWindow < Gosu::Window
83
+ def initialize
84
+ super(640, 480, false)
85
+ self.caption = "Gosu Tutorial Game"
86
+
87
+ @background_image = Gosu::Image.new(self, "media/Space.png", true)
88
+
89
+ @player = Player.new(self)
90
+ @player.warp(320, 240)
91
+
92
+ @star_anim = Gosu::Image::load_tiles(self, "media/Star.png", 25, 25, false)
93
+ @stars = Array.new
94
+
95
+ @font = Gosu::Font.new(self, Gosu::default_font_name, 20)
96
+ end
97
+
98
+ def update
99
+ if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then
100
+ @player.turn_left
101
+ end
102
+ if button_down? Gosu::KbRight or button_down? Gosu::GpRight then
103
+ @player.turn_right
104
+ end
105
+ if button_down? Gosu::KbUp or button_down? Gosu::GpButton0 then
106
+ @player.accelerate
107
+ end
108
+ @player.move
109
+ @player.collect_stars(@stars)
110
+
111
+ if rand(100) < 4 and @stars.size < 25 then
112
+ @stars.push(Star.new(@star_anim))
113
+ end
114
+ end
115
+
116
+ def draw
117
+ @background_image.draw(0, 0, ZOrder::Background)
118
+ @player.draw
119
+ @stars.each { |star| star.draw }
120
+ @font.draw("Score: #{@player.score}", 10, 10, ZOrder::UI, 1.0, 1.0, 0xffffff00)
121
+ end
122
+
123
+ def button_down(id)
124
+ if id == Gosu::KbEscape then
125
+ close
126
+ end
127
+ end
128
+ end
129
+
130
+ window = GameWindow.new
131
+ window.show
Binary file
@@ -0,0 +1,25 @@
1
+ #....................................................#
2
+ #....................................................#
3
+ #.............xx......x.x............................#
4
+ #............x..x....................................#
5
+ #x....x...x..x.......#####..xxx....................x.#
6
+ #.x.........................xxx.........##.........x.#
7
+ #...............""..........###...##..........##.....#
8
+ #..##..###..##..##...................................#
9
+ #........................................xx........###
10
+ #.............................###....................#
11
+ ##....##.............................................#
12
+ #....................##....##......##....##....##....#
13
+ #.................................................x..#
14
+ #...x....##....##.......x...x.....................x..#
15
+ #.....x...............x...x...x...................x..#
16
+ #......x...##.....##.................................#
17
+ #.......x.........................................#..#
18
+ #...........##........#...#...#..#.......x...........#
19
+ #...#................................................#
20
+ #....."""".................x.......#..#####...###....#
21
+ #x....#......................##......................#
22
+ #"""""#.....#.....x..................#...............#
23
+ ##xxxx......#........................................#
24
+ ##xxxx...#####............."...""""".................#
25
+ ######"""#############################################
Binary file
Binary file
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" clip-rule="evenodd" stroke-miterlimit="10" viewBox="0 0 850.39 637.80">
3
+ <desc>SVG generated by Lineform</desc>
4
+ <defs/>
5
+ <g>
6
+ <rect width="940.00" height="734.00" x="-25.50" y="-55.50" fill="#5FB7FF" stroke="#000000" stroke-width="2.20"/>
7
+ <path d="M 223.50 49.00 C 171.16 49.00 118.84 59.51 78.91 80.50 C -0.96 122.48 -0.96 190.52 78.91 232.50 C 134.24 261.59 213.37 270.50 283.34 259.28 C 350.32 290.78 452.18 289.47 516.06 255.19 C 582.65 219.45 582.65 161.55 516.06 125.81 C 482.95 108.04 439.59 99.12 396.19 99.03 C 388.26 92.46 378.99 86.23 368.09 80.50 C 328.16 59.51 275.84 49.00 223.50 49.00 Z M 223.50 49.00 " fill="#FFFFFF" stroke="#BFBFBF" stroke-width="6.00"/>
8
+ <path d="M 735.48 183.00 C 699.52 183.00 663.55 187.05 636.11 195.16 C 607.54 203.59 593.99 214.76 595.17 225.81 C 561.74 227.76 529.60 233.37 503.83 242.72 C 438.71 266.35 438.71 304.65 503.83 328.28 C 568.96 351.91 674.56 351.91 739.69 328.28 C 787.65 310.88 800.17 285.50 777.48 263.91 C 798.41 261.97 818.28 258.74 834.86 253.84 C 889.73 237.64 889.73 211.36 834.86 195.16 C 807.42 187.05 771.44 183.00 735.48 183.00 Z M 735.48 183.00 " fill="#FFFFFF" stroke="#BFBFBF" stroke-width="6.00"/>
9
+ </g>
10
+ </svg>
Binary file
Binary file
Binary file
@@ -0,0 +1,20 @@
1
+ require 'rbconfig'
2
+
3
+ if RUBY_PLATFORM =~ /mswin$|mingw32|win32-|-win32/ then
4
+ # 64-bit builds of Windows use "x64-mingw32" as RUBY_PLATFORM
5
+ suffix = '64' if RUBY_PLATFORM =~ /^x64-/
6
+
7
+ # Add this gem to the PATH on Windows so that DLLs can be found.
8
+ ENV['PATH'] = "#{File.dirname(__FILE__)}#{suffix};#{ENV['PATH']}"
9
+ end
10
+
11
+ begin
12
+ # If possible, use a precompiled binary.
13
+ RUBY_VERSION =~ /(\d+.\d+)/
14
+ require "../lib#{suffix}/#{$1}/gosu.#{RbConfig::CONFIG['DLEXT']}"
15
+ rescue LoadError
16
+ require "gosu.#{RbConfig::CONFIG['DLEXT']}"
17
+ end
18
+
19
+ require "gosu/swig_patches"
20
+ require "gosu/patches"
@@ -0,0 +1,81 @@
1
+ # Extend Numeric with simple angle conversion methods.
2
+ class ::Numeric
3
+ def degrees_to_radians
4
+ self * Math::PI / 180.0
5
+ end
6
+ def radians_to_degrees
7
+ self * 180.0 / Math::PI
8
+ end
9
+ def gosu_to_radians
10
+ (self - 90) * Math::PI / 180.0
11
+ end
12
+ def radians_to_gosu
13
+ self * 180.0 / Math::PI + 90
14
+ end
15
+ end
16
+
17
+ # Backwards compatibility: import constants into Gosu::Button.
18
+ module Gosu::Button
19
+ Gosu.constants.each { |c| const_set(c, Gosu.const_get(c)) }
20
+ end
21
+
22
+ # Backwards compatibility: Window arguments to Sample and Song
23
+ class Gosu::Sample
24
+ alias initialize_ initialize
25
+
26
+ def initialize(*args)
27
+ args.shift if args.first.is_a? Gosu::Window
28
+ initialize_(*args)
29
+ end
30
+ end
31
+ class Gosu::Song
32
+ alias initialize_ initialize
33
+
34
+ def initialize(*args)
35
+ args.shift if args.first.is_a? Gosu::Window
36
+ initialize_(*args)
37
+ end
38
+ end
39
+
40
+ # Color constants (SWIG messes up constants somehow)
41
+ class Gosu::Color
42
+ class Constant < Gosu::Color
43
+ private
44
+ def alpha=; end
45
+ def red=; end
46
+ def green=; end
47
+ def blue=; end
48
+ def hue=; end
49
+ def saturation=; end
50
+ def value=; end
51
+ end
52
+
53
+ NONE = Gosu::Color::Constant.argb(0x00000000)
54
+ BLACK = Gosu::Color::Constant.argb(0xff000000)
55
+ GRAY = Gosu::Color::Constant.argb(0xff808080)
56
+ WHITE = Gosu::Color::Constant.argb(0xffffffff)
57
+ AQUA = Gosu::Color::Constant.argb(0xff00ffff)
58
+ RED = Gosu::Color::Constant.argb(0xffff0000)
59
+ GREEN = Gosu::Color::Constant.argb(0xff00ff00)
60
+ BLUE = Gosu::Color::Constant.argb(0xff0000ff)
61
+ YELLOW = Gosu::Color::Constant.argb(0xffffff00)
62
+ FUCHSIA = Gosu::Color::Constant.argb(0xffff00ff)
63
+ CYAN = Gosu::Color::Constant.argb(0xff00ffff)
64
+ end
65
+
66
+ # Instance methods for button_id_to_char and char_to_button_id
67
+ class Gosu::Window
68
+ def button_id_to_char(id)
69
+ self.class.button_id_to_char(id)
70
+ end
71
+
72
+ def char_to_button_id(ch)
73
+ self.class.char_to_button_id(ch)
74
+ end
75
+ end
76
+
77
+ # Release OpenAL resources during Ruby's shutdown, not Gosu's.
78
+ at_exit do
79
+ Gosu::Song.current_song.stop if Gosu::Song.current_song
80
+ Gosu::_release_all_openal_resources
81
+ end
@@ -0,0 +1,139 @@
1
+ require 'gosu'
2
+
3
+ # Wrapper around Gosu 0.7 that provides the work-in-progress 0.8 interface
4
+
5
+ module Gosu
6
+ class Font
7
+ alias :initialize07 :initialize
8
+
9
+ def initialize *args
10
+ if args.first.is_a? Gosu::Window then
11
+ initialize07 *args
12
+ else
13
+ height = args[0]
14
+ options = args[1] || {}
15
+ name = options[:name] || Gosu::default_font_name
16
+ initialize07 $window, name, height
17
+ end
18
+ end
19
+ end
20
+
21
+ class Window
22
+ alias :initialize07 :initialize
23
+
24
+ def initialize width, height, *args
25
+ if args.empty? or args.first.is_a? Hash then
26
+ options = args.first || {}
27
+ fullscreen = !!options[:fullscreen]
28
+ update_interval = options[:update_interval] || 16.66
29
+ else
30
+ fullscreen, update_interval = *args
31
+ end
32
+ $window = initialize07 width, height, fullscreen, update_interval
33
+ end
34
+ end
35
+
36
+ class Image
37
+ alias :initialize07 :initialize
38
+
39
+ def initialize *args
40
+ if args.first.is_a? Gosu::Window then
41
+ initialize07 *args
42
+ else
43
+ source = args[0]
44
+ tileable = !args[1] || args[1][:tileable]
45
+ rect = args[1] && args[1][:rect]
46
+ if rect then
47
+ initialize07 $window, source, !!tileable, *rect
48
+ else
49
+ initialize07 $window, source, !!tileable
50
+ end
51
+ end
52
+ end
53
+
54
+ class <<self
55
+ alias load_tiles07 load_tiles
56
+ end
57
+
58
+ def self.load_tiles *args
59
+ if args.first.is_a? Gosu::Window then
60
+ load_tiles07 *args
61
+ else
62
+ source = args[0]
63
+ x, y = args[1..2]
64
+ tileable = !args[3] || args[3][:tileable]
65
+ load_tiles07 $window, source, x, y, !!tileable
66
+ end
67
+ end
68
+
69
+ def self.from_text *args
70
+ if args.first.is_a? Gosu::Window then
71
+ args.size == 4 ? from_text4(*args) : from_text7(*args)
72
+ else
73
+ text = args[0]
74
+ height = args[1]
75
+ options = args[2] || {}
76
+ font = options[:font] || Gosu::default_font_name
77
+ if width = options[:width] then
78
+ spacing = options[:spacing] || 0
79
+ align = options[:align] || :left
80
+ Gosu::Image.from_text7 $window, text, font, height, spacing, width, align
81
+ else
82
+ Gosu::Image.from_text4 $window, text, font, height
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ def self.button_down? id
89
+ $window.button_down? id
90
+ end
91
+
92
+ def self.mouse_x
93
+ $window.mouse_x
94
+ end
95
+
96
+ def self.mouse_y
97
+ $window.mouse_y
98
+ end
99
+
100
+ def self.draw_line *args
101
+ $window.draw_line *args
102
+ end
103
+
104
+ def self.draw_triangle *args
105
+ $window.draw_triangle *args
106
+ end
107
+
108
+ def self.draw_quad *args
109
+ $window.draw_quad *args
110
+ end
111
+
112
+ def self.clip_to *args, &draw
113
+ $window.clip_to *args, &draw
114
+ end
115
+
116
+ def self.translate *args, &draw
117
+ $window.translate *args, &draw
118
+ end
119
+
120
+ def self.scale *args, &draw
121
+ $window.scale *args, &draw
122
+ end
123
+
124
+ def self.rotate *args, &draw
125
+ $window.rotate *args, &draw
126
+ end
127
+
128
+ def self.transform *args, &draw
129
+ $window.transform *args, &draw
130
+ end
131
+
132
+ def self.record width, height, &draw
133
+ $window.record width, height, &draw
134
+ end
135
+
136
+ def self.gl *args, &draw
137
+ $window.gl *args, &draw
138
+ end
139
+ end
@@ -0,0 +1,11 @@
1
+ # Replace the load path
2
+ $LOAD_PATH.clear
3
+ $LOAD_PATH << File.dirname(__FILE__)[0..-6]
4
+ $LOAD_PATH << $LOAD_PATH[0] + '/lib'
5
+ # Ruby portions of Gosu
6
+ require 'gosu/patches'
7
+ require 'gosu/swig_patches'
8
+ # Let the application know it is being run from the Mac app wrapper.
9
+ OSX_EXECUTABLE = true
10
+ # Main application
11
+ require 'Main'