gosu 0.7.35-universal-darwin → 0.7.36.1-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.
data/Gosu/Image.hpp CHANGED
@@ -19,16 +19,16 @@ namespace Gosu
19
19
  public:
20
20
  //! Loads an image from a given filename that can be drawn onto
21
21
  //! graphics.
22
- //! This constructor can handle PNG and BMP images. A color key of #ff00ff is
23
- //! automatically applied to BMP type images. For more flexibility, use the
24
- //! corresponding constructor that uses a Bitmap object.
22
+ //! This constructor can handle PNG and BMP images. A color key of #ff00ff is
23
+ //! automatically applied to BMP type images. For more flexibility, use the
24
+ //! corresponding constructor that uses a Bitmap object.
25
25
  Image(Graphics& graphics, const std::wstring& filename,
26
26
  bool tileable = false);
27
27
  //! Loads a portion of the the image at the given filename that can be
28
28
  //! drawn onto graphics.
29
- //! This constructor can handle PNG and BMP images. A color key of #ff00ff is
30
- //! automatically applied to BMP type images. For more flexibility, use the
31
- //! corresponding constructor that uses a Bitmap object.
29
+ //! This constructor can handle PNG and BMP images. A color key of #ff00ff is
30
+ //! automatically applied to BMP type images. For more flexibility, use the
31
+ //! corresponding constructor that uses a Bitmap object.
32
32
  Image(Graphics& graphics, const std::wstring& filename, unsigned srcX,
33
33
  unsigned srcY, unsigned srcWidth, unsigned srcHeight,
34
34
  bool tileable = false);
@@ -80,8 +80,8 @@ namespace Gosu
80
80
  ImageData& getData() const;
81
81
  };
82
82
 
83
- //! Convenience function that splits a BMP or PNG file into an array
84
- //! of small rectangles and creates images from them.
83
+ //! Convenience function that splits a BMP or PNG file into an array
84
+ //! of small rectangles and creates images from them.
85
85
  //! \param tileWidth If positive, specifies the width of one tile in
86
86
  //! pixels. If negative, the bitmap is divided into -tileWidth rows.
87
87
  //! \param tileHeight See tileWidth.
data/Gosu/Input.hpp CHANGED
@@ -33,42 +33,42 @@
33
33
 
34
34
  namespace Gosu
35
35
  {
36
- //! Very lightweight class that identifies a button (keyboard, mouse or other device).
37
- class Button
38
- {
39
- unsigned id_;
40
-
41
- public:
42
- //! For internal use.
43
- explicit Button(unsigned id) : id_(id) {}
44
- //! For internal use.
45
- unsigned id() const { return id_; }
36
+ //! Very lightweight class that identifies a button (keyboard, mouse or other device).
37
+ class Button
38
+ {
39
+ unsigned id_;
40
+
41
+ public:
42
+ //! For internal use.
43
+ explicit Button(unsigned id) : id_(id) {}
44
+ //! For internal use.
45
+ unsigned id() const { return id_; }
46
46
 
47
- //! Default constructor; == noButton.
48
- Button() : id_(noButton) {}
47
+ //! Default constructor; == noButton.
48
+ Button() : id_(noButton) {}
49
49
 
50
- //! Conversion from ButtonName constants.
51
- Button(ButtonName name) : id_(name) {}
52
- };
50
+ //! Conversion from ButtonName constants.
51
+ Button(ButtonName name) : id_(name) {}
52
+ };
53
53
 
54
- //! Tests whether two Buttons identify the same physical button.
55
- inline bool operator==(Button lhs, Button rhs)
56
- {
57
- return lhs.id() == rhs.id();
58
- }
59
- inline bool operator!=(Button lhs, Button rhs)
60
- {
61
- return !(lhs == rhs);
62
- }
54
+ //! Tests whether two Buttons identify the same physical button.
55
+ inline bool operator==(Button lhs, Button rhs)
56
+ {
57
+ return lhs.id() == rhs.id();
58
+ }
59
+ inline bool operator!=(Button lhs, Button rhs)
60
+ {
61
+ return !(lhs == rhs);
62
+ }
63
63
  inline bool operator<(Button lhs, Button rhs)
64
64
  {
65
65
  return lhs.id() < rhs.id();
66
66
  }
67
-
67
+
68
68
  //! Struct that saves information about a touch on the surface of a multi-
69
69
  //! touch device.
70
- //! Available even on non-iPhone platforms to make it easier to compile the
71
- //! same source for multiple platforms.
70
+ //! Available even on non-iPhone platforms to make it easier to compile the
71
+ //! same source for multiple platforms.
72
72
  struct Touch
73
73
  {
74
74
  //! Allows for identification of a touch across calls.
@@ -79,13 +79,13 @@ namespace Gosu
79
79
  typedef std::vector<Touch> Touches;
80
80
 
81
81
  //! Manages initialization and shutdown of the input system. Only one Input
82
- //! instance can exist per application.
82
+ //! instance can exist per application.
83
83
  class Input
84
84
  {
85
85
  struct Impl;
86
86
  const std::auto_ptr<Impl> pimpl;
87
87
 
88
- public:
88
+ public:
89
89
  #ifdef GOSU_IS_WIN
90
90
  Input(HWND window);
91
91
  #endif
@@ -113,9 +113,9 @@ namespace Gosu
113
113
  //! given character, or noButton.
114
114
  static Button charToId(wchar_t ch);
115
115
 
116
- //! Returns true if a button is currently pressed.
116
+ //! Returns true if a button is currently pressed.
117
117
  //! Updated every tick.
118
- bool down(Button btn) const;
118
+ bool down(Button btn) const;
119
119
 
120
120
  //! Returns the horizontal position of the mouse relative to the top
121
121
  //! left corner of the window given to Input's constructor.
@@ -143,12 +143,12 @@ namespace Gosu
143
143
  //! mouse is and calls onButtonUp/onButtonDown, if assigned.
144
144
  void update();
145
145
 
146
- //! Assignable events that are called by update. You can bind these to your own functions.
147
- //! If you use the Window class, it will assign forward these to its own methods.
146
+ //! Assignable events that are called by update. You can bind these to your own functions.
147
+ //! If you use the Window class, it will assign forward these to its own methods.
148
148
  std::tr1::function<void (Button)> onButtonDown, onButtonUp;
149
149
 
150
- //! Assignable events that are called by update. You can bind these to your own functions.
151
- //! If you use the Window class, it will assign forward these to its own methods.
150
+ //! Assignable events that are called by update. You can bind these to your own functions.
151
+ //! If you use the Window class, it will assign forward these to its own methods.
152
152
  std::tr1::function<void (Touch)> onTouchBegan, onTouchMoved, onTouchEnded;
153
153
 
154
154
  //! Returns the currently active TextInput instance, or 0.
data/Gosu/Version.hpp CHANGED
@@ -3,8 +3,8 @@
3
3
 
4
4
  #define GOSU_MAJOR_VERSION 0
5
5
  #define GOSU_MINOR_VERSION 7
6
- #define GOSU_POINT_VERSION 35
7
- #define GOSU_VERSION "0.7.35"
6
+ #define GOSU_POINT_VERSION 36
7
+ #define GOSU_VERSION "0.7.36.1"
8
8
 
9
9
  #define GOSU_COPYRIGHT_NOTICE \
10
10
  "May contain `ogg', `vorbis' libraries (c) 2002-2008 Xiph.org Foundation" \
data/Gosu/Window.hpp CHANGED
@@ -21,7 +21,7 @@
21
21
  namespace Gosu
22
22
  {
23
23
  //! Convenient all-in-one class that serves as the foundation of a standard
24
- //! Gosu application. Manages initialization of all of Gosu's core components
24
+ //! Gosu application. Manages initialization of all of Gosu's core components
25
25
  //! and provides timing functionality.
26
26
  //! Note that you should really only use one instance of this class at the same time.
27
27
  //! This may or may not change later.
@@ -43,7 +43,8 @@ namespace Gosu
43
43
 
44
44
  double updateInterval() const;
45
45
 
46
- //! Enters a modal loop where the Window is visible on screen and receives calls to draw, update etc.
46
+ //! Enters a modal loop where the Window is visible on screen and
47
+ //! receives calls to draw, update etc.
47
48
  void show();
48
49
  //! Closes the window if it is currently shown.
49
50
  void close();
@@ -61,9 +62,9 @@ namespace Gosu
61
62
  //! By default, the window is redrawn all the time.
62
63
  virtual bool needsRedraw() const { return true; }
63
64
 
64
- //! If this function returns true, the system arrow cursor is drawn while
65
- //! over the window.
66
- virtual bool needsCursor() const { return false; }
65
+ //! If this function returns true, the system arrow cursor is drawn while
66
+ //! over the window.
67
+ virtual bool needsCursor() const { return false; }
67
68
 
68
69
  //! This function is called when the window loses focus on some platforms.
69
70
  //! Most importantly, it is called on the iPhone or iPad when the user
@@ -0,0 +1,116 @@
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
+ initialize07 $window, source, !!tileable
46
+ end
47
+ end
48
+
49
+ class <<self
50
+ alias load_tiles07 load_tiles
51
+ end
52
+
53
+ def self.load_tiles *args
54
+ if args.first.is_a? Gosu::Window then
55
+ load_tiles07 *args
56
+ else
57
+ source = args[0]
58
+ x, y = args[1..2]
59
+ tileable = !args[3] || args[3][:tileable]
60
+ load_tiles07 $window, source, x, y, !!tileable
61
+ end
62
+ end
63
+
64
+ def self.from_text *args
65
+ if args.first.is_a? Gosu::Window then
66
+ args.size == 4 ? from_text4(*args) : from_text7(*args)
67
+ else
68
+ text = args[0]
69
+ height = args[1]
70
+ options = args[2] || {}
71
+ font = options[:font] || Gosu::default_font_name
72
+ if width = options[:width] then
73
+ spacing = options[:spacing] || 0
74
+ align = options[:align] || :left
75
+ Gosu::Image.from_text7 $window, text, font, height, spacing, width, align
76
+ else
77
+ Gosu::Image.from_text4 $window, text, font, height
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ def self.draw_quad *args
84
+ $window.draw_quad *args
85
+ end
86
+
87
+ def self.clip_to *args
88
+ $window.clip_to *args do
89
+ yield
90
+ end
91
+ end
92
+
93
+ def self.translate *args
94
+ $window.translate *args do
95
+ yield
96
+ end
97
+ end
98
+
99
+ def self.scale *args
100
+ $window.scale *args do
101
+ yield
102
+ end
103
+ end
104
+
105
+ def self.rotate *args
106
+ $window.rotate *args do
107
+ yield
108
+ end
109
+ end
110
+
111
+ def self.transform *args
112
+ $window.transform *args do
113
+ yield
114
+ end
115
+ end
116
+ end
data/lib/gosu/run.rb ADDED
@@ -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'
data/lib/gosu/zen.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'gosu'
2
+ require 'singleton'
3
+
4
+ module Gosu
5
+ class ZenWindow < Window
6
+ include Singleton
7
+
8
+ def initialize
9
+ super 800, 600, false
10
+ end
11
+ end
12
+ end
13
+
14
+ def set what, value
15
+ Gosu::ZenWindow.instance.send "#{what}=", value
16
+ end
17
+
18
+ def update(&proc)
19
+ Gosu::ZenWindow.send :define_method, :update, proc
20
+ end
21
+
22
+ # WIP - needs all other callbacks, even with arguments
23
+
24
+ # WIP - needs to be compatible with gosu/preview.rb later
25
+
26
+ at_exit do
27
+ Gosu::ZenWindow.instance.show
28
+ end
Binary file
Binary file
metadata CHANGED
@@ -1,25 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 69
4
+ hash: 229
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 35
10
- version: 0.7.35
9
+ - 36
10
+ - 1
11
+ version: 0.7.36.1
11
12
  platform: universal-darwin
12
13
  authors:
13
14
  - Julian Raschke
14
- - Jan Luecker
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-08-12 00:00:00 Z
19
+ date: 2011-08-24 00:00:00 Z
20
20
  dependencies: []
21
21
 
22
- description: " 2D game development library.\n\n Gosu features easy to use and game-friendly interfaces to 2D graphics\n and text (accelerated by 3D hardware), sound samples and music as well as\n keyboard, mouse and gamepad/joystick input.\n\n Also includes demos for integration with RMagick, Chipmunk and Ruby-OpenGL.\n"
22
+ description: " 2D game development library.\n\n Gosu features easy to use and game-friendly interfaces to 2D graphics\n and text (accelerated by 3D hardware), sound samples and music as well as\n keyboard, mouse and gamepad/joystick input.\n\n Also includes demos for integration with RMagick, Chipmunk and OpenGL.\n"
23
23
  email: julian@raschke.de
24
24
  executables: []
25
25
 
@@ -60,9 +60,12 @@ files:
60
60
  - Gosu/Version.hpp
61
61
  - Gosu/Window.hpp
62
62
  - Gosu/WinUtility.hpp
63
- - lib/gosu.rb
64
63
  - lib/gosu/patches.rb
64
+ - lib/gosu/preview.rb
65
+ - lib/gosu/run.rb
65
66
  - lib/gosu/swig_patches.rb
67
+ - lib/gosu/zen.rb
68
+ - lib/gosu.rb
66
69
  - examples/ChipmunkIntegration.rb
67
70
  - examples/CptnRuby.rb
68
71
  - examples/MoreChipmunkAndRMagick.rb
@@ -118,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
121
  requirements: []
119
122
 
120
123
  rubyforge_project:
121
- rubygems_version: 1.8.7
124
+ rubygems_version: 1.8.9
122
125
  signing_key:
123
126
  specification_version: 3
124
127
  summary: 2D game development library.