gosu 0.7.33 → 0.7.35

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 (77) hide show
  1. data/Gosu/Async.hpp +10 -8
  2. data/Gosu/Audio.hpp +6 -4
  3. data/Gosu/AutoLink.hpp +0 -0
  4. data/Gosu/Bitmap.hpp +4 -5
  5. data/Gosu/ButtonsX.hpp +1 -1
  6. data/Gosu/Color.hpp +8 -8
  7. data/Gosu/Font.hpp +2 -2
  8. data/Gosu/Graphics.hpp +4 -6
  9. data/Gosu/IO.hpp +11 -4
  10. data/Gosu/Image.hpp +9 -7
  11. data/Gosu/ImageData.hpp +10 -4
  12. data/Gosu/Input.hpp +4 -5
  13. data/Gosu/Sockets.hpp +10 -12
  14. data/Gosu/TR1.hpp +44 -0
  15. data/Gosu/TextInput.hpp +2 -2
  16. data/Gosu/Version.hpp +2 -2
  17. data/Gosu/WinUtility.hpp +5 -6
  18. data/Gosu/Window.hpp +5 -6
  19. data/GosuImpl/Async.cpp +4 -3
  20. data/GosuImpl/Audio/ALChannelManagement.hpp +23 -11
  21. data/GosuImpl/Audio/AudioFile.hpp +11 -3
  22. data/GosuImpl/Audio/AudioOpenAL.cpp +613 -0
  23. data/GosuImpl/Audio/AudioOpenAL.mm +1 -605
  24. data/GosuImpl/Audio/AudioSDL.cpp +12 -14
  25. data/GosuImpl/Audio/AudioToolboxFile.hpp +0 -1
  26. data/GosuImpl/Audio/OggFile.hpp +2 -0
  27. data/GosuImpl/Audio/SndFile.hpp +158 -0
  28. data/GosuImpl/DirectoriesWin.cpp +18 -18
  29. data/GosuImpl/Graphics/BitmapApple.mm +17 -19
  30. data/GosuImpl/Graphics/BitmapBMP.cpp +7 -2
  31. data/GosuImpl/Graphics/BitmapFreeImage.cpp +11 -12
  32. data/GosuImpl/Graphics/BitmapGDIplus.cpp +35 -31
  33. data/GosuImpl/Graphics/BitmapUtils.cpp +1 -1
  34. data/GosuImpl/Graphics/BlockAllocator.cpp +7 -8
  35. data/GosuImpl/Graphics/BlockAllocator.hpp +3 -4
  36. data/GosuImpl/Graphics/Common.hpp +3 -2
  37. data/GosuImpl/Graphics/DrawOp.hpp +2 -3
  38. data/GosuImpl/Graphics/DrawOpQueue.hpp +28 -20
  39. data/GosuImpl/Graphics/Font.cpp +13 -13
  40. data/GosuImpl/Graphics/FormattedString.hpp +93 -86
  41. data/GosuImpl/Graphics/Graphics.cpp +16 -14
  42. data/GosuImpl/Graphics/Image.cpp +7 -3
  43. data/GosuImpl/Graphics/LargeImageData.hpp +4 -5
  44. data/GosuImpl/Graphics/Macro.hpp +11 -11
  45. data/GosuImpl/Graphics/RenderState.hpp +5 -4
  46. data/GosuImpl/Graphics/TexChunk.cpp +3 -3
  47. data/GosuImpl/Graphics/TexChunk.hpp +4 -4
  48. data/GosuImpl/Graphics/Text.cpp +29 -30
  49. data/GosuImpl/Graphics/TextMac.cpp +9 -7
  50. data/GosuImpl/Graphics/TextTTFWin.cpp +3 -1
  51. data/GosuImpl/Graphics/TextTouch.mm +0 -1
  52. data/GosuImpl/Graphics/TextUnix.cpp +12 -4
  53. data/GosuImpl/Graphics/TextWin.cpp +4 -2
  54. data/GosuImpl/Graphics/Texture.cpp +7 -6
  55. data/GosuImpl/Graphics/Texture.hpp +3 -4
  56. data/GosuImpl/InputMac.mm +12 -15
  57. data/GosuImpl/InputTouch.mm +3 -3
  58. data/GosuImpl/InputWin.cpp +149 -159
  59. data/GosuImpl/InputX.cpp +0 -0
  60. data/GosuImpl/MacUtility.hpp +9 -4
  61. data/GosuImpl/RubyGosu.swg +38 -43
  62. data/GosuImpl/RubyGosu_wrap.cxx +89 -96
  63. data/GosuImpl/Sockets/CommSocket.cpp +5 -5
  64. data/GosuImpl/Sockets/Sockets.hpp +4 -4
  65. data/GosuImpl/TimingApple.cpp +2 -3
  66. data/GosuImpl/Utility.cpp +18 -0
  67. data/GosuImpl/WinMain.cpp +0 -1
  68. data/GosuImpl/WinUtility.cpp +2 -2
  69. data/GosuImpl/WindowMac.mm +20 -17
  70. data/GosuImpl/WindowTouch.mm +8 -7
  71. data/GosuImpl/WindowWin.cpp +12 -7
  72. data/GosuImpl/WindowX.cpp +67 -18
  73. data/lib/gosu.rb +14 -12
  74. data/linux/extconf.rb +11 -6
  75. metadata +8 -7
  76. data/GosuImpl/Audio/AudioAudiere.cpp +0 -448
  77. data/GosuImpl/RubyGosu_DllMain.cxx +0 -31
@@ -2,16 +2,21 @@
2
2
  #include <Gosu/Bitmap.hpp>
3
3
  #include <Gosu/IO.hpp>
4
4
  #include <Gosu/Platform.hpp>
5
+ #include <Gosu/TR1.hpp>
5
6
  #include <Gosu/Utility.hpp>
6
7
  #include <Gosu/WinUtility.hpp>
7
- #include <boost/cstdint.hpp>
8
- #include <boost/algorithm/string.hpp>
8
+ #include <cwctype>
9
9
  #include <map>
10
10
 
11
11
  #include <objidl.h>
12
12
  #include <gdiplus.h>
13
13
  #include <windows.h>
14
14
 
15
+ using namespace std;
16
+
17
+ // TODO: Move into proper internal header
18
+ namespace Gosu { bool isExtension(const wchar_t* str, const wchar_t* ext); }
19
+
15
20
  namespace
16
21
  {
17
22
  bool initialized = false;
@@ -23,7 +28,7 @@ namespace
23
28
  {
24
29
  // Since GDI+ only supports ARGB=BGRA formats, we
25
30
  // manually exchange the R and B channels to get to ABGR=RGBA.
26
- boost::uint32_t* p = reinterpret_cast<boost::uint32_t*>(bitmap.data());
31
+ std::tr1::uint32_t* p = reinterpret_cast<std::tr1::uint32_t*>(bitmap.data());
27
32
  for (int i = bitmap.width() * bitmap.height(); i > 0; --i, ++p)
28
33
  *p = (*p & 0xff00ff00) | ((*p << 16) & 0x00ff0000) | ((*p >> 16) & 0x000000ff);
29
34
  }
@@ -31,7 +36,7 @@ namespace
31
36
  void check(Gdiplus::Status status, const char* action)
32
37
  {
33
38
  if (status != Gdiplus::Ok)
34
- throw std::runtime_error(std::string("A GDI+ error occured while ") + action);
39
+ throw runtime_error(string("A GDI+ error occured while ") + action);
35
40
  }
36
41
 
37
42
  void closeGDIplus()
@@ -48,9 +53,8 @@ namespace
48
53
  atexit(closeGDIplus);
49
54
  }
50
55
 
51
- Gosu::Bitmap gdiPlusToGosu(Gdiplus::Bitmap& bitmap)
56
+ void gdiPlusToGosu(Gosu::Bitmap& result, Gdiplus::Bitmap& bitmap)
52
57
  {
53
- Gosu::Bitmap result;
54
58
  result.resize(bitmap.GetWidth(), bitmap.GetHeight());
55
59
 
56
60
  GUID guid;
@@ -79,11 +83,9 @@ namespace
79
83
 
80
84
  if (guid == Gdiplus::ImageFormatBMP)
81
85
  applyColorKey(result, Gosu::Color::FUCHSIA);
82
-
83
- return result;
84
86
  }
85
87
 
86
- boost::shared_ptr<IStream> readToIStream(Gosu::Reader reader)
88
+ tr1::shared_ptr<IStream> readToIStream(Gosu::Reader reader)
87
89
  {
88
90
  unsigned remaining = reader.resource().size() - reader.position();
89
91
  HGLOBAL buffer = ::GlobalAlloc(GMEM_MOVEABLE, remaining);
@@ -100,14 +102,14 @@ namespace
100
102
  if (::CreateStreamOnHGlobal(buffer, TRUE, &stream) != S_OK)
101
103
  {
102
104
  ::GlobalFree(buffer);
103
- throw std::runtime_error("Could not create IStream");
105
+ throw runtime_error("Could not create IStream");
104
106
  }
105
107
  return Gosu::Win::shareComPtr(stream);
106
108
  }
107
109
 
108
- CLSID& encoderFromMimeType(const std::wstring& mimeType)
110
+ CLSID& encoderFromMimeType(const wstring& mimeType)
109
111
  {
110
- static std::map<std::wstring, CLSID> cache;
112
+ static map<wstring, CLSID> cache;
111
113
  if (cache.count(mimeType))
112
114
  return cache[mimeType];
113
115
 
@@ -115,25 +117,27 @@ namespace
115
117
  check(Gdiplus::GetImageEncodersSize(&num, &size), "counting encoders");
116
118
  // Do the eleet int-based ceil(size / sizeof)
117
119
  unsigned vecSize = (size + sizeof(Gdiplus::ImageCodecInfo) - 1) / sizeof(Gdiplus::ImageCodecInfo);
118
- std::vector<Gdiplus::ImageCodecInfo> codecs(vecSize);
120
+ vector<Gdiplus::ImageCodecInfo> codecs(vecSize);
119
121
  check(Gdiplus::GetImageEncoders(num, size,
120
122
  &codecs[0]), "enumerating encoders");
121
123
  for (int i = 0; i < num; ++i)
122
124
  if (codecs[i].MimeType == mimeType)
123
125
  return cache[mimeType] = codecs[i].Clsid;
124
- throw std::runtime_error("No encoder found for " + Gosu::wstringToUTF8(mimeType));
126
+ throw runtime_error("No encoder found for " + Gosu::wstringToUTF8(mimeType));
125
127
  }
126
128
 
127
- CLSID encoderFromHint(const std::wstring& formatHint)
129
+ CLSID encoderFromHint(const wstring& formatHint)
128
130
  {
129
- std::wstring::size_type idx = formatHint.rfind('.');
130
- std::wstring mimeType = L"image/";
131
- if (idx == std::wstring::npos)
131
+ wstring::size_type idx = formatHint.rfind('.');
132
+ wstring mimeType = L"image/";
133
+ if (idx == wstring::npos)
132
134
  mimeType += formatHint;
133
135
  else
134
136
  mimeType += formatHint.substr(idx + 1);
135
- boost::to_lower(mimeType);
136
-
137
+
138
+ for (int i = 0; i < mimeType.size(); ++i)
139
+ mimeType[i] = towlower((wint_t)mimeType[i]);
140
+
137
141
  // Fix pitfalls
138
142
  if (mimeType == L"image/jpg")
139
143
  mimeType = L"image/jpeg";
@@ -144,31 +148,31 @@ namespace
144
148
  }
145
149
  }
146
150
 
147
- Gosu::Bitmap Gosu::loadImageFile(const std::wstring& filename)
151
+ void Gosu::loadImageFile(Gosu::Bitmap& result, const wstring& filename)
148
152
  {
149
153
  requireGDIplus();
150
154
 
151
155
  Gdiplus::Bitmap bitmap(filename.c_str());
152
156
  check(bitmap.GetLastStatus(), ("loading " + wstringToUTF8(filename)).c_str());
153
- return gdiPlusToGosu(bitmap);
157
+ gdiPlusToGosu(result, bitmap);
154
158
  }
155
159
 
156
- Gosu::Bitmap Gosu::loadImageFile(Reader reader)
160
+ void Gosu::loadImageFile(Gosu::Bitmap& result, Reader reader)
157
161
  {
158
162
  requireGDIplus();
159
163
 
160
- boost::shared_ptr<IStream> stream = readToIStream(reader);
164
+ tr1::shared_ptr<IStream> stream = readToIStream(reader);
161
165
  Gdiplus::Bitmap bitmap(stream.get());
162
166
  check(bitmap.GetLastStatus(), "loading a bitmap from memory");
163
- return gdiPlusToGosu(bitmap);
167
+ gdiPlusToGosu(result, bitmap);
164
168
  }
165
169
 
166
- void Gosu::saveImageFile(const Bitmap& bitmap, const std::wstring& filename)
170
+ void Gosu::saveImageFile(const Bitmap& bitmap, const wstring& filename)
167
171
  {
168
172
  requireGDIplus();
169
173
 
170
174
  Bitmap input = bitmap;
171
- if (boost::iends_with(filename, "bmp"))
175
+ if (isExtension(filename.c_str(), L".bmp"))
172
176
  unapplyColorKey(input, Color::FUCHSIA);
173
177
  reshuffleBitmap(input);
174
178
  Gdiplus::Bitmap output(input.width(), input.height(), input.width() * 4,
@@ -179,12 +183,12 @@ void Gosu::saveImageFile(const Bitmap& bitmap, const std::wstring& filename)
179
183
  ("writing to " + wstringToUTF8(filename)).c_str());
180
184
  }
181
185
 
182
- void Gosu::saveImageFile(const Bitmap& bitmap, Writer writer, const std::wstring& formatHint)
186
+ void Gosu::saveImageFile(const Bitmap& bitmap, Writer writer, const wstring& formatHint)
183
187
  {
184
188
  requireGDIplus();
185
189
 
186
190
  Bitmap input = bitmap;
187
- if (boost::iends_with(formatHint, "bmp"))
191
+ if (isExtension(formatHint.c_str(), L".bmp"))
188
192
  unapplyColorKey(input, Color::FUCHSIA);
189
193
  reshuffleBitmap(input);
190
194
  Gdiplus::Bitmap output(input.width(), input.height(), input.width() * 4,
@@ -193,8 +197,8 @@ void Gosu::saveImageFile(const Bitmap& bitmap, Writer writer, const std::wstring
193
197
 
194
198
  IStream* stream = NULL;
195
199
  if (CreateStreamOnHGlobal(0, TRUE, &stream) != S_OK)
196
- throw std::runtime_error("Could not create IStream for writing");
197
- boost::shared_ptr<IStream> streamGuard(Gosu::Win::shareComPtr(stream));
200
+ throw runtime_error("Could not create IStream for writing");
201
+ tr1::shared_ptr<IStream> streamGuard(Gosu::Win::shareComPtr(stream));
198
202
  check(output.Save(stream, &encoderFromHint(formatHint)),
199
203
  "saving a bitmap to memory");
200
204
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gosu::Reader Gosu::loadFromPNG(Bitmap& bitmap, Reader reader)
7
7
  {
8
- bitmap = loadImageFile(reader);
8
+ loadImageFile(bitmap, reader);
9
9
  reader.setPosition(reader.resource().size());
10
10
  return reader;
11
11
  }
@@ -72,24 +72,23 @@ unsigned Gosu::BlockAllocator::height() const
72
72
  return pimpl->height;
73
73
  }
74
74
 
75
- boost::optional<Gosu::BlockAllocator::Block>
76
- Gosu::BlockAllocator::alloc(unsigned aWidth, unsigned aHeight)
75
+ bool Gosu::BlockAllocator::alloc(unsigned aWidth, unsigned aHeight, Block& b)
77
76
  {
78
77
  // The rect wouldn't even fit onto the texture!
79
78
  if (aWidth > width() || aHeight > height())
80
- return boost::optional<Block>();
79
+ return false;
81
80
 
82
81
  // We know there's no space left.
83
82
  if (aWidth > pimpl->maxW && aHeight > pimpl->maxH)
84
- return boost::optional<Block>();
83
+ return false;
85
84
 
86
85
  // Start to look for a place next to the last returned rect. Chances are
87
86
  // good we'll find a place there.
88
- Block b = Block(pimpl->firstX, pimpl->firstY, aWidth, aHeight);
87
+ b = Block(pimpl->firstX, pimpl->firstY, aWidth, aHeight);
89
88
  if (pimpl->isBlockFree(b))
90
89
  {
91
90
  pimpl->markBlockUsed(b, aWidth, aHeight);
92
- return b;
91
+ return true;
93
92
  }
94
93
 
95
94
  // Brute force: Look for a free place on this texture.
@@ -110,13 +109,13 @@ boost::optional<Gosu::BlockAllocator::Block>
110
109
  --x;
111
110
 
112
111
  pimpl->markBlockUsed(b, aWidth, aHeight);
113
- return b;
112
+ return true;
114
113
  }
115
114
 
116
115
  // So there was no space for the bitmap. Remember this for later.
117
116
  pimpl->maxW = aWidth - 1;
118
117
  pimpl->maxH = aHeight - 1;
119
- return boost::optional<Block>();
118
+ return false;
120
119
  }
121
120
 
122
121
  void Gosu::BlockAllocator::free(unsigned left, unsigned top)
@@ -1,15 +1,14 @@
1
1
  #ifndef GOSUIMPL_BLOCKALLOCATOR_HPP
2
2
  #define GOSUIMPL_BLOCKALLOCATOR_HPP
3
3
 
4
- #include <boost/optional.hpp>
5
- #include <boost/scoped_ptr.hpp>
4
+ #include <memory>
6
5
 
7
6
  namespace Gosu
8
7
  {
9
8
  class BlockAllocator
10
9
  {
11
10
  struct Impl;
12
- boost::scoped_ptr<Impl> pimpl;
11
+ const std::auto_ptr<Impl> pimpl;
13
12
 
14
13
  public:
15
14
  struct Block
@@ -26,7 +25,7 @@ namespace Gosu
26
25
  unsigned width() const;
27
26
  unsigned height() const;
28
27
 
29
- boost::optional<Block> alloc(unsigned width, unsigned height);
28
+ bool alloc(unsigned width, unsigned height, Block& block);
30
29
  void free(unsigned left, unsigned top);
31
30
  };
32
31
  }
@@ -61,10 +61,11 @@ namespace Gosu
61
61
  inline Transform multiply(const Transform& left, const Transform& right)
62
62
  {
63
63
  Gosu::Transform result;
64
- result.assign(0);
65
- for (int i = 0; i < 16; ++i)
64
+ for (int i = 0; i < 16; ++i) {
65
+ result[i] = 0;
66
66
  for (int j = 0; j < 4; ++j)
67
67
  result[i] += left[i / 4 * 4 + j] * right[i % 4 + j * 4];
68
+ }
68
69
  return result;
69
70
  }
70
71
 
@@ -6,14 +6,13 @@
6
6
  #include <GosuImpl/Graphics/Common.hpp>
7
7
  #include <GosuImpl/Graphics/TexChunk.hpp>
8
8
  #include <GosuImpl/Graphics/RenderState.hpp>
9
- #include <boost/cstdint.hpp>
10
9
 
11
10
  namespace Gosu
12
11
  {
13
12
  struct ArrayVertex
14
13
  {
15
14
  float texCoords[2];
16
- boost::uint32_t color;
15
+ unsigned color;
17
16
  float vertices[3];
18
17
  };
19
18
  typedef std::vector<ArrayVertex> VertexArray;
@@ -52,7 +51,7 @@ namespace Gosu
52
51
  static int spriteCounter = 0;
53
52
  static float spriteVertices[12 * MAX_AUTOGROUP];
54
53
  static float spriteTexcoords[12 * MAX_AUTOGROUP];
55
- static boost::uint32_t spriteColors[6 * MAX_AUTOGROUP];
54
+ static unsigned spriteColors[6 * MAX_AUTOGROUP];
56
55
 
57
56
  // iPhone specific setup
58
57
  static bool isSetup = false;
@@ -1,11 +1,10 @@
1
1
  #ifndef GOSUIMPL_GRAPHICS_DRAWOPQUEUE_HPP
2
2
  #define GOSUIMPL_GRAPHICS_DRAWOPQUEUE_HPP
3
3
 
4
+ #include <Gosu/TR1.hpp>
4
5
  #include <GosuImpl/Graphics/Common.hpp>
5
6
  #include <GosuImpl/Graphics/DrawOp.hpp>
6
- #include <boost/foreach.hpp>
7
- #include <boost/function.hpp>
8
- #include <boost/optional.hpp>
7
+ #include <cassert>
9
8
  #include <algorithm>
10
9
  #include <map>
11
10
  #include <vector>
@@ -14,7 +13,7 @@ class Gosu::DrawOpQueue
14
13
  {
15
14
  typedef std::vector<DrawOp> DrawOps;
16
15
  DrawOps ops;
17
- typedef std::multimap<ZPos, boost::function<void()> > CodeMap;
16
+ typedef std::multimap<ZPos, std::tr1::function<void()> > CodeMap;
18
17
  CodeMap code;
19
18
 
20
19
  struct ClipRect
@@ -23,15 +22,21 @@ class Gosu::DrawOpQueue
23
22
  unsigned width, height;
24
23
  };
25
24
  std::vector<ClipRect> clipRectStack;
26
- boost::optional<ClipRect> effectiveRect;
25
+ ClipRect effectiveRect;
26
+ bool haveEffectiveRect; // is effectiveRect valid?
27
+
27
28
  void updateEffectiveRect()
28
29
  {
29
30
  if (clipRectStack.empty())
30
- return effectiveRect.reset();
31
-
31
+ {
32
+ haveEffectiveRect = false;
33
+ return;
34
+ }
35
+
32
36
  ClipRect result = { 0, 0, 0x7fffffff, 0x7fffffff };
33
- BOOST_FOREACH (const ClipRect& rect, clipRectStack)
37
+ for (int i = 0; i < clipRectStack.size(); ++i)
34
38
  {
39
+ const ClipRect& rect = clipRectStack[i];
35
40
  int right = std::min<int>(result.x + result.width, rect.x + rect.width);
36
41
  int bottom = std::min<int>(result.y + result.height, rect.y + rect.height);
37
42
  result.x = std::max<int>(result.x, rect.x);
@@ -39,7 +44,7 @@ class Gosu::DrawOpQueue
39
44
 
40
45
  if (result.x >= right || result.y >= bottom)
41
46
  {
42
- effectiveRect.reset();
47
+ haveEffectiveRect = false;
43
48
  return;
44
49
  }
45
50
 
@@ -51,14 +56,18 @@ class Gosu::DrawOpQueue
51
56
  result.x *= fac, result.y *= fac, result.width *= fac, result.height *= fac;
52
57
 
53
58
  effectiveRect = result;
59
+ haveEffectiveRect = true;
54
60
  }
55
61
 
56
62
  public:
63
+ DrawOpQueue() : haveEffectiveRect(false) {}
64
+
57
65
  // I really wish I would trust ADL. :|
58
66
  void swap(DrawOpQueue& other)
59
67
  {
60
68
  clipRectStack.swap(other.clipRectStack);
61
69
  std::swap(effectiveRect, other.effectiveRect);
70
+ std::swap(haveEffectiveRect, other.haveEffectiveRect);
62
71
  ops.swap(other.ops);
63
72
  code.swap(other.code);
64
73
  }
@@ -70,13 +79,12 @@ public:
70
79
  assert (op.usedVertices == 4);
71
80
  #endif
72
81
 
73
- if (effectiveRect)
82
+ if (haveEffectiveRect)
74
83
  {
75
- const ClipRect& rect = *effectiveRect;
76
- op.clipX = rect.x;
77
- op.clipY = rect.y;
78
- op.clipWidth = rect.width;
79
- op.clipHeight = rect.height;
84
+ op.clipX = effectiveRect.x;
85
+ op.clipY = effectiveRect.y;
86
+ op.clipWidth = effectiveRect.width;
87
+ op.clipHeight = effectiveRect.height;
80
88
  }
81
89
  else if (!clipRectStack.empty())
82
90
  // When we have no effect rect but the stack is not empty, we have clipped
@@ -87,7 +95,7 @@ public:
87
95
  ops.push_back(op);
88
96
  }
89
97
 
90
- void scheduleGL(boost::function<void()> customCode, ZPos z)
98
+ void scheduleGL(std::tr1::function<void()> customCode, ZPos z)
91
99
  {
92
100
  code.insert(std::make_pair(z, customCode));
93
101
  }
@@ -110,8 +118,8 @@ public:
110
118
  // Allows us to make some assumptions.
111
119
  if (ops.empty())
112
120
  {
113
- BOOST_FOREACH (const CodeMap::value_type& fn, code)
114
- fn.second();
121
+ for (CodeMap::iterator it = code.begin(), end = code.end(); it != end; ++it)
122
+ it->second();
115
123
  return;
116
124
  }
117
125
 
@@ -179,8 +187,8 @@ public:
179
187
 
180
188
  va.reserve(ops.size());
181
189
  std::stable_sort(ops.begin(), ops.end());
182
- BOOST_FOREACH (const DrawOp& op, ops)
183
- op.compileTo(va);
190
+ for (DrawOps::const_iterator op = ops.begin(), end = ops.end(); op != end; ++op)
191
+ op->compileTo(va);
184
192
  }
185
193
  };
186
194
 
@@ -3,10 +3,10 @@
3
3
  #include <Gosu/Image.hpp>
4
4
  #include <Gosu/Math.hpp>
5
5
  #include <Gosu/Text.hpp>
6
+ #include <Gosu/TR1.hpp>
6
7
  #include <GosuImpl/Graphics/Common.hpp>
7
8
  #include <GosuImpl/Graphics/FormattedString.hpp>
8
- #include <boost/array.hpp>
9
- #include <boost/shared_ptr.hpp>
9
+ #include <cassert>
10
10
  #include <map>
11
11
  using namespace std;
12
12
 
@@ -38,16 +38,16 @@ struct Gosu::Font::Impl
38
38
  // IMPR: I couldn't find a way to determine the size of wchar_t at compile
39
39
  // time, so I can't get rid of the magic numbers or even do some #ifdef
40
40
  // magic.
41
- typedef boost::array<boost::scoped_ptr<Image>, 65536> CharChunk;
42
- boost::scoped_ptr<CharChunk> chunks[65536][ffCombinations];
41
+ typedef tr1::array<auto_ptr<Image>, 65536> CharChunk;
42
+ auto_ptr<CharChunk> chunks[65536][ffCombinations];
43
43
 
44
- std::map<std::wstring, boost::shared_ptr<Image> > entityCache;
44
+ map<wstring, tr1::shared_ptr<Image> > entityCache;
45
45
 
46
46
  const Image& imageAt(const FormattedString& fs, unsigned i)
47
47
  {
48
48
  if (fs.entityAt(i))
49
49
  {
50
- boost::shared_ptr<Image>& ptr = entityCache[fs.entityAt(i)];
50
+ tr1::shared_ptr<Image>& ptr = entityCache[fs.entityAt(i)];
51
51
  if (!ptr)
52
52
  ptr.reset(new Image(*graphics, entityBitmap(fs.entityAt(i)), false));
53
53
  return *ptr;
@@ -61,12 +61,12 @@ struct Gosu::Font::Impl
61
61
  size_t chunkIndex = wc / 65536;
62
62
  size_t charIndex = wc % 65536;
63
63
 
64
- if (!chunks[chunkIndex][flags])
64
+ if (!chunks[chunkIndex][flags].get())
65
65
  chunks[chunkIndex][flags].reset(new CharChunk);
66
66
 
67
- boost::scoped_ptr<Image>& imgPtr = (*chunks[chunkIndex][flags])[charIndex];
67
+ auto_ptr<Image>& imgPtr = (*chunks[chunkIndex][flags])[charIndex];
68
68
 
69
- if (imgPtr)
69
+ if (imgPtr.get())
70
70
  return *imgPtr;
71
71
 
72
72
  wstring charString(1, wc);
@@ -99,7 +99,7 @@ Gosu::Font::Font(Graphics& graphics, const wstring& fontName, unsigned fontHeigh
99
99
  pimpl->flags = fontFlags;
100
100
  }
101
101
 
102
- std::wstring Gosu::Font::name() const
102
+ wstring Gosu::Font::name() const
103
103
  {
104
104
  return pimpl->name;
105
105
  }
@@ -114,9 +114,9 @@ unsigned Gosu::Font::flags() const
114
114
  return pimpl->flags;
115
115
  }
116
116
 
117
- double Gosu::Font::textWidth(const std::wstring& text, double factorX) const
117
+ double Gosu::Font::textWidth(const wstring& text, double factorX) const
118
118
  {
119
- FormattedString fs(text, flags());
119
+ FormattedString fs(text.c_str(), flags());
120
120
  double result = 0;
121
121
  for (unsigned i = 0; i < fs.length(); ++i)
122
122
  result += pimpl->imageAt(fs, i).width() * pimpl->factorAt(fs, i);
@@ -126,7 +126,7 @@ double Gosu::Font::textWidth(const std::wstring& text, double factorX) const
126
126
  void Gosu::Font::draw(const wstring& text, double x, double y, ZPos z,
127
127
  double factorX, double factorY, Color c, AlphaMode mode) const
128
128
  {
129
- FormattedString fs(text, flags());
129
+ FormattedString fs(text.c_str(), flags());
130
130
 
131
131
  enum {
132
132
  LTR = 1,