gosu 0.10.9.pre1 → 0.11.0

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 (136) hide show
  1. checksums.yaml +4 -4
  2. data/Gosu/Audio.hpp +35 -66
  3. data/Gosu/AutoLink.hpp +14 -16
  4. data/Gosu/Bitmap.hpp +50 -37
  5. data/Gosu/Buttons.hpp +246 -265
  6. data/Gosu/Color.hpp +32 -76
  7. data/Gosu/Directories.hpp +14 -17
  8. data/Gosu/Font.hpp +28 -34
  9. data/Gosu/Fwd.hpp +27 -31
  10. data/Gosu/Gosu.hpp +2 -5
  11. data/Gosu/Graphics.hpp +31 -48
  12. data/Gosu/GraphicsBase.hpp +27 -58
  13. data/Gosu/IO.hpp +44 -56
  14. data/Gosu/Image.hpp +29 -73
  15. data/Gosu/ImageData.hpp +13 -17
  16. data/Gosu/Input.hpp +42 -57
  17. data/Gosu/Inspection.hpp +2 -6
  18. data/Gosu/Math.hpp +32 -38
  19. data/Gosu/Platform.hpp +10 -29
  20. data/Gosu/Text.hpp +30 -39
  21. data/Gosu/TextInput.hpp +29 -36
  22. data/Gosu/Timing.hpp +14 -16
  23. data/Gosu/Utility.hpp +10 -15
  24. data/Gosu/Version.hpp +13 -14
  25. data/Gosu/Window.hpp +53 -68
  26. data/README.md +23 -11
  27. data/ext/gosu/extconf.rb +31 -81
  28. data/lib/gosu/patches.rb +35 -19
  29. data/lib/gosu/run.rb +13 -4
  30. data/rdoc/gosu.rb +24 -20
  31. data/src/ALChannelManagement.hpp +119 -0
  32. data/src/{Audio/Audio.cpp → Audio.cpp} +177 -211
  33. data/src/AudioFile.hpp +57 -0
  34. data/src/AudioToolboxFile.hpp +214 -0
  35. data/src/Bitmap.cpp +159 -0
  36. data/src/BitmapIO.cpp +141 -0
  37. data/src/BlockAllocator.cpp +133 -0
  38. data/src/{Graphics/BlockAllocator.hpp → BlockAllocator.hpp} +34 -35
  39. data/src/ClipRectStack.hpp +87 -0
  40. data/src/{Graphics/Color.cpp → Color.cpp} +30 -28
  41. data/src/DirectoriesApple.cpp +68 -0
  42. data/src/DirectoriesUnix.cpp +20 -18
  43. data/src/DirectoriesWin.cpp +40 -41
  44. data/src/DrawOp.hpp +168 -0
  45. data/src/DrawOpQueue.hpp +190 -0
  46. data/src/FileUnix.cpp +40 -46
  47. data/src/FileWin.cpp +42 -38
  48. data/src/Font.cpp +165 -0
  49. data/src/{Text/FormattedString.hpp → FormattedString.hpp} +114 -114
  50. data/src/GosuAppDelegate.cpp +30 -0
  51. data/src/{UIKit/GosuAppDelegate.h → GosuAppDelegate.h} +0 -0
  52. data/src/{UIKit/GosuGLView.mm → GosuGLView.cpp} +22 -17
  53. data/src/{UIKit/GosuGLView.h → GosuGLView.h} +0 -0
  54. data/src/GosuViewController.cpp +231 -0
  55. data/src/{UIKit/GosuViewController.h → GosuViewController.h} +0 -0
  56. data/src/Graphics.cpp +464 -0
  57. data/src/{Graphics/Common.hpp → GraphicsImpl.hpp} +29 -32
  58. data/src/IO.cpp +17 -16
  59. data/src/Iconv.hpp +13 -22
  60. data/src/Image.cpp +142 -0
  61. data/src/Input.cpp +459 -0
  62. data/src/InputUIKit.cpp +197 -0
  63. data/src/Inspection.cpp +4 -5
  64. data/src/LargeImageData.cpp +151 -0
  65. data/src/LargeImageData.hpp +43 -0
  66. data/src/{Graphics/Macro.cpp → Macro.cpp} +77 -78
  67. data/src/Macro.hpp +30 -0
  68. data/src/Math.cpp +17 -29
  69. data/src/{Audio/OggFile.hpp → OggFile.hpp} +19 -24
  70. data/src/RenderState.hpp +205 -0
  71. data/src/Resolution.cpp +86 -0
  72. data/src/ResolutionApple.cpp +25 -0
  73. data/{ext/gosu/gosu_wrap.cxx → src/RubyGosu.cxx} +2256 -1707
  74. data/{ext/gosu/gosu_wrap.h → src/RubyGosu.h} +9 -9
  75. data/src/{Audio/SndFile.hpp → SndFile.hpp} +54 -43
  76. data/src/TexChunk.cpp +117 -0
  77. data/src/{Graphics/TexChunk.hpp → TexChunk.hpp} +13 -18
  78. data/src/Text.cpp +371 -0
  79. data/src/TextApple.cpp +209 -0
  80. data/src/TextInput.cpp +278 -0
  81. data/src/TextTTFWin.cpp +251 -0
  82. data/src/{Text/TextUnix.cpp → TextUnix.cpp} +96 -92
  83. data/src/TextWin.cpp +194 -0
  84. data/src/{Graphics/Texture.cpp → Texture.cpp} +35 -38
  85. data/src/{Graphics/Texture.hpp → Texture.hpp} +9 -13
  86. data/src/TimingApple.cpp +11 -7
  87. data/src/TimingUnix.cpp +13 -7
  88. data/src/TimingWin.cpp +6 -1
  89. data/src/{Graphics/Transform.cpp → Transform.cpp} +17 -12
  90. data/src/{Graphics/TransformStack.hpp → TransformStack.hpp} +24 -25
  91. data/src/Utility.cpp +29 -70
  92. data/src/UtilityApple.cpp +52 -0
  93. data/src/UtilityWin.cpp +7 -4
  94. data/src/Version.cpp +22 -0
  95. data/src/WinMain.cpp +30 -33
  96. data/src/WinUtility.cpp +24 -22
  97. data/src/WinUtility.hpp +11 -20
  98. data/src/Window.cpp +142 -112
  99. data/src/WindowUIKit.cpp +155 -0
  100. data/src/stb_image.h +384 -173
  101. data/src/stb_vorbis.c +20 -18
  102. metadata +60 -62
  103. data/Gosu/TR1.hpp +0 -56
  104. data/src/AppleUtility.hpp +0 -66
  105. data/src/Audio/ALChannelManagement.hpp +0 -114
  106. data/src/Audio/Audio.mm +0 -1
  107. data/src/Audio/AudioFile.hpp +0 -53
  108. data/src/Audio/AudioToolboxFile.hpp +0 -207
  109. data/src/Bitmap/Bitmap.cpp +0 -183
  110. data/src/Bitmap/BitmapIO.cpp +0 -176
  111. data/src/DirectoriesApple.mm +0 -71
  112. data/src/Graphics/BlockAllocator.cpp +0 -142
  113. data/src/Graphics/ClipRectStack.hpp +0 -93
  114. data/src/Graphics/DrawOp.hpp +0 -175
  115. data/src/Graphics/DrawOpQueue.hpp +0 -188
  116. data/src/Graphics/Graphics.cpp +0 -478
  117. data/src/Graphics/Image.cpp +0 -193
  118. data/src/Graphics/LargeImageData.cpp +0 -133
  119. data/src/Graphics/LargeImageData.hpp +0 -46
  120. data/src/Graphics/Macro.hpp +0 -36
  121. data/src/Graphics/RenderState.hpp +0 -211
  122. data/src/Graphics/Resolution.cpp +0 -91
  123. data/src/Graphics/ResolutionApple.mm +0 -19
  124. data/src/Graphics/TexChunk.cpp +0 -112
  125. data/src/Input/Input.cpp +0 -463
  126. data/src/Input/InputUIKit.mm +0 -190
  127. data/src/Input/TextInput.cpp +0 -261
  128. data/src/Text/Font.cpp +0 -175
  129. data/src/Text/Text.cpp +0 -391
  130. data/src/Text/TextApple.mm +0 -227
  131. data/src/Text/TextTTFWin.cpp +0 -249
  132. data/src/Text/TextWin.cpp +0 -186
  133. data/src/UIKit/GosuAppDelegate.mm +0 -24
  134. data/src/UIKit/GosuViewController.mm +0 -211
  135. data/src/UtilityApple.mm +0 -63
  136. data/src/WindowUIKit.mm +0 -139
@@ -1,139 +0,0 @@
1
- #include <Gosu/Gosu.hpp>
2
- #include "AppleUtility.hpp"
3
- #include "UIKit/GosuViewController.h"
4
-
5
- namespace Gosu
6
- {
7
- unsigned screenWidth()
8
- {
9
- static CGSize screenSize = [UIScreen mainScreen].bounds.size;
10
- static CGFloat width = MIN(screenSize.width, screenSize.height);
11
- return width;
12
- }
13
-
14
- unsigned screenHeight()
15
- {
16
- static CGSize screenSize = [UIScreen mainScreen].bounds.size;
17
- static CGFloat width = MAX(screenSize.width, screenSize.height);
18
- return width;
19
- }
20
-
21
- unsigned availableWidth()
22
- {
23
- return screenWidth();
24
- }
25
-
26
- unsigned availableHeight()
27
- {
28
- return screenHeight();
29
- }
30
- }
31
-
32
- class Gosu::Audio {};
33
-
34
- struct Gosu::Window::Impl
35
- {
36
- ::UIWindow *window;
37
- GosuViewController *controller;
38
- std::unique_ptr<Graphics> graphics;
39
- std::unique_ptr<Input> input;
40
- double interval;
41
- std::wstring caption;
42
- };
43
-
44
- Gosu::Window::Window(unsigned width, unsigned height,
45
- bool fullscreen, double updateInterval)
46
- : pimpl(new Impl)
47
- {
48
- pimpl->window = [[::UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
49
- pimpl->controller = [GosuViewController new];
50
- pimpl->controller.gosuWindow = this;
51
- pimpl->window.rootViewController = pimpl->controller;
52
-
53
- // It is important to load the view before creating the Graphics instance.
54
- [pimpl->controller loadView];
55
-
56
- pimpl->graphics.reset(new Graphics(screenHeight(), screenWidth(), false));
57
- pimpl->graphics->setResolution(width, height);
58
-
59
- pimpl->input.reset(new Input((__bridge void *)pimpl->controller.view, updateInterval));
60
- pimpl->input->setMouseFactors(1.0 * width / screenHeight(), 1.0 * height / screenWidth());
61
-
62
- using namespace std::tr1::placeholders;
63
- pimpl->input->onTouchBegan = std::tr1::bind(&Window::touchBegan, this, _1);
64
- pimpl->input->onTouchMoved = std::tr1::bind(&Window::touchMoved, this, _1);
65
- pimpl->input->onTouchEnded = std::tr1::bind(&Window::touchEnded, this, _1);
66
- pimpl->input->onTouchCancelled = std::tr1::bind(&Window::touchCancelled, this, _1);
67
-
68
- pimpl->interval = updateInterval;
69
- }
70
-
71
- Gosu::Window::~Window()
72
- {
73
- }
74
-
75
- std::wstring Gosu::Window::caption() const
76
- {
77
- return pimpl->caption;
78
- }
79
-
80
- void Gosu::Window::setCaption(const std::wstring& caption)
81
- {
82
- pimpl->caption = caption;
83
- }
84
-
85
- double Gosu::Window::updateInterval() const
86
- {
87
- return pimpl->interval;
88
- }
89
-
90
- const Gosu::Graphics& Gosu::Window::graphics() const
91
- {
92
- return *pimpl->graphics;
93
- }
94
-
95
- Gosu::Graphics& Gosu::Window::graphics()
96
- {
97
- return *pimpl->graphics;
98
- }
99
-
100
- const Gosu::Audio& Gosu::Window::audio() const
101
- {
102
- static Gosu::Audio audio;
103
- return audio;
104
- }
105
-
106
- Gosu::Audio& Gosu::Window::audio()
107
- {
108
- static Gosu::Audio audio;
109
- return audio;
110
- }
111
-
112
- const Gosu::Input& Gosu::Window::input() const
113
- {
114
- return *pimpl->input;
115
- }
116
-
117
- Gosu::Input& Gosu::Window::input()
118
- {
119
- return *pimpl->input;
120
- }
121
-
122
- void Gosu::Window::show()
123
- {
124
- }
125
-
126
- bool Gosu::Window::tick()
127
- {
128
- return true;
129
- }
130
-
131
- void Gosu::Window::close()
132
- {
133
- throw std::logic_error("Cannot close windows manually on iOS");
134
- }
135
-
136
- void *Gosu::Window::UIWindow() const
137
- {
138
- return (__bridge void *)pimpl->window;
139
- }