gosu 0.7.48 → 0.7.49

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 +7 -7
  2. data/.yardopts +1 -1
  3. data/Gosu/Audio.hpp +11 -3
  4. data/Gosu/Buttons.hpp +1 -1
  5. data/Gosu/Color.hpp +11 -11
  6. data/Gosu/Graphics.hpp +11 -3
  7. data/Gosu/GraphicsBase.hpp +21 -0
  8. data/Gosu/IO.hpp +12 -2
  9. data/Gosu/Image.hpp +1 -1
  10. data/Gosu/ImageData.hpp +2 -1
  11. data/Gosu/Input.hpp +8 -1
  12. data/Gosu/Platform.hpp +21 -5
  13. data/Gosu/Sockets.hpp +22 -3
  14. data/Gosu/TR1.hpp +4 -0
  15. data/Gosu/TextInput.hpp +7 -1
  16. data/Gosu/Version.hpp +2 -2
  17. data/Gosu/Window.hpp +7 -1
  18. data/GosuImpl/Audio/ALChannelManagement.hpp +11 -1
  19. data/GosuImpl/Audio/AudioOpenAL.cpp +1 -1
  20. data/GosuImpl/Graphics/BitmapApple.mm +16 -2
  21. data/GosuImpl/Graphics/BlockAllocator.hpp +2 -1
  22. data/GosuImpl/Graphics/Color.cpp +11 -11
  23. data/GosuImpl/Graphics/DrawOpQueue.hpp +0 -2
  24. data/GosuImpl/Graphics/Font.cpp +2 -2
  25. data/GosuImpl/Graphics/GosuView.hpp +1 -17
  26. data/GosuImpl/Graphics/GosuView.mm +68 -32
  27. data/GosuImpl/Graphics/Graphics.cpp +14 -63
  28. data/GosuImpl/Graphics/Image.cpp +1 -1
  29. data/GosuImpl/Graphics/LargeImageData.hpp +3 -2
  30. data/GosuImpl/Graphics/Macro.hpp +7 -6
  31. data/GosuImpl/Graphics/TexChunk.cpp +2 -2
  32. data/GosuImpl/Graphics/TexChunk.hpp +1 -1
  33. data/GosuImpl/Graphics/Texture.cpp +3 -3
  34. data/GosuImpl/Graphics/Texture.hpp +1 -1
  35. data/GosuImpl/Iconv.hpp +0 -5
  36. data/GosuImpl/InputTouch.mm +2 -12
  37. data/GosuImpl/WindowTouch.mm +70 -34
  38. data/GosuImpl/WindowWin.cpp +2 -2
  39. data/GosuImpl/WindowX.cpp +4 -4
  40. data/linux/extconf.rb +10 -2
  41. data/reference/gosu.rb +848 -266
  42. metadata +26 -46
  43. data/Gosu/Async.hpp +0 -50
  44. data/GosuImpl/Async.cpp +0 -38
  45. data/GosuImpl/Orientation.hpp +0 -15
  46. data/GosuImpl/Orientation.mm +0 -34
  47. data/GosuImpl/RubyGosuStub.mm +0 -52
  48. data/reference/Drawing_with_Colors.rdoc +0 -5
  49. data/reference/Order_of_Corners.rdoc +0 -5
  50. data/reference/Tileability.rdoc +0 -11
  51. data/reference/Z_Ordering.rdoc +0 -5
@@ -2,13 +2,14 @@
2
2
  #define GOSUIMPL_BLOCKALLOCATOR_HPP
3
3
 
4
4
  #include <memory>
5
+ #include <Gosu/Platform.hpp>
5
6
 
6
7
  namespace Gosu
7
8
  {
8
9
  class BlockAllocator
9
10
  {
10
11
  struct Impl;
11
- const std::auto_ptr<Impl> pimpl;
12
+ const GOSU_UNIQUE_PTR<Impl> pimpl;
12
13
 
13
14
  public:
14
15
  struct Block
@@ -125,14 +125,14 @@ Gosu::Color Gosu::multiply(Color a, Color b)
125
125
  round(a.blue() * b.blue() / 255.0));
126
126
  }
127
127
 
128
- const Gosu::Color Gosu::Color::NONE = 0x00000000;
129
- const Gosu::Color Gosu::Color::BLACK = 0xff000000;
130
- const Gosu::Color Gosu::Color::GRAY = 0xff808080;
131
- const Gosu::Color Gosu::Color::WHITE = 0xffffffff;
132
- const Gosu::Color Gosu::Color::AQUA = 0xff00ffff;
133
- const Gosu::Color Gosu::Color::RED = 0xffff0000;
134
- const Gosu::Color Gosu::Color::GREEN = 0xff00ff00;
135
- const Gosu::Color Gosu::Color::BLUE = 0xff0000ff;
136
- const Gosu::Color Gosu::Color::YELLOW = 0xffffff00;
137
- const Gosu::Color Gosu::Color::FUCHSIA = 0xffff00ff;
138
- const Gosu::Color Gosu::Color::CYAN = 0xff00ffff;
128
+ const Gosu::Color Gosu::Color::NONE (0x00000000);
129
+ const Gosu::Color Gosu::Color::BLACK (0xff000000);
130
+ const Gosu::Color Gosu::Color::GRAY (0xff808080);
131
+ const Gosu::Color Gosu::Color::WHITE (0xffffffff);
132
+ const Gosu::Color Gosu::Color::AQUA (0xff00ffff);
133
+ const Gosu::Color Gosu::Color::RED (0xffff0000);
134
+ const Gosu::Color Gosu::Color::GREEN (0xff00ff00);
135
+ const Gosu::Color Gosu::Color::BLUE (0xff0000ff);
136
+ const Gosu::Color Gosu::Color::YELLOW (0xffffff00);
137
+ const Gosu::Color Gosu::Color::FUCHSIA (0xffff00ff);
138
+ const Gosu::Color Gosu::Color::CYAN (0xff00ffff);
@@ -73,8 +73,6 @@ public:
73
73
  double physHeight = std::abs(top - bottom);
74
74
 
75
75
  // Adjust for OpenGL having the wrong idea of where y=0 is.
76
- // TODO: This should really happen *right before* setting up
77
- // the glScissor.
78
76
  physY = screenHeight - physY - physHeight;
79
77
 
80
78
  clipRectStack.beginClipping(physX, physY, physWidth, physHeight);
@@ -20,11 +20,11 @@ struct Gosu::Font::Impl
20
20
  // the first plane will ever be touched.
21
21
  struct CharInfo
22
22
  {
23
- auto_ptr<Image> image;
23
+ GOSU_UNIQUE_PTR<Image> image;
24
24
  double factor;
25
25
  };
26
26
  typedef tr1::array<CharInfo, 65536> Plane;
27
- auto_ptr<Plane> planes[16][ffCombinations];
27
+ GOSU_UNIQUE_PTR<Plane> planes[16][ffCombinations];
28
28
 
29
29
  map<wstring, tr1::shared_ptr<Image> > entityCache;
30
30
 
@@ -2,7 +2,6 @@
2
2
  #import <OpenGLES/EAGL.h>
3
3
  #import <OpenGLES/ES1/gl.h>
4
4
  #import <OpenGLES/ES1/glext.h>
5
- #import <Gosu/Window.hpp>
6
5
 
7
6
  // UIViewController subclass that creates a GosuView and helps it manage rotation.
8
7
 
@@ -11,21 +10,6 @@
11
10
 
12
11
  // UIView subclass that contains a CAEAGLLayer.
13
12
 
14
- @interface GosuView : UIView {
15
-
16
- @private
17
- /* The pixel dimensions of the backbuffer */
18
- GLint backingWidth;
19
- GLint backingHeight;
20
-
21
- EAGLContext *context;
22
-
23
- /* OpenGL names for the renderbuffer and framebuffers used to render to this view */
24
- GLuint viewRenderbuffer, viewFramebuffer;
25
-
26
- NSMutableSet* currentTouches;
27
- Gosu::Touches* currentTouchesVector;
28
- }
29
-
13
+ @interface GosuView : UIView
30
14
  - (void)drawView;
31
15
  @end
@@ -3,6 +3,7 @@
3
3
  #import <UIKit/UIKit.h>
4
4
 
5
5
  #import <Gosu/Graphics.hpp>
6
+ #import <Gosu/Window.hpp>
6
7
  #import "Common.hpp"
7
8
  #import "GosuView.hpp"
8
9
 
@@ -31,38 +32,62 @@ int Gosu::clipRectBaseFactor()
31
32
 
32
33
  // A controller to allow for autorotation.
33
34
  @implementation GosuViewController
34
- - (void)loadView {
35
+ - (BOOL)prefersStatusBarHidden
36
+ {
37
+ return YES;
38
+ }
39
+
40
+ - (void)loadView
41
+ {
35
42
  self.view = [[GosuView alloc] init];
36
43
  }
37
44
 
38
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
39
- return NO;
45
+ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
46
+ {
47
+ return UIInterfaceOrientationIsLandscape(interfaceOrientation);
48
+ }
49
+
50
+ - (NSUInteger)supportedInterfaceOrientations
51
+ {
52
+ return UIInterfaceOrientationMaskLandscape;
40
53
  }
41
54
 
42
- - (void)didReceiveMemoryWarning {
55
+ - (BOOL)shouldAutorotate
56
+ {
57
+ return YES;
58
+ }
59
+
60
+ - (void)didReceiveMemoryWarning
61
+ {
43
62
  windowInstance().releaseMemory();
44
63
  }
45
64
  @end
46
65
 
47
66
  // A class extension to declare private methods
48
67
  @interface GosuView ()
49
-
50
- @property (nonatomic, retain) EAGLContext *context;
51
-
52
- - (BOOL) createFramebuffer;
53
- - (void) destroyFramebuffer;
54
-
68
+ @property (nonatomic, strong) EAGLContext *context;
55
69
  @end
56
70
 
57
71
  @implementation GosuView
72
+ {
73
+ // The pixel dimensions of the backbuffer
74
+ GLint backingWidth;
75
+ GLint backingHeight;
58
76
 
59
- @synthesize context;
77
+ // OpenGL names for the renderbuffer and framebuffers used to render to this view
78
+ GLuint viewRenderbuffer, viewFramebuffer;
60
79
 
61
- + (Class)layerClass {
80
+ NSMutableSet* currentTouches;
81
+ Gosu::Touches* currentTouchesVector;
82
+ }
83
+
84
+ + (Class)layerClass
85
+ {
62
86
  return [CAEAGLLayer class];
63
87
  }
64
88
 
65
- - (id)init {
89
+ - (id)init
90
+ {
66
91
  if ((self = [super initWithFrame: [[UIScreen mainScreen] bounds]])) {
67
92
  CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
68
93
 
@@ -71,9 +96,9 @@ int Gosu::clipRectBaseFactor()
71
96
  [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking,
72
97
  kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];*/
73
98
 
74
- context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
99
+ self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
75
100
 
76
- if (!context || ![EAGLContext setCurrentContext:context]) {
101
+ if (!self.context || ![EAGLContext setCurrentContext:self.context]) {
77
102
  [self release];
78
103
  return nil;
79
104
  }
@@ -81,13 +106,14 @@ int Gosu::clipRectBaseFactor()
81
106
  return self;
82
107
  }
83
108
 
84
- - (void)drawView {
109
+ - (void)drawView
110
+ {
85
111
  if (not windowInstance().needsRedraw())
86
112
  return;
87
113
 
88
114
  Gosu::FPS::registerFrame();
89
115
 
90
- [EAGLContext setCurrentContext:context];
116
+ [EAGLContext setCurrentContext:self.context];
91
117
  glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
92
118
  glViewport(0, 0, backingWidth, backingHeight);
93
119
 
@@ -97,11 +123,12 @@ int Gosu::clipRectBaseFactor()
97
123
  }
98
124
 
99
125
  glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
100
- [context presentRenderbuffer:GL_RENDERBUFFER_OES];
126
+ [self.context presentRenderbuffer:GL_RENDERBUFFER_OES];
101
127
  }
102
128
 
103
- - (void)layoutSubviews {
104
- [EAGLContext setCurrentContext:context];
129
+ - (void)layoutSubviews
130
+ {
131
+ [EAGLContext setCurrentContext:self.context];
105
132
  [self destroyFramebuffer];
106
133
  if ([self respondsToSelector:@selector(contentScaleFactor)])
107
134
  self.contentScaleFactor = Gosu::clipRectBaseFactor();
@@ -109,13 +136,14 @@ int Gosu::clipRectBaseFactor()
109
136
  [self drawView];
110
137
  }
111
138
 
112
- - (BOOL)createFramebuffer {
139
+ - (BOOL)createFramebuffer
140
+ {
113
141
  glGenFramebuffersOES(1, &viewFramebuffer);
114
142
  glGenRenderbuffersOES(1, &viewRenderbuffer);
115
143
 
116
144
  glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
117
145
  glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
118
- [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];
146
+ [self.context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];
119
147
  glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);
120
148
 
121
149
  glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
@@ -129,43 +157,51 @@ int Gosu::clipRectBaseFactor()
129
157
  return YES;
130
158
  }
131
159
 
132
- - (void)destroyFramebuffer {
160
+ - (void)destroyFramebuffer
161
+ {
133
162
  glDeleteFramebuffersOES(1, &viewFramebuffer);
134
163
  viewFramebuffer = 0;
135
164
  glDeleteRenderbuffersOES(1, &viewRenderbuffer);
136
165
  viewRenderbuffer = 0;
137
166
  }
138
167
 
139
- - (void)dealloc {
168
+ - (void)dealloc
169
+ {
140
170
  delete currentTouchesVector;
141
171
  [currentTouches release];
142
172
  [EAGLContext setCurrentContext:nil];
143
- [context release];
173
+ [self.context release];
144
174
  [super dealloc];
145
175
  }
146
176
 
147
- - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
177
+ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
178
+ {
148
179
  windowInstance().input().feedTouchEvent(0, touches);
149
180
  }
150
181
 
151
- - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
182
+ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
183
+ {
152
184
  windowInstance().input().feedTouchEvent(1, touches);
153
185
  }
154
186
 
155
- - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
187
+ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
188
+ {
156
189
  windowInstance().input().feedTouchEvent(2, touches);
157
190
  }
158
191
 
159
- - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
192
+ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
193
+ {
160
194
  // TODO: Should be differentiated on the Gosu side.
161
- [self touchesEnded: touches withEvent: event];
195
+ [self touchesEnded:touches withEvent:event];
162
196
  }
163
197
 
164
- - (BOOL)isMultipleTouchEnabled {
198
+ - (BOOL)isMultipleTouchEnabled
199
+ {
165
200
  return YES;
166
201
  }
167
202
 
168
- - (BOOL)isExclusiveTouch {
203
+ - (BOOL)isExclusiveTouch
204
+ {
169
205
  return YES;
170
206
  }
171
207
 
@@ -8,17 +8,10 @@
8
8
  #include <Gosu/Bitmap.hpp>
9
9
  #include <Gosu/Image.hpp>
10
10
  #include <Gosu/Platform.hpp>
11
- #if 0
12
- #include <thread>
13
- #endif
14
11
  #include <cmath>
15
12
  #include <algorithm>
16
13
  #include <limits>
17
14
 
18
- #ifdef GOSU_IS_IPHONE
19
- #include "../Orientation.hpp"
20
- #endif
21
-
22
15
  struct Gosu::Graphics::Impl
23
16
  {
24
17
  unsigned virtWidth, virtHeight;
@@ -27,35 +20,6 @@ struct Gosu::Graphics::Impl
27
20
  DrawOpQueueStack queues;
28
21
  typedef std::vector<std::tr1::shared_ptr<Texture> > Textures;
29
22
  Textures textures;
30
-
31
- #if 0
32
- std::mutex texMutex;
33
- #endif
34
-
35
- #ifdef GOSU_IS_IPHONE
36
- Transform transformForOrientation(Orientation orientation)
37
- {
38
- Transform result;
39
- switch (orientation)
40
- {
41
- case orLandscapeLeft:
42
- result = translate(physWidth, 0);
43
- result = multiply(rotate(90), result);
44
- result = multiply(scale(1.0 * physHeight / virtWidth, 1.0 * physWidth / virtHeight), result);
45
- return result;
46
- default:
47
- result = translate(0, physHeight);
48
- result = multiply(rotate(-90), result);
49
- result = multiply(scale(1.0 * physHeight / virtWidth, 1.0 * physWidth / virtHeight), result);
50
- return result;
51
- }
52
- }
53
-
54
- void updateBaseTransform()
55
- {
56
- queues.front().setBaseTransform(transformForOrientation(currentOrientation()));
57
- }
58
- #endif
59
23
  };
60
24
 
61
25
  Gosu::Graphics::Graphics(unsigned physWidth, unsigned physHeight, bool fullscreen)
@@ -65,9 +29,6 @@ Gosu::Graphics::Graphics(unsigned physWidth, unsigned physHeight, bool fullscree
65
29
  pimpl->physHeight = physHeight;
66
30
  pimpl->virtWidth = physWidth;
67
31
  pimpl->virtHeight = physHeight;
68
- #ifdef GOSU_IS_IPHONE
69
- std::swap(pimpl->virtWidth, pimpl->virtHeight);
70
- #endif
71
32
  pimpl->fullscreen = fullscreen;
72
33
 
73
34
  // Should be merged into RenderState altogether.
@@ -115,12 +76,9 @@ void Gosu::Graphics::setResolution(unsigned virtualWidth, unsigned virtualHeight
115
76
  throw std::invalid_argument("Invalid virtual resolution.");
116
77
 
117
78
  pimpl->virtWidth = virtualWidth, pimpl->virtHeight = virtualHeight;
118
- #ifndef GOSU_IS_IPHONE
119
- // on the iPhone, updateCurrentTransform will handle this (yuck)
120
- Transform baseTransform = scale(1.0 / virtualWidth * pimpl->physWidth,
121
- 1.0 / virtualHeight * pimpl->physHeight);
122
- pimpl->queues.front().setBaseTransform(baseTransform);
123
- #endif
79
+ double scaleX = 1.0 / virtualWidth * pimpl->physWidth;
80
+ double scaleY = 1.0 / virtualHeight * pimpl->physHeight;
81
+ pimpl->queues.front().setBaseTransform(scale(scaleX, scaleY));
124
82
  }
125
83
 
126
84
  bool Gosu::Graphics::begin(Gosu::Color clearWithColor)
@@ -131,9 +89,6 @@ bool Gosu::Graphics::begin(Gosu::Color clearWithColor)
131
89
  // Clear leftover transforms, clip rects etc.
132
90
  pimpl->queues.front().reset();
133
91
 
134
- #ifdef GOSU_IS_IPHONE
135
- pimpl->updateBaseTransform();
136
- #endif
137
92
  glClearColor(clearWithColor.red() / 255.f, clearWithColor.green() / 255.f,
138
93
  clearWithColor.blue() / 255.f, clearWithColor.alpha() / 255.f);
139
94
  glClear(GL_COLOR_BUFFER_BIT);
@@ -253,12 +208,12 @@ void Gosu::Graphics::beginRecording()
253
208
  pimpl->queues.resize(pimpl->queues.size() + 1);
254
209
  }
255
210
 
256
- std::auto_ptr<Gosu::ImageData> Gosu::Graphics::endRecording(int width, int height)
211
+ GOSU_UNIQUE_PTR<Gosu::ImageData> Gosu::Graphics::endRecording(int width, int height)
257
212
  {
258
213
  if (pimpl->queues.size() == 1)
259
214
  throw std::logic_error("No macro recording in progress that can be captured");
260
215
 
261
- std::auto_ptr<ImageData> result(new Macro(*this, pimpl->queues.back(), width, height));
216
+ GOSU_UNIQUE_PTR<ImageData> result(new Macro(*this, pimpl->queues.back(), width, height));
262
217
  pimpl->queues.pop_back();
263
218
  return result;
264
219
  }
@@ -326,7 +281,7 @@ void Gosu::Graphics::drawQuad(double x1, double y1, Color c1,
326
281
  pimpl->queues.back().scheduleDrawOp(op);
327
282
  }
328
283
 
329
- std::auto_ptr<Gosu::ImageData> Gosu::Graphics::createImage(
284
+ GOSU_UNIQUE_PTR<Gosu::ImageData> Gosu::Graphics::createImage(
330
285
  const Bitmap& src, unsigned srcX, unsigned srcY,
331
286
  unsigned srcWidth, unsigned srcHeight, unsigned borderFlags)
332
287
  {
@@ -341,7 +296,7 @@ std::auto_ptr<Gosu::ImageData> Gosu::Graphics::createImage(
341
296
  srcWidth >= 64)
342
297
  {
343
298
  std::tr1::shared_ptr<Texture> texture(new Texture(srcWidth));
344
- std::auto_ptr<ImageData> data;
299
+ GOSU_UNIQUE_PTR<ImageData> data;
345
300
 
346
301
  // Use the source bitmap directly if the source area completely covers
347
302
  // it.
@@ -360,7 +315,7 @@ std::auto_ptr<Gosu::ImageData> Gosu::Graphics::createImage(
360
315
 
361
316
  if (!data.get())
362
317
  throw std::logic_error("Internal texture block allocation error");
363
- return data;
318
+ return GOSU_MOVE_UNIQUE_PTR(data);
364
319
  }
365
320
 
366
321
  // Too large to fit on a single texture.
@@ -368,27 +323,23 @@ std::auto_ptr<Gosu::ImageData> Gosu::Graphics::createImage(
368
323
  {
369
324
  Bitmap bmp(srcWidth, srcHeight);
370
325
  bmp.insert(src, 0, 0, srcX, srcY, srcWidth, srcHeight);
371
- std::auto_ptr<ImageData> lidi;
326
+ GOSU_UNIQUE_PTR<ImageData> lidi;
372
327
  lidi.reset(new LargeImageData(*this, bmp, maxSize - 2, maxSize - 2, borderFlags));
373
- return lidi;
328
+ return GOSU_MOVE_UNIQUE_PTR(lidi);
374
329
  }
375
330
 
376
331
  Bitmap bmp;
377
332
  applyBorderFlags(bmp, src, srcX, srcY, srcWidth, srcHeight, borderFlags);
378
333
 
379
- #if 0
380
- std::mutex::scoped_lock lock(pimpl->texMutex);
381
- #endif
382
-
383
334
  // Try to put the bitmap into one of the already allocated textures.
384
335
  for (Impl::Textures::iterator i = pimpl->textures.begin(); i != pimpl->textures.end(); ++i)
385
336
  {
386
337
  std::tr1::shared_ptr<Texture> texture(*i);
387
338
 
388
- std::auto_ptr<ImageData> data;
339
+ GOSU_UNIQUE_PTR<ImageData> data;
389
340
  data = texture->tryAlloc(*this, pimpl->queues, texture, bmp, 1);
390
341
  if (data.get())
391
- return data;
342
+ return GOSU_MOVE_UNIQUE_PTR(data);
392
343
  }
393
344
 
394
345
  // All textures are full: Create a new one.
@@ -397,10 +348,10 @@ std::auto_ptr<Gosu::ImageData> Gosu::Graphics::createImage(
397
348
  texture.reset(new Texture(maxSize));
398
349
  pimpl->textures.push_back(texture);
399
350
 
400
- std::auto_ptr<ImageData> data;
351
+ GOSU_UNIQUE_PTR<ImageData> data;
401
352
  data = texture->tryAlloc(*this, pimpl->queues, texture, bmp, 1);
402
353
  if (!data.get())
403
354
  throw std::logic_error("Internal texture block allocation error");
404
355
 
405
- return data;
356
+ return GOSU_MOVE_UNIQUE_PTR(data);
406
357
  }