gosu 0.7.25 → 0.7.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ #include <Gosu/Timing.hpp>
2
+ #include <unistd.h>
3
+
4
+ void Gosu::sleep(unsigned milliseconds)
5
+ {
6
+ usleep(milliseconds * 1000);
7
+ }
8
+
9
+ // Thanks to this blog for the unconvoluted code example:
10
+ // http://shiftedbits.org/2008/10/01/mach_absolute_time-on-the-iphone/
11
+
12
+ #include <boost/cstdint.hpp>
13
+ #include <mach/mach_time.h>
14
+
15
+ unsigned long Gosu::milliseconds()
16
+ {
17
+ static boost::uint64_t firstTick = 0;
18
+ static mach_timebase_info_data_t info;
19
+
20
+ if (firstTick == 0)
21
+ {
22
+ mach_timebase_info(&info);
23
+ firstTick = mach_absolute_time();
24
+ }
25
+
26
+ boost::uint64_t runtime = mach_absolute_time() - firstTick;
27
+ return runtime * info.numer / info.denom / 1000000.0;
28
+ }
@@ -32,7 +32,8 @@ string Gosu::wstringToUTF8(const std::wstring& ws)
32
32
  length: ws.size() * sizeof(wchar_t)
33
33
  encoding:NSUTF32LittleEndianStringEncoding]);
34
34
  ObjRef<NSAutoreleasePool> pool([[NSAutoreleasePool alloc] init]);
35
- return [str.obj() UTF8String];
35
+ const char* utf8 = [str.obj() UTF8String];
36
+ return utf8 ? utf8 : string();
36
37
  }
37
38
  wstring Gosu::widen(const string& s)
38
39
  {
@@ -335,7 +335,8 @@ std::wstring Gosu::Window::caption() const
335
335
  return L"";
336
336
 
337
337
  ObjRef<NSAutoreleasePool> pool([[NSAutoreleasePool alloc] init]);
338
- return Gosu::utf8ToWstring([[pimpl->window.obj() title] UTF8String]);
338
+ const char* utf8 = [[pimpl->window.obj() title] UTF8String];
339
+ return utf8 ? Gosu::utf8ToWstring(utf8) : std::wstring();
339
340
  }
340
341
 
341
342
  void Gosu::Window::setCaption(const std::wstring& caption)
@@ -25,7 +25,7 @@ class Gosu::Sample
25
25
 
26
26
  def initialize(*args)
27
27
  args.shift if args.first.is_a? Gosu::Window
28
- new_initialize *args
28
+ new_initialize(*args)
29
29
  end
30
30
  end
31
31
  class Gosu::Song
@@ -33,7 +33,7 @@ class Gosu::Song
33
33
 
34
34
  def initialize(*args)
35
35
  args.shift if args.first.is_a? Gosu::Window
36
- new_initialize *args
36
+ new_initialize(*args)
37
37
  end
38
38
  end
39
39
 
@@ -50,17 +50,17 @@ class Gosu::Color
50
50
  def value=; end
51
51
  end
52
52
 
53
- NONE = Gosu::Color::Constant.new(0x00000000)
54
- BLACK = Gosu::Color::Constant.new(0xff000000)
55
- GRAY = Gosu::Color::Constant.new(0xff808080)
56
- WHITE = Gosu::Color::Constant.new(0xffffffff)
57
- AQUA = Gosu::Color::Constant.new(0xff00ffff)
58
- RED = Gosu::Color::Constant.new(0xffff0000)
59
- GREEN = Gosu::Color::Constant.new(0xff00ff00)
60
- BLUE = Gosu::Color::Constant.new(0xff0000ff)
61
- YELLOW = Gosu::Color::Constant.new(0xffffff00)
62
- FUCHSIA = Gosu::Color::Constant.new(0xffff00ff)
63
- CYAN = Gosu::Color::Constant.new(0xff00ffff)
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
64
  end
65
65
 
66
66
  # Instance methods for button_id_to_char and char_to_button_id
@@ -14,7 +14,7 @@ puts
14
14
 
15
15
  # FIXME should reversely filter out files ending in Win, Mac, Touch, AL etc.
16
16
  SOURCE_FILES =
17
- %w(Math.cpp Utility.cpp IO.cpp FileUnix.cpp InputX.cpp TextInputX.cpp TimingUnix.cpp WindowX.cpp
17
+ %w(Math.cpp Utility.cpp IO.cpp FileUnix.cpp InputX.cpp TextInputX.cpp TimingApple.cpp WindowX.cpp
18
18
  Graphics/Bitmap.cpp Graphics/BitmapUtils.cpp Graphics/Color.cpp
19
19
  Graphics/TexChunk.cpp Graphics/Graphics.cpp Graphics/Image.cpp
20
20
  Graphics/BlockAllocator.cpp
@@ -38,7 +38,7 @@ sdl_config = with_config("sdl-config", "sdl-config")
38
38
  pango_config = "pkg-config pangoft2" # FIXME should probably use with_config
39
39
 
40
40
  $INCFLAGS << " -I../ -I../GosuImpl `#{sdl_config} --cflags` `#{pango_config} --cflags`"
41
- $LDFLAGS << " `#{pango_config} --libs` -lX11"
41
+ $LDFLAGS << " `#{sdl_config} --libs` `#{pango_config} --libs` -lX11"
42
42
  have_header('SDL_mixer.h') if have_library('SDL_mixer', 'Mix_OpenAudio')
43
43
  have_header('SDL_ttf.h') if have_library('SDL_ttf', 'TTF_RenderUTF8_Blended')
44
44
  have_header('gl.h') if have_library('GL', 'glMatrixMode')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 25
10
- version: 0.7.25
9
+ - 26
10
+ version: 0.7.26
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julian Raschke
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-02 00:00:00 +01:00
19
+ date: 2011-01-09 00:00:00 +08:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -31,31 +31,6 @@ extra_rdoc_files: []
31
31
  files:
32
32
  - COPYING.txt
33
33
  - README.txt
34
- - lib/gosu.rb
35
- - lib/gosu/patches.rb
36
- - lib/gosu/swig_patches.rb
37
- - examples/ChipmunkIntegration.rb
38
- - examples/CptnRuby.rb
39
- - examples/MoreChipmunkAndRMagick.rb
40
- - examples/OpenGLIntegration.rb
41
- - examples/RMagickIntegration.rb
42
- - examples/TextInput.rb
43
- - examples/Tutorial.rb
44
- - examples/media/Beep.wav
45
- - examples/media/CptnRuby Gem.png
46
- - examples/media/CptnRuby Map.txt
47
- - examples/media/CptnRuby Tileset.png
48
- - examples/media/CptnRuby.png
49
- - examples/media/Cursor.png
50
- - examples/media/Earth.png
51
- - examples/media/Explosion.wav
52
- - examples/media/LargeStar.png
53
- - examples/media/Sky.jpg
54
- - examples/media/Smoke.png
55
- - examples/media/Soldier.png
56
- - examples/media/Space.png
57
- - examples/media/Star.png
58
- - examples/media/Starfighter.bmp
59
34
  - Gosu/Async.hpp
60
35
  - Gosu/Audio.hpp
61
36
  - Gosu/AutoLink.hpp
@@ -84,6 +59,31 @@ files:
84
59
  - Gosu/Version.hpp
85
60
  - Gosu/Window.hpp
86
61
  - Gosu/WinUtility.hpp
62
+ - lib/gosu.rb
63
+ - lib/gosu/patches.rb
64
+ - lib/gosu/swig_patches.rb
65
+ - examples/ChipmunkIntegration.rb
66
+ - examples/CptnRuby.rb
67
+ - examples/MoreChipmunkAndRMagick.rb
68
+ - examples/OpenGLIntegration.rb
69
+ - examples/RMagickIntegration.rb
70
+ - examples/TextInput.rb
71
+ - examples/Tutorial.rb
72
+ - examples/media/Beep.wav
73
+ - examples/media/CptnRuby Gem.png
74
+ - examples/media/CptnRuby Map.txt
75
+ - examples/media/CptnRuby Tileset.png
76
+ - examples/media/CptnRuby.png
77
+ - examples/media/Cursor.png
78
+ - examples/media/Earth.png
79
+ - examples/media/Explosion.wav
80
+ - examples/media/LargeStar.png
81
+ - examples/media/Sky.jpg
82
+ - examples/media/Smoke.png
83
+ - examples/media/Soldier.png
84
+ - examples/media/Space.png
85
+ - examples/media/Star.png
86
+ - examples/media/Starfighter.bmp
87
87
  - GosuImpl/Async.cpp
88
88
  - GosuImpl/Audio/ALChannelManagement.hpp
89
89
  - GosuImpl/Audio/AudioFile.hpp
@@ -157,6 +157,7 @@ files:
157
157
  - GosuImpl/TextInputMac.mm
158
158
  - GosuImpl/TextInputWin.cpp
159
159
  - GosuImpl/TextInputX.cpp
160
+ - GosuImpl/TimingApple.cpp
160
161
  - GosuImpl/TimingUnix.cpp
161
162
  - GosuImpl/TimingWin.cpp
162
163
  - GosuImpl/Utility.cpp
@@ -199,16 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
200
  - 0
200
201
  version: "0"
201
202
  requirements:
202
- - g++
203
- - pkg-config
204
- - libgl
205
- - X11 includes and libraries
206
- - pangoft2
207
- - SDL_mixer
208
- - |-
209
- (Packages for Debian/Ubuntu:
210
- g++ pkg-config ruby-dev xorg-dev libsdl-mixer1.2-dev libgl1-mesa-dev libpango1.0-dev
211
- )
203
+ - See http://code.google.com/p/gosu/wiki/GettingStartedOnLinux
212
204
  rubyforge_project:
213
205
  rubygems_version: 1.3.7
214
206
  signing_key: