gosu 0.8.7.2 → 0.9.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/COPYING +29 -0
  3. data/Gosu/Audio.hpp +1 -0
  4. data/Gosu/Font.hpp +8 -4
  5. data/Gosu/Graphics.hpp +28 -18
  6. data/Gosu/GraphicsBase.hpp +17 -13
  7. data/Gosu/Image.hpp +54 -45
  8. data/Gosu/Input.hpp +5 -5
  9. data/Gosu/Version.hpp +3 -3
  10. data/Gosu/Window.hpp +1 -8
  11. data/README.txt +25 -0
  12. data/ext/gosu/gosu_wrap.cxx +1495 -1275
  13. data/ext/gosu/gosu_wrap.h +2 -2
  14. data/lib/gosu/patches.rb +71 -35
  15. data/lib/gosu/preview.rb +9 -142
  16. data/lib/gosu/swig_patches.rb +20 -10
  17. data/rdoc/gosu.rb +1185 -0
  18. data/src/Bitmap/BitmapUtils.cpp +9 -9
  19. data/src/Graphics/Common.hpp +3 -1
  20. data/src/Graphics/Graphics.cpp +100 -38
  21. data/src/Graphics/Image.cpp +57 -15
  22. data/src/Graphics/LargeImageData.cpp +9 -10
  23. data/src/Graphics/LargeImageData.hpp +1 -1
  24. data/src/Graphics/TexChunk.cpp +5 -6
  25. data/src/Graphics/TexChunk.hpp +1 -4
  26. data/src/Graphics/Texture.cpp +10 -3
  27. data/src/Graphics/Texture.hpp +1 -2
  28. data/src/Iconv.hpp +2 -2
  29. data/src/Input/Input.cpp +25 -9
  30. data/src/Input/InputTouch.mm +5 -3
  31. data/src/Text/Font.cpp +13 -8
  32. data/src/Window.cpp +66 -37
  33. data/src/WindowTouch.mm +3 -3
  34. metadata +79 -92
  35. data/examples/ChipmunkIntegration.rb +0 -275
  36. data/examples/CptnRuby.rb +0 -223
  37. data/examples/GosuZen.rb +0 -68
  38. data/examples/MoreChipmunkAndRMagick.rb +0 -155
  39. data/examples/OpenGLIntegration.rb +0 -226
  40. data/examples/RMagickIntegration.rb +0 -417
  41. data/examples/TextInput.rb +0 -154
  42. data/examples/Tutorial.rb +0 -131
  43. data/examples/media/Beep.wav +0 -0
  44. data/examples/media/CptnRuby Gem.png +0 -0
  45. data/examples/media/CptnRuby Map.txt +0 -25
  46. data/examples/media/CptnRuby Tileset.png +0 -0
  47. data/examples/media/CptnRuby.png +0 -0
  48. data/examples/media/Cursor.png +0 -0
  49. data/examples/media/Earth.png +0 -0
  50. data/examples/media/Explosion.wav +0 -0
  51. data/examples/media/Landscape.svg +0 -10
  52. data/examples/media/LargeStar.png +0 -0
  53. data/examples/media/Smoke.png +0 -0
  54. data/examples/media/Soldier.png +0 -0
  55. data/examples/media/Space.png +0 -0
  56. data/examples/media/Star.png +0 -0
  57. data/examples/media/Starfighter.bmp +0 -0
@@ -1,131 +0,0 @@
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
@@ -1,25 +0,0 @@
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
Binary file
Binary file
@@ -1,10 +0,0 @@
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
Binary file
Binary file