gosu 0.8.6-x86-mingw32 → 0.8.7-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gosu/Audio.hpp +171 -171
  3. data/Gosu/Bitmap.hpp +96 -96
  4. data/Gosu/Color.hpp +204 -204
  5. data/Gosu/Directories.hpp +36 -36
  6. data/Gosu/Font.hpp +83 -83
  7. data/Gosu/Gosu.hpp +34 -34
  8. data/Gosu/Graphics.hpp +115 -115
  9. data/Gosu/GraphicsBase.hpp +110 -110
  10. data/Gosu/IO.hpp +269 -269
  11. data/Gosu/Image.hpp +122 -122
  12. data/Gosu/ImageData.hpp +61 -61
  13. data/Gosu/Input.hpp +149 -149
  14. data/Gosu/Inspection.hpp +14 -14
  15. data/Gosu/Math.hpp +135 -135
  16. data/Gosu/Platform.hpp +93 -93
  17. data/Gosu/Sockets.hpp +156 -156
  18. data/Gosu/TR1.hpp +56 -56
  19. data/Gosu/Text.hpp +71 -71
  20. data/Gosu/TextInput.hpp +70 -70
  21. data/Gosu/Utility.hpp +28 -28
  22. data/Gosu/Version.hpp +19 -19
  23. data/Gosu/Window.hpp +145 -145
  24. data/examples/ChipmunkIntegration.rb +275 -275
  25. data/examples/CptnRuby.rb +223 -223
  26. data/examples/GosuZen.rb +68 -68
  27. data/examples/MoreChipmunkAndRMagick.rb +155 -155
  28. data/examples/OpenGLIntegration.rb +225 -225
  29. data/examples/RMagickIntegration.rb +417 -417
  30. data/examples/TextInput.rb +154 -154
  31. data/examples/Tutorial.rb +130 -130
  32. data/examples/media/Beep.wav +0 -0
  33. data/examples/media/CptnRuby Map.txt b/data/examples/media/CptnRuby → Map.txt +0 -0
  34. data/examples/media/Explosion.wav +0 -0
  35. data/examples/media/Landscape.svg +9 -9
  36. data/examples/media/Space.png +0 -0
  37. data/examples/media/Star.png +0 -0
  38. data/examples/media/Starfighter.bmp +0 -0
  39. data/lib/1.8/gosu.so +0 -0
  40. data/lib/1.9/gosu.so +0 -0
  41. data/lib/2.0/gosu.so +0 -0
  42. data/lib/2.1/gosu.so +0 -0
  43. data/lib/FreeImage.dll +0 -0
  44. data/lib/OpenAL32.dll +0 -0
  45. data/lib/gosu.rb +19 -16
  46. data/lib/gosu/patches.rb +81 -81
  47. data/lib/gosu/preview.rb +143 -139
  48. data/lib/gosu/run.rb +11 -11
  49. data/lib/gosu/swig_patches.rb +60 -60
  50. data/lib/gosu/zen.rb +89 -89
  51. metadata +5 -5
@@ -1,14 +1,14 @@
1
- //! \file Inspection.hpp
2
- //! A special set of functions designed for tuning Gosu games.
3
-
4
- #ifndef GOSU_INSPECTION_HPP
5
- #define GOSU_INSPECTION_HPP
6
-
7
- namespace Gosu
8
- {
9
- //! Returns the current framerate, as determined by an unspecified and possibly
10
- //! horrible algorithm.
11
- int fps();
12
- }
13
-
14
- #endif
1
+ //! \file Inspection.hpp
2
+ //! A special set of functions designed for tuning Gosu games.
3
+
4
+ #ifndef GOSU_INSPECTION_HPP
5
+ #define GOSU_INSPECTION_HPP
6
+
7
+ namespace Gosu
8
+ {
9
+ //! Returns the current framerate, as determined by an unspecified and possibly
10
+ //! horrible algorithm.
11
+ int fps();
12
+ }
13
+
14
+ #endif
@@ -1,135 +1,135 @@
1
- //! \file Math.hpp
2
- //! Contains simple math functionality.
3
-
4
- #ifndef GOSU_MATH_HPP
5
- #define GOSU_MATH_HPP
6
-
7
- namespace Gosu
8
- {
9
- //! Pi.
10
- const double pi = 3.1415926536;
11
-
12
- //! Truncates the fractional part of a real value. Equivalent to
13
- //! static_cast<long>.
14
- inline long trunc(double value)
15
- {
16
- return static_cast<long>(value);
17
- }
18
-
19
- //! Rounds a real value towards the next integer.
20
- inline long round(double value)
21
- {
22
- if (value >= 0)
23
- return static_cast<long>(value + 0.5);
24
- else
25
- return static_cast<long>(value - 0.5);
26
- }
27
-
28
- //! Returns a real value between min (inclusive) and max (exclusive).
29
- //! Uses std::rand, so you should call std::srand before using it.
30
- double random(double min, double max);
31
-
32
- //! Translates between Gosu's angle system (where 0� is at the top)
33
- //! and radians (where 0 is at the right).
34
- inline double gosuToRadians(double angle)
35
- {
36
- return (angle - 90) * pi / 180;
37
- }
38
- //! Translates between Gosu's angle system (where 0� is at the top)
39
- //! and radians (where 0 is at the right).
40
- inline double radiansToGosu(double angle)
41
- {
42
- return angle * 180 / pi + 90;
43
- }
44
-
45
- //! Translates between degrees (used by Gosu) and radians, i.e. it
46
- //! does not change the 'origin' of the angle system.
47
- inline double degreesToRadians(double angle)
48
- {
49
- return angle * pi / 180;
50
- }
51
- //! Translates between degrees (used by Gosu) and radians, i.e. it
52
- //! does not change the 'origin' of the angle system.
53
- inline double radiansToDegrees(double angle)
54
- {
55
- return angle * 180 / pi;
56
- }
57
-
58
- //! Returns the horizontal distance between the origin and the point to
59
- //! which you would get if you moved radius pixels in the direction
60
- //! specified by angle.
61
- //! \param angle Angle in degrees where 0.0 means upwards.
62
- double offsetX(double angle, double radius);
63
- //! Returns the vertical distance between the origin and the point to
64
- //! which you would get if you moved radius pixels in the direction
65
- //! specified by angle.
66
- //! \param angle Angle in degrees where 0.0 means upwards.
67
- double offsetY(double angle, double radius);
68
- //! Returns the angle from point 1 to point 2 in degrees, where 0.0 means
69
- //! upwards. Returns def if both points are equal.
70
- double angle(double fromX, double fromY, double toX, double toY,
71
- double def = 0);
72
- //! Returns the smallest angle that can be added to angle1 to get to
73
- //! angle2 (can be negative if counter-clockwise movement is shorter).
74
- double angleDiff(double angle1, double angle2);
75
- //! Normalizes an angle to fit into the range [0; 360[.
76
- double normalizeAngle(double angle);
77
-
78
- //! Returns value * value.
79
- template<typename T>
80
- T square(T value)
81
- {
82
- return value * value;
83
- }
84
-
85
- //! Returns min if value is smaller than min, max if value is larger than
86
- //! max and value otherwise.
87
- template<typename T>
88
- T clamp(T value, T min, T max)
89
- {
90
- if (value < min)
91
- return min;
92
- if (value > max)
93
- return max;
94
- return value;
95
- }
96
-
97
- // Backward compatibility with 0.7.x
98
- template<typename T>
99
- T boundBy(T value, T min, T max)
100
- {
101
- return clamp(value, min, max);
102
- }
103
-
104
- //! Returns (value-min) % (max-min) + min, where % always has a positive
105
- //! result for max > min. The results are undefined for max <= min.
106
- //! Note: This means that max is exclusive.
107
- int wrap(int value, int min, int max);
108
- //! Returns (value-min) % (max-min) + min, where % always has a positive
109
- //! result for max > min. The results are undefined for max <= min.
110
- //! Note: This means that max is exclusive.
111
- float wrap(float value, float min, float max);
112
- //! Returns (value-min) % (max-min) + min, where % always has a positive
113
- //! result for max > min. The results are undefined for max <= min.
114
- //! Note: This means that max is exclusive.
115
- double wrap(double value, double min, double max);
116
-
117
- //! Returns the square of the distance between two points.
118
- inline double distanceSqr(double x1, double y1, double x2, double y2)
119
- {
120
- return square(x1 - x2) + square(y1 - y2);
121
- }
122
-
123
- //! Returns the distance between two points.
124
- double distance(double x1, double y1, double x2, double y2);
125
-
126
- //! Interpolates a value between a and b, weight being the bias towards the second value.
127
- //! Examples: interpolate(0, 10, 0.5) == 5, interpolate(-10, 10, 0.25) == 5, interpolate(0, 10, -0.5) == -5.
128
- template<typename T>
129
- T interpolate(T a, T b, double weight = 0.5)
130
- {
131
- return a * (1.0 - weight) + b * weight;
132
- }
133
- }
134
-
135
- #endif
1
+ //! \file Math.hpp
2
+ //! Contains simple math functionality.
3
+
4
+ #ifndef GOSU_MATH_HPP
5
+ #define GOSU_MATH_HPP
6
+
7
+ namespace Gosu
8
+ {
9
+ //! Pi.
10
+ const double pi = 3.1415926536;
11
+
12
+ //! Truncates the fractional part of a real value. Equivalent to
13
+ //! static_cast<long>.
14
+ inline long trunc(double value)
15
+ {
16
+ return static_cast<long>(value);
17
+ }
18
+
19
+ //! Rounds a real value towards the next integer.
20
+ inline long round(double value)
21
+ {
22
+ if (value >= 0)
23
+ return static_cast<long>(value + 0.5);
24
+ else
25
+ return static_cast<long>(value - 0.5);
26
+ }
27
+
28
+ //! Returns a real value between min (inclusive) and max (exclusive).
29
+ //! Uses std::rand, so you should call std::srand before using it.
30
+ double random(double min, double max);
31
+
32
+ //! Translates between Gosu's angle system (where 0� is at the top)
33
+ //! and radians (where 0 is at the right).
34
+ inline double gosuToRadians(double angle)
35
+ {
36
+ return (angle - 90) * pi / 180;
37
+ }
38
+ //! Translates between Gosu's angle system (where 0� is at the top)
39
+ //! and radians (where 0 is at the right).
40
+ inline double radiansToGosu(double angle)
41
+ {
42
+ return angle * 180 / pi + 90;
43
+ }
44
+
45
+ //! Translates between degrees (used by Gosu) and radians, i.e. it
46
+ //! does not change the 'origin' of the angle system.
47
+ inline double degreesToRadians(double angle)
48
+ {
49
+ return angle * pi / 180;
50
+ }
51
+ //! Translates between degrees (used by Gosu) and radians, i.e. it
52
+ //! does not change the 'origin' of the angle system.
53
+ inline double radiansToDegrees(double angle)
54
+ {
55
+ return angle * 180 / pi;
56
+ }
57
+
58
+ //! Returns the horizontal distance between the origin and the point to
59
+ //! which you would get if you moved radius pixels in the direction
60
+ //! specified by angle.
61
+ //! \param angle Angle in degrees where 0.0 means upwards.
62
+ double offsetX(double angle, double radius);
63
+ //! Returns the vertical distance between the origin and the point to
64
+ //! which you would get if you moved radius pixels in the direction
65
+ //! specified by angle.
66
+ //! \param angle Angle in degrees where 0.0 means upwards.
67
+ double offsetY(double angle, double radius);
68
+ //! Returns the angle from point 1 to point 2 in degrees, where 0.0 means
69
+ //! upwards. Returns def if both points are equal.
70
+ double angle(double fromX, double fromY, double toX, double toY,
71
+ double def = 0);
72
+ //! Returns the smallest angle that can be added to angle1 to get to
73
+ //! angle2 (can be negative if counter-clockwise movement is shorter).
74
+ double angleDiff(double angle1, double angle2);
75
+ //! Normalizes an angle to fit into the range [0; 360[.
76
+ double normalizeAngle(double angle);
77
+
78
+ //! Returns value * value.
79
+ template<typename T>
80
+ T square(T value)
81
+ {
82
+ return value * value;
83
+ }
84
+
85
+ //! Returns min if value is smaller than min, max if value is larger than
86
+ //! max and value otherwise.
87
+ template<typename T>
88
+ T clamp(T value, T min, T max)
89
+ {
90
+ if (value < min)
91
+ return min;
92
+ if (value > max)
93
+ return max;
94
+ return value;
95
+ }
96
+
97
+ // Backward compatibility with 0.7.x
98
+ template<typename T>
99
+ T boundBy(T value, T min, T max)
100
+ {
101
+ return clamp(value, min, max);
102
+ }
103
+
104
+ //! Returns (value-min) % (max-min) + min, where % always has a positive
105
+ //! result for max > min. The results are undefined for max <= min.
106
+ //! Note: This means that max is exclusive.
107
+ int wrap(int value, int min, int max);
108
+ //! Returns (value-min) % (max-min) + min, where % always has a positive
109
+ //! result for max > min. The results are undefined for max <= min.
110
+ //! Note: This means that max is exclusive.
111
+ float wrap(float value, float min, float max);
112
+ //! Returns (value-min) % (max-min) + min, where % always has a positive
113
+ //! result for max > min. The results are undefined for max <= min.
114
+ //! Note: This means that max is exclusive.
115
+ double wrap(double value, double min, double max);
116
+
117
+ //! Returns the square of the distance between two points.
118
+ inline double distanceSqr(double x1, double y1, double x2, double y2)
119
+ {
120
+ return square(x1 - x2) + square(y1 - y2);
121
+ }
122
+
123
+ //! Returns the distance between two points.
124
+ double distance(double x1, double y1, double x2, double y2);
125
+
126
+ //! Interpolates a value between a and b, weight being the bias towards the second value.
127
+ //! Examples: interpolate(0, 10, 0.5) == 5, interpolate(-10, 10, 0.25) == 5, interpolate(0, 10, -0.5) == -5.
128
+ template<typename T>
129
+ T interpolate(T a, T b, double weight = 0.5)
130
+ {
131
+ return a * (1.0 - weight) + b * weight;
132
+ }
133
+ }
134
+
135
+ #endif
@@ -1,93 +1,93 @@
1
- //! \file Platform.hpp
2
- //! Macros and utility functions to facilitate programming on all of Gosu's supported platforms.
3
-
4
- #ifndef GOSU_PLATFORM_HPP
5
- #define GOSU_PLATFORM_HPP
6
-
7
- #ifdef __BIG_ENDIAN__
8
- # define GOSU_IS_BIG_ENDIAN
9
- # define IDENTITY_FUN bigToNative
10
- # define IDENTITY_FUN2 nativeToBig
11
- # define CONV_FUN littleToNative
12
- # define CONV_FUN2 nativeToLittle
13
- #else
14
- # define GOSU_IS_LITTLE_ENDIAN
15
- # define IDENTITY_FUN littleToNative
16
- # define IDENTITY_FUN2 nativeToLittle
17
- # define CONV_FUN bigToNative
18
- # define CONV_FUN2 nativeToBig
19
- #endif
20
-
21
- #include <algorithm>
22
-
23
- namespace Gosu
24
- {
25
- template<typename T> T IDENTITY_FUN(T t) { return t; }
26
- template<typename T> T IDENTITY_FUN2(T t) { return t; }
27
-
28
- template<typename T>
29
- T CONV_FUN(T t)
30
- {
31
- char* begin = reinterpret_cast<char*>(&t);
32
- std::reverse(begin, begin + sizeof t);
33
- return t;
34
- }
35
-
36
- template<typename T> T CONV_FUN2(T t) { return CONV_FUN(t); }
37
- }
38
-
39
- #undef IDENTITY_FUN
40
- #undef IDENTITY_FUN2
41
- #undef CONV_FUN
42
- #undef CONV_FUN2
43
-
44
- #if defined(_MSC_VER)
45
- # define GOSU_NORETURN __declspec(noreturn)
46
- #elif defined(__GNUC__)
47
- # define GOSU_NORETURN __attribute__ ((noreturn))
48
- #endif
49
-
50
- #if defined(WIN32)
51
- # define GOSU_IS_WIN
52
- #else
53
- # define GOSU_IS_UNIX
54
- # if defined(__linux) || defined(__FreeBSD__)
55
- # define GOSU_IS_X
56
- # else
57
- # define GOSU_IS_MAC
58
- # include <TargetConditionals.h>
59
- # if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
60
- # define GOSU_IS_IPHONE
61
- # endif
62
- # endif
63
- #endif
64
-
65
- #if defined (GOSU_IS_IPHONE) || defined(__arm__)
66
- # define GOSU_IS_OPENGLES
67
- #endif
68
-
69
- #ifndef SWIG
70
- # if _MSC_VER >= 1700 || ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__GXX_EXPERIMENTAL_CXX0X__))
71
- # define GOSU_CPP11_ENABLED
72
- # endif
73
- #endif
74
-
75
- #ifdef GOSU_CPP11_ENABLED
76
- # define GOSU_UNIQUE_PTR std::unique_ptr
77
- # define GOSU_MOVE_UNIQUE_PTR(ptr) std::move(ptr)
78
- #else
79
- # define GOSU_UNIQUE_PTR std::auto_ptr
80
- # define GOSU_MOVE_UNIQUE_PTR(ptr) (ptr)
81
- #endif
82
-
83
- #ifndef GOSU_DEPRECATED
84
- # if defined(GOSU_IS_WIN)
85
- # define GOSU_DEPRECATED __declspec(deprecated)
86
- # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
87
- # define GOSU_DEPRECATED __attribute__((__deprecated__))
88
- # else
89
- # define GOSU_DEPRECATED
90
- # endif
91
- #endif
92
-
93
- #endif
1
+ //! \file Platform.hpp
2
+ //! Macros and utility functions to facilitate programming on all of Gosu's supported platforms.
3
+
4
+ #ifndef GOSU_PLATFORM_HPP
5
+ #define GOSU_PLATFORM_HPP
6
+
7
+ #ifdef __BIG_ENDIAN__
8
+ # define GOSU_IS_BIG_ENDIAN
9
+ # define IDENTITY_FUN bigToNative
10
+ # define IDENTITY_FUN2 nativeToBig
11
+ # define CONV_FUN littleToNative
12
+ # define CONV_FUN2 nativeToLittle
13
+ #else
14
+ # define GOSU_IS_LITTLE_ENDIAN
15
+ # define IDENTITY_FUN littleToNative
16
+ # define IDENTITY_FUN2 nativeToLittle
17
+ # define CONV_FUN bigToNative
18
+ # define CONV_FUN2 nativeToBig
19
+ #endif
20
+
21
+ #include <algorithm>
22
+
23
+ namespace Gosu
24
+ {
25
+ template<typename T> T IDENTITY_FUN(T t) { return t; }
26
+ template<typename T> T IDENTITY_FUN2(T t) { return t; }
27
+
28
+ template<typename T>
29
+ T CONV_FUN(T t)
30
+ {
31
+ char* begin = reinterpret_cast<char*>(&t);
32
+ std::reverse(begin, begin + sizeof t);
33
+ return t;
34
+ }
35
+
36
+ template<typename T> T CONV_FUN2(T t) { return CONV_FUN(t); }
37
+ }
38
+
39
+ #undef IDENTITY_FUN
40
+ #undef IDENTITY_FUN2
41
+ #undef CONV_FUN
42
+ #undef CONV_FUN2
43
+
44
+ #if defined(_MSC_VER)
45
+ # define GOSU_NORETURN __declspec(noreturn)
46
+ #elif defined(__GNUC__)
47
+ # define GOSU_NORETURN __attribute__ ((noreturn))
48
+ #endif
49
+
50
+ #if defined(WIN32)
51
+ # define GOSU_IS_WIN
52
+ #else
53
+ # define GOSU_IS_UNIX
54
+ # if defined(__linux) || defined(__FreeBSD__)
55
+ # define GOSU_IS_X
56
+ # else
57
+ # define GOSU_IS_MAC
58
+ # include <TargetConditionals.h>
59
+ # if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
60
+ # define GOSU_IS_IPHONE
61
+ # endif
62
+ # endif
63
+ #endif
64
+
65
+ #if defined (GOSU_IS_IPHONE) || defined(__arm__)
66
+ # define GOSU_IS_OPENGLES
67
+ #endif
68
+
69
+ #ifndef SWIG
70
+ # if _MSC_VER >= 1700 || ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__GXX_EXPERIMENTAL_CXX0X__))
71
+ # define GOSU_CPP11_ENABLED
72
+ # endif
73
+ #endif
74
+
75
+ #ifdef GOSU_CPP11_ENABLED
76
+ # define GOSU_UNIQUE_PTR std::unique_ptr
77
+ # define GOSU_MOVE_UNIQUE_PTR(ptr) std::move(ptr)
78
+ #else
79
+ # define GOSU_UNIQUE_PTR std::auto_ptr
80
+ # define GOSU_MOVE_UNIQUE_PTR(ptr) (ptr)
81
+ #endif
82
+
83
+ #ifndef GOSU_DEPRECATED
84
+ # if defined(GOSU_IS_WIN)
85
+ # define GOSU_DEPRECATED __declspec(deprecated)
86
+ # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
87
+ # define GOSU_DEPRECATED __attribute__((__deprecated__))
88
+ # else
89
+ # define GOSU_DEPRECATED
90
+ # endif
91
+ #endif
92
+
93
+ #endif