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.
- data/Gosu/Async.hpp +10 -8
- data/Gosu/Audio.hpp +6 -4
- data/Gosu/AutoLink.hpp +0 -0
- data/Gosu/Bitmap.hpp +4 -5
- data/Gosu/ButtonsX.hpp +1 -1
- data/Gosu/Color.hpp +8 -8
- data/Gosu/Font.hpp +2 -2
- data/Gosu/Graphics.hpp +4 -6
- data/Gosu/IO.hpp +11 -4
- data/Gosu/Image.hpp +9 -7
- data/Gosu/ImageData.hpp +10 -4
- data/Gosu/Input.hpp +4 -5
- data/Gosu/Sockets.hpp +10 -12
- data/Gosu/TR1.hpp +44 -0
- data/Gosu/TextInput.hpp +2 -2
- data/Gosu/Version.hpp +2 -2
- data/Gosu/WinUtility.hpp +5 -6
- data/Gosu/Window.hpp +5 -6
- data/GosuImpl/Async.cpp +4 -3
- data/GosuImpl/Audio/ALChannelManagement.hpp +23 -11
- data/GosuImpl/Audio/AudioFile.hpp +11 -3
- data/GosuImpl/Audio/AudioOpenAL.cpp +613 -0
- data/GosuImpl/Audio/AudioOpenAL.mm +1 -605
- data/GosuImpl/Audio/AudioSDL.cpp +12 -14
- data/GosuImpl/Audio/AudioToolboxFile.hpp +0 -1
- data/GosuImpl/Audio/OggFile.hpp +2 -0
- data/GosuImpl/Audio/SndFile.hpp +158 -0
- data/GosuImpl/DirectoriesWin.cpp +18 -18
- data/GosuImpl/Graphics/BitmapApple.mm +17 -19
- data/GosuImpl/Graphics/BitmapBMP.cpp +7 -2
- data/GosuImpl/Graphics/BitmapFreeImage.cpp +11 -12
- data/GosuImpl/Graphics/BitmapGDIplus.cpp +35 -31
- data/GosuImpl/Graphics/BitmapUtils.cpp +1 -1
- data/GosuImpl/Graphics/BlockAllocator.cpp +7 -8
- data/GosuImpl/Graphics/BlockAllocator.hpp +3 -4
- data/GosuImpl/Graphics/Common.hpp +3 -2
- data/GosuImpl/Graphics/DrawOp.hpp +2 -3
- data/GosuImpl/Graphics/DrawOpQueue.hpp +28 -20
- data/GosuImpl/Graphics/Font.cpp +13 -13
- data/GosuImpl/Graphics/FormattedString.hpp +93 -86
- data/GosuImpl/Graphics/Graphics.cpp +16 -14
- data/GosuImpl/Graphics/Image.cpp +7 -3
- data/GosuImpl/Graphics/LargeImageData.hpp +4 -5
- data/GosuImpl/Graphics/Macro.hpp +11 -11
- data/GosuImpl/Graphics/RenderState.hpp +5 -4
- data/GosuImpl/Graphics/TexChunk.cpp +3 -3
- data/GosuImpl/Graphics/TexChunk.hpp +4 -4
- data/GosuImpl/Graphics/Text.cpp +29 -30
- data/GosuImpl/Graphics/TextMac.cpp +9 -7
- data/GosuImpl/Graphics/TextTTFWin.cpp +3 -1
- data/GosuImpl/Graphics/TextTouch.mm +0 -1
- data/GosuImpl/Graphics/TextUnix.cpp +12 -4
- data/GosuImpl/Graphics/TextWin.cpp +4 -2
- data/GosuImpl/Graphics/Texture.cpp +7 -6
- data/GosuImpl/Graphics/Texture.hpp +3 -4
- data/GosuImpl/InputMac.mm +12 -15
- data/GosuImpl/InputTouch.mm +3 -3
- data/GosuImpl/InputWin.cpp +149 -159
- data/GosuImpl/InputX.cpp +0 -0
- data/GosuImpl/MacUtility.hpp +9 -4
- data/GosuImpl/RubyGosu.swg +38 -43
- data/GosuImpl/RubyGosu_wrap.cxx +89 -96
- data/GosuImpl/Sockets/CommSocket.cpp +5 -5
- data/GosuImpl/Sockets/Sockets.hpp +4 -4
- data/GosuImpl/TimingApple.cpp +2 -3
- data/GosuImpl/Utility.cpp +18 -0
- data/GosuImpl/WinMain.cpp +0 -1
- data/GosuImpl/WinUtility.cpp +2 -2
- data/GosuImpl/WindowMac.mm +20 -17
- data/GosuImpl/WindowTouch.mm +8 -7
- data/GosuImpl/WindowWin.cpp +12 -7
- data/GosuImpl/WindowX.cpp +67 -18
- data/lib/gosu.rb +14 -12
- data/linux/extconf.rb +11 -6
- metadata +8 -7
- data/GosuImpl/Audio/AudioAudiere.cpp +0 -448
- data/GosuImpl/RubyGosu_DllMain.cxx +0 -31
| @@ -3,8 +3,7 @@ | |
| 3 3 |  | 
| 4 4 | 
             
            #include <Gosu/Fwd.hpp>
         | 
| 5 5 | 
             
            #include <Gosu/ImageData.hpp>
         | 
| 6 | 
            -
            #include < | 
| 7 | 
            -
            #include <boost/shared_ptr.hpp>
         | 
| 6 | 
            +
            #include <Gosu/TR1.hpp>
         | 
| 8 7 | 
             
            #include <vector>
         | 
| 9 8 |  | 
| 10 9 | 
             
            namespace Gosu
         | 
| @@ -12,7 +11,7 @@ namespace Gosu | |
| 12 11 | 
             
                class LargeImageData : public ImageData
         | 
| 13 12 | 
             
                {
         | 
| 14 13 | 
             
                    unsigned fullWidth, fullHeight, partsX, partsY, partWidth, partHeight;
         | 
| 15 | 
            -
                    std::vector< | 
| 14 | 
            +
                    std::vector<std::tr1::shared_ptr<ImageData> > parts;
         | 
| 16 15 |  | 
| 17 16 | 
             
                public:
         | 
| 18 17 | 
             
                    LargeImageData(Graphics& graphics, const Bitmap& source,
         | 
| @@ -27,9 +26,9 @@ namespace Gosu | |
| 27 26 | 
             
                        double x4, double y4, Color c4,
         | 
| 28 27 | 
             
                        ZPos z, AlphaMode mode) const;
         | 
| 29 28 |  | 
| 30 | 
            -
                     | 
| 29 | 
            +
                    const GLTexInfo* glTexInfo() const
         | 
| 31 30 | 
             
                    {
         | 
| 32 | 
            -
                        return  | 
| 31 | 
            +
                        return 0;
         | 
| 33 32 | 
             
                    }
         | 
| 34 33 |  | 
| 35 34 | 
             
                    Bitmap toBitmap() const;
         | 
    
        data/GosuImpl/Graphics/Macro.hpp
    CHANGED
    
    | @@ -3,13 +3,12 @@ | |
| 3 3 |  | 
| 4 4 | 
             
            #include <Gosu/Fwd.hpp>
         | 
| 5 5 | 
             
            #include <Gosu/ImageData.hpp>
         | 
| 6 | 
            +
            #include <Gosu/TR1.hpp>
         | 
| 6 7 | 
             
            #include <GosuImpl/Graphics/Common.hpp>
         | 
| 7 8 | 
             
            #include <GosuImpl/Graphics/DrawOpQueue.hpp>
         | 
| 8 | 
            -
            #include <boost/bind.hpp>
         | 
| 9 | 
            -
            #include <boost/foreach.hpp>
         | 
| 10 | 
            -
            #include <boost/scoped_ptr.hpp>
         | 
| 11 9 | 
             
            #include <cmath>
         | 
| 12 10 | 
             
            #include <algorithm>
         | 
| 11 | 
            +
            #include <memory>
         | 
| 13 12 |  | 
| 14 13 | 
             
            class Gosu::Macro : public Gosu::ImageData
         | 
| 15 14 | 
             
            {
         | 
| @@ -23,12 +22,13 @@ public: | |
| 23 22 | 
             
                {
         | 
| 24 23 | 
             
                    queue.compileTo(vertexArray);
         | 
| 25 24 | 
             
                    double left = 0, right = 0, top = 0, bottom = 0;
         | 
| 26 | 
            -
                     | 
| 25 | 
            +
                    for (VertexArray::const_iterator it = vertexArray.begin(),
         | 
| 26 | 
            +
                         end = vertexArray.end(); it != end; ++it)
         | 
| 27 27 | 
             
                    {
         | 
| 28 | 
            -
                        left | 
| 29 | 
            -
                        right | 
| 30 | 
            -
                        top | 
| 31 | 
            -
                        bottom = std::max<double>(bottom,  | 
| 28 | 
            +
                        left   = std::min<double>(left,   it->vertices[0]);
         | 
| 29 | 
            +
                        right  = std::max<double>(right,  it->vertices[0]);
         | 
| 30 | 
            +
                        top    = std::min<double>(top,    it->vertices[1]);
         | 
| 31 | 
            +
                        bottom = std::max<double>(bottom, it->vertices[1]);
         | 
| 32 32 | 
             
                    }
         | 
| 33 33 | 
             
                    w = std::ceil(right - left);
         | 
| 34 34 | 
             
                    h = std::ceil(bottom - top);
         | 
| @@ -50,7 +50,7 @@ public: | |
| 50 50 | 
             
                          double x4, double y4, Color c4,
         | 
| 51 51 | 
             
                          ZPos z, AlphaMode mode) const
         | 
| 52 52 | 
             
                {
         | 
| 53 | 
            -
                     | 
| 53 | 
            +
                    std::tr1::function<void()> f = std::tr1::bind(&Macro::realDraw, this, x1, y1, x2, y2, x3, y3);
         | 
| 54 54 | 
             
                    graphics.scheduleGL(f, z);
         | 
| 55 55 | 
             
                }
         | 
| 56 56 |  | 
| @@ -83,9 +83,9 @@ public: | |
| 83 83 | 
             
                #endif
         | 
| 84 84 | 
             
                }
         | 
| 85 85 |  | 
| 86 | 
            -
                 | 
| 86 | 
            +
                const Gosu::GLTexInfo* glTexInfo() const
         | 
| 87 87 | 
             
                {
         | 
| 88 | 
            -
                    return  | 
| 88 | 
            +
                    return 0;
         | 
| 89 89 | 
             
                }
         | 
| 90 90 |  | 
| 91 91 | 
             
                Gosu::Bitmap toBitmap() const
         | 
| @@ -34,11 +34,12 @@ public: | |
| 34 34 | 
             
                    glPopMatrix();
         | 
| 35 35 | 
             
                    glPushMatrix();
         | 
| 36 36 | 
             
                    #ifndef GOSU_IS_IPHONE
         | 
| 37 | 
            -
                    glMultMatrixd(newTransform | 
| 37 | 
            +
                    glMultMatrixd(&(*newTransform)[0]);
         | 
| 38 38 | 
             
                    #else
         | 
| 39 | 
            -
                     | 
| 40 | 
            -
                     | 
| 41 | 
            -
             | 
| 39 | 
            +
                    float matrix[16];
         | 
| 40 | 
            +
                    for (int i = 0; i < 16; ++i)
         | 
| 41 | 
            +
                        matrix[i] = (*newTransform)[i];
         | 
| 42 | 
            +
                    glMultMatrixf(matrix);
         | 
| 42 43 | 
             
                    #endif
         | 
| 43 44 | 
             
                    transform = newTransform;
         | 
| 44 45 | 
             
                }
         | 
| @@ -5,7 +5,7 @@ | |
| 5 5 | 
             
            #include <Gosu/Graphics.hpp>
         | 
| 6 6 |  | 
| 7 7 | 
             
            Gosu::TexChunk::TexChunk(Graphics& graphics, Transforms& transforms, DrawOpQueueStack& queues,
         | 
| 8 | 
            -
                 | 
| 8 | 
            +
                std::tr1::shared_ptr<Texture> texture, int x, int y, int w, int h, int padding)
         | 
| 9 9 | 
             
            :   graphics(&graphics), transforms(&transforms), queues(&queues),
         | 
| 10 10 | 
             
                texture(texture), x(x), y(y), w(w), h(h), padding(padding)
         | 
| 11 11 | 
             
            {
         | 
| @@ -48,9 +48,9 @@ void Gosu::TexChunk::draw(double x1, double y1, Color c1, | |
| 48 48 | 
             
                queues->back().scheduleDrawOp(newDrawOp, z);
         | 
| 49 49 | 
             
            }
         | 
| 50 50 |  | 
| 51 | 
            -
             | 
| 51 | 
            +
            const Gosu::GLTexInfo* Gosu::TexChunk::glTexInfo() const
         | 
| 52 52 | 
             
            {
         | 
| 53 | 
            -
                return info;
         | 
| 53 | 
            +
                return &info;
         | 
| 54 54 | 
             
            }
         | 
| 55 55 |  | 
| 56 56 | 
             
            Gosu::Bitmap Gosu::TexChunk::toBitmap() const
         | 
| @@ -3,18 +3,18 @@ | |
| 3 3 |  | 
| 4 4 | 
             
            #include <Gosu/Fwd.hpp>
         | 
| 5 5 | 
             
            #include <Gosu/ImageData.hpp>
         | 
| 6 | 
            +
            #include <Gosu/TR1.hpp>
         | 
| 6 7 | 
             
            #include <GosuImpl/Graphics/Common.hpp>
         | 
| 7 8 | 
             
            #include <memory>
         | 
| 8 9 | 
             
            #include <vector>
         | 
| 9 10 | 
             
            #include <stdexcept>
         | 
| 10 | 
            -
            #include <boost/shared_ptr.hpp>
         | 
| 11 11 |  | 
| 12 12 | 
             
            class Gosu::TexChunk : public Gosu::ImageData
         | 
| 13 13 | 
             
            {
         | 
| 14 14 | 
             
                Graphics* graphics;
         | 
| 15 15 | 
             
                Transforms* transforms;
         | 
| 16 16 | 
             
                DrawOpQueueStack* queues;
         | 
| 17 | 
            -
                 | 
| 17 | 
            +
                std::tr1::shared_ptr<Texture> texture;
         | 
| 18 18 | 
             
                int x, y, w, h, padding;
         | 
| 19 19 |  | 
| 20 20 | 
             
                // Cached for faster access.
         | 
| @@ -22,7 +22,7 @@ class Gosu::TexChunk : public Gosu::ImageData | |
| 22 22 |  | 
| 23 23 | 
             
            public:
         | 
| 24 24 | 
             
                TexChunk(Graphics& graphics, Transforms& transforms, DrawOpQueueStack& queues,
         | 
| 25 | 
            -
                          | 
| 25 | 
            +
                         std::tr1::shared_ptr<Texture> texture, int x, int y, int w, int h, int padding);
         | 
| 26 26 | 
             
                ~TexChunk();
         | 
| 27 27 |  | 
| 28 28 | 
             
                unsigned int width() const
         | 
| @@ -54,7 +54,7 @@ public: | |
| 54 54 | 
             
                    double x4, double y4, Color c4,
         | 
| 55 55 | 
             
                    ZPos z, AlphaMode mode) const;
         | 
| 56 56 |  | 
| 57 | 
            -
                 | 
| 57 | 
            +
                const GLTexInfo* glTexInfo() const;
         | 
| 58 58 | 
             
                Gosu::Bitmap toBitmap() const;
         | 
| 59 59 | 
             
                void insert(const Bitmap& bitmap, int x, int y);
         | 
| 60 60 | 
             
            };
         | 
    
        data/GosuImpl/Graphics/Text.cpp
    CHANGED
    
    | @@ -3,13 +3,10 @@ | |
| 3 3 | 
             
            #include <Gosu/Graphics.hpp>
         | 
| 4 4 | 
             
            #include <Gosu/Image.hpp>
         | 
| 5 5 | 
             
            #include <Gosu/Math.hpp>
         | 
| 6 | 
            +
            #include <Gosu/TR1.hpp>
         | 
| 6 7 | 
             
            #include <Gosu/Utility.hpp>
         | 
| 7 8 | 
             
            #include <GosuImpl/Graphics/Common.hpp>
         | 
| 8 9 | 
             
            #include <GosuImpl/Graphics/FormattedString.hpp>
         | 
| 9 | 
            -
            #include <boost/algorithm/string.hpp>
         | 
| 10 | 
            -
            #include <boost/bind.hpp>
         | 
| 11 | 
            -
            #include <boost/foreach.hpp>
         | 
| 12 | 
            -
            #include <boost/shared_ptr.hpp>
         | 
| 13 10 | 
             
            #include <cassert>
         | 
| 14 11 | 
             
            #include <cmath>
         | 
| 15 12 | 
             
            #include <algorithm>
         | 
| @@ -104,10 +101,10 @@ namespace Gosu | |
| 104 101 | 
             
                            if (text.entityAt(0))
         | 
| 105 102 | 
             
                                return entityBitmap(text.entityAt(0)).width();
         | 
| 106 103 |  | 
| 107 | 
            -
                             | 
| 104 | 
            +
                            vector<FormattedString> parts = text.splitParts();
         | 
| 108 105 | 
             
                            unsigned result = 0;
         | 
| 109 | 
            -
                             | 
| 110 | 
            -
                                result += Gosu::textWidth( | 
| 106 | 
            +
                            for (unsigned i = 0; i < parts.size(); ++i)
         | 
| 107 | 
            +
                                result += Gosu::textWidth(parts[i].unformat(), fontName, fontHeight, parts[i].flagsAt(0));
         | 
| 111 108 | 
             
                            return result;
         | 
| 112 109 | 
             
                        }
         | 
| 113 110 |  | 
| @@ -145,13 +142,15 @@ namespace Gosu | |
| 145 142 | 
             
                            default:
         | 
| 146 143 | 
             
                                pos = 0;
         | 
| 147 144 | 
             
                            }
         | 
| 148 | 
            -
             | 
| 145 | 
            +
                            
         | 
| 149 146 | 
             
                            for (Words::const_iterator cur = begin; cur != end; ++cur)
         | 
| 150 147 | 
             
                            {
         | 
| 151 | 
            -
                                 | 
| 148 | 
            +
                                vector<FormattedString> parts = cur->text.splitParts();
         | 
| 152 149 | 
             
                                int x = 0;
         | 
| 153 | 
            -
                                 | 
| 150 | 
            +
                                for (int i = 0; i < parts.size(); ++i)
         | 
| 154 151 | 
             
                                {
         | 
| 152 | 
            +
                                    FormattedString& part = parts[i];
         | 
| 153 | 
            +
                                    
         | 
| 155 154 | 
             
                                    if (part.entityAt(0))
         | 
| 156 155 | 
             
                                    {
         | 
| 157 156 | 
             
                                        Gosu::Bitmap entity = entityBitmap(part.entityAt(0));
         | 
| @@ -161,7 +160,7 @@ namespace Gosu | |
| 161 160 | 
             
                                        continue;
         | 
| 162 161 | 
             
                                    }
         | 
| 163 162 |  | 
| 164 | 
            -
                                     | 
| 163 | 
            +
                                    wstring unformattedPart = part.unformat();
         | 
| 165 164 | 
             
                                    drawText(bmp, unformattedPart, trunc(pos) + x, trunc(top),
         | 
| 166 165 | 
             
                                        part.colorAt(0), fontName, fontHeight, part.flagsAt(0));
         | 
| 167 166 | 
             
                                    x += Gosu::textWidth(unformattedPart, fontName, fontHeight,
         | 
| @@ -294,20 +293,20 @@ namespace Gosu | |
| 294 293 | 
             
                    void processText(TextBlockBuilder& builder, const FormattedString& text)
         | 
| 295 294 | 
             
                    {
         | 
| 296 295 | 
             
                        vector<FormattedString> paragraphs = text.splitLines();
         | 
| 297 | 
            -
                         | 
| 298 | 
            -
                            processParagraph(builder,  | 
| 296 | 
            +
                        for (int i = 0; i < paragraphs.size(); ++i)
         | 
| 297 | 
            +
                            processParagraph(builder, paragraphs[i]);
         | 
| 299 298 | 
             
                    }
         | 
| 300 299 | 
             
                }
         | 
| 301 300 | 
             
            }
         | 
| 302 301 |  | 
| 303 | 
            -
            Gosu::Bitmap Gosu::createText(const  | 
| 304 | 
            -
                const  | 
| 302 | 
            +
            Gosu::Bitmap Gosu::createText(const wstring& text,
         | 
| 303 | 
            +
                const wstring& fontName, unsigned fontHeight, int lineSpacing,
         | 
| 305 304 | 
             
                unsigned maxWidth, TextAlign align, unsigned fontFlags)
         | 
| 306 305 | 
             
            {
         | 
| 307 306 | 
             
                if (lineSpacing <= -static_cast<int>(fontHeight))
         | 
| 308 | 
            -
                    throw  | 
| 307 | 
            +
                    throw logic_error("negative line spacing of more than line height impossible");
         | 
| 309 308 |  | 
| 310 | 
            -
                FormattedString fs( | 
| 309 | 
            +
                FormattedString fs(text.c_str(), fontFlags);
         | 
| 311 310 | 
             
                if (fs.length() == 0)
         | 
| 312 311 | 
             
                    return Bitmap(maxWidth, fontHeight);
         | 
| 313 312 |  | 
| @@ -323,10 +322,10 @@ Gosu::Bitmap Gosu::createText(const std::wstring& text, | |
| 323 322 | 
             
            }
         | 
| 324 323 |  | 
| 325 324 | 
             
            // Very easy special case.
         | 
| 326 | 
            -
            Gosu::Bitmap Gosu::createText(const  | 
| 327 | 
            -
                const  | 
| 325 | 
            +
            Gosu::Bitmap Gosu::createText(const wstring& text,
         | 
| 326 | 
            +
                const wstring& fontName, unsigned fontHeight, unsigned fontFlags)
         | 
| 328 327 | 
             
            {
         | 
| 329 | 
            -
                FormattedString fs( | 
| 328 | 
            +
                FormattedString fs(text.c_str(), fontFlags);
         | 
| 330 329 | 
             
                if (fs.length() == 0)
         | 
| 331 330 | 
             
                    return Bitmap(1, fontHeight);
         | 
| 332 331 |  | 
| @@ -340,7 +339,7 @@ Gosu::Bitmap Gosu::createText(const std::wstring& text, | |
| 340 339 | 
             
                        continue;
         | 
| 341 340 |  | 
| 342 341 | 
             
                    unsigned x = 0;
         | 
| 343 | 
            -
                     | 
| 342 | 
            +
                    vector<FormattedString> parts = lines[i].splitParts();
         | 
| 344 343 | 
             
                    for (int p = 0; p < parts.size(); ++p)
         | 
| 345 344 | 
             
                    {
         | 
| 346 345 | 
             
                        const FormattedString& part = parts[p];
         | 
| @@ -348,17 +347,17 @@ Gosu::Bitmap Gosu::createText(const std::wstring& text, | |
| 348 347 | 
             
                        {
         | 
| 349 348 | 
             
                            Gosu::Bitmap entity = entityBitmap(part.entityAt(0));
         | 
| 350 349 | 
             
                            multiplyBitmapAlpha(entity, part.colorAt(0).alpha());
         | 
| 351 | 
            -
                            bmp.resize( | 
| 350 | 
            +
                            bmp.resize(max(bmp.width(), x + entity.width()), bmp.height());
         | 
| 352 351 | 
             
                            bmp.insert(entity, x, i * fontHeight);
         | 
| 353 352 | 
             
                            x += entity.width();
         | 
| 354 353 | 
             
                            continue;
         | 
| 355 354 | 
             
                        }
         | 
| 356 355 |  | 
| 357 356 | 
             
                        assert(part.length() > 0);
         | 
| 358 | 
            -
                         | 
| 357 | 
            +
                        wstring unformattedText = part.unformat();
         | 
| 359 358 | 
             
                        unsigned partWidth =
         | 
| 360 359 | 
             
                            textWidth(unformattedText, fontName, fontHeight, part.flagsAt(0));
         | 
| 361 | 
            -
                        bmp.resize( | 
| 360 | 
            +
                        bmp.resize(max(bmp.width(), x + partWidth), bmp.height());
         | 
| 362 361 | 
             
                        drawText(bmp, unformattedText, x, i * fontHeight, part.colorAt(0),
         | 
| 363 362 | 
             
                            fontName, fontHeight, part.flagsAt(0));
         | 
| 364 363 | 
             
                        x += partWidth;
         | 
| @@ -370,23 +369,23 @@ Gosu::Bitmap Gosu::createText(const std::wstring& text, | |
| 370 369 |  | 
| 371 370 | 
             
            namespace
         | 
| 372 371 | 
             
            {
         | 
| 373 | 
            -
                 | 
| 372 | 
            +
                map<wstring, tr1::shared_ptr<Gosu::Bitmap> > entities;
         | 
| 374 373 | 
             
            }
         | 
| 375 374 |  | 
| 376 | 
            -
            void Gosu::registerEntity(const  | 
| 375 | 
            +
            void Gosu::registerEntity(const wstring& name, const Gosu::Bitmap& replacement)
         | 
| 377 376 | 
             
            {
         | 
| 378 377 | 
             
                entities[name].reset(new Bitmap(replacement));
         | 
| 379 378 | 
             
            }
         | 
| 380 379 |  | 
| 381 | 
            -
            bool Gosu::isEntity(const  | 
| 380 | 
            +
            bool Gosu::isEntity(const wstring& name)
         | 
| 382 381 | 
             
            {
         | 
| 383 382 | 
             
                return entities[name];
         | 
| 384 383 | 
             
            }
         | 
| 385 384 |  | 
| 386 | 
            -
            const Gosu::Bitmap& Gosu::entityBitmap(const  | 
| 385 | 
            +
            const Gosu::Bitmap& Gosu::entityBitmap(const wstring& name)
         | 
| 387 386 | 
             
            {
         | 
| 388 | 
            -
                 | 
| 387 | 
            +
                tr1::shared_ptr<Gosu::Bitmap>& ptr = entities[name];
         | 
| 389 388 | 
             
                if (!ptr)
         | 
| 390 | 
            -
                    throw  | 
| 389 | 
            +
                    throw runtime_error("Unknown entity: " + Gosu::wstringToUTF8(name));
         | 
| 391 390 | 
             
                return *ptr;
         | 
| 392 391 | 
             
            }
         | 
| @@ -4,11 +4,10 @@ | |
| 4 4 |  | 
| 5 5 | 
             
            #include <Gosu/Bitmap.hpp>
         | 
| 6 6 | 
             
            #include <Gosu/Text.hpp>
         | 
| 7 | 
            +
            #include <Gosu/TR1.hpp>
         | 
| 7 8 | 
             
            #include <Gosu/Utility.hpp>
         | 
| 8 9 | 
             
            #include <Gosu/IO.hpp>
         | 
| 9 10 | 
             
            #include <GosuImpl/MacUtility.hpp>
         | 
| 10 | 
            -
            #include <boost/utility.hpp>
         | 
| 11 | 
            -
            #include <boost/cstdint.hpp>
         | 
| 12 11 | 
             
            #include <cmath>
         | 
| 13 12 | 
             
            #include <stdexcept>
         | 
| 14 13 | 
             
            #include <map>
         | 
| @@ -29,17 +28,20 @@ namespace Gosu | |
| 29 28 |  | 
| 30 29 | 
             
            namespace
         | 
| 31 30 | 
             
            {
         | 
| 32 | 
            -
                class MacBitmap | 
| 31 | 
            +
                class MacBitmap
         | 
| 33 32 | 
             
                {
         | 
| 34 | 
            -
                     | 
| 33 | 
            +
                    std::tr1::uint32_t* buf;
         | 
| 35 34 | 
             
                    unsigned width, height;
         | 
| 36 35 | 
             
                    CGContextRef ctx;
         | 
| 36 | 
            +
                    
         | 
| 37 | 
            +
                    MacBitmap(const MacBitmap&);
         | 
| 38 | 
            +
                    MacBitmap& operator=(const MacBitmap&);
         | 
| 37 39 |  | 
| 38 40 | 
             
                public:
         | 
| 39 | 
            -
                    MacBitmap( | 
| 41 | 
            +
                    MacBitmap(std::tr1::uint32_t* buf, unsigned width, unsigned height)
         | 
| 40 42 | 
             
                    : buf(buf), width(width), height(height)
         | 
| 41 43 | 
             
                    {
         | 
| 42 | 
            -
                        CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName( | 
| 44 | 
            +
                        CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); 
         | 
| 43 45 | 
             
                        ctx = CGBitmapContextCreate (buf, width, height, 8, width * 4, colorSpace,
         | 
| 44 46 | 
             
                            kCGImageAlphaPremultipliedLast);
         | 
| 45 47 |  | 
| @@ -224,7 +226,7 @@ void Gosu::drawText(Bitmap& bitmap, const std::wstring& text, int x, int y, | |
| 224 226 | 
             
                ATSULayoutAndStyle atlas(text, fontName, fontHeight, fontFlags);
         | 
| 225 227 | 
             
                Rect rect = atlas.textExtents();
         | 
| 226 228 | 
             
                unsigned width = rect.right + 1 - rect.left + 1; // add one pixel on OS X
         | 
| 227 | 
            -
                std::vector< | 
| 229 | 
            +
                std::vector<std::tr1::uint32_t> buf(width * fontHeight);
         | 
| 228 230 | 
             
                {
         | 
| 229 231 | 
             
                    MacBitmap helper(&buf[0], width, fontHeight);
         | 
| 230 232 | 
             
                    atlas.drawToContext(X2Fix(-rect.left), X2Fix(fontHeight / font.heightAt1Pt * font.descentAt1Pt),
         | 
| @@ -1,4 +1,6 @@ | |
| 1 1 | 
             
            #include <windows.h>
         | 
| 2 | 
            +
            #include <cassert>
         | 
| 3 | 
            +
            #include <cstdio>
         | 
| 2 4 | 
             
            #include <Gosu/Utility.hpp>
         | 
| 3 5 |  | 
| 4 6 | 
             
            // Adapted from http://www.codeproject.com/KB/GDI/xfont.aspx.
         | 
| @@ -197,7 +199,7 @@ std::wstring getNameFromTTFFile(const std::wstring& filename) | |
| 197 199 |  | 
| 198 200 | 
             
            				if (szTemp[0] != 0)
         | 
| 199 201 | 
             
            				{
         | 
| 200 | 
            -
            					 | 
| 202 | 
            +
            					assert (strlen(szTemp) < sizeof(lpFontProps->csName));
         | 
| 201 203 |  | 
| 202 204 | 
             
            					switch (ttRecord.uNameID)
         | 
| 203 205 | 
             
            					{
         | 
| @@ -7,7 +7,6 @@ | |
| 7 7 | 
             
            #include <glib.h>
         | 
| 8 8 | 
             
            #include <SDL/SDL_ttf.h>
         | 
| 9 9 |  | 
| 10 | 
            -
            #include <boost/utility.hpp>
         | 
| 11 10 | 
             
            #include <string>
         | 
| 12 11 | 
             
            #include <cstring>
         | 
| 13 12 | 
             
            #include <stdexcept>
         | 
| @@ -21,8 +20,11 @@ namespace Gosu | |
| 21 20 | 
             
            {
         | 
| 22 21 | 
             
                // Used for system fonts
         | 
| 23 22 | 
             
                // Adapted from original version by Jan Lücker
         | 
| 24 | 
            -
                class PangoRenderer | 
| 23 | 
            +
                class PangoRenderer
         | 
| 25 24 | 
             
                {
         | 
| 25 | 
            +
                    PangoRenderer(const PangoRenderer&);
         | 
| 26 | 
            +
                    PangoRenderer& operator=(const PangoRenderer&);
         | 
| 27 | 
            +
                    
         | 
| 26 28 | 
             
                    int width, height;
         | 
| 27 29 |  | 
| 28 30 | 
             
                    PangoContext* context;
         | 
| @@ -161,12 +163,18 @@ namespace Gosu | |
| 161 163 |  | 
| 162 164 | 
             
                // Used for custom TTF files
         | 
| 163 165 | 
             
                // Adapted from customFont class by José Tomás Tocino García (TheOm3ga)
         | 
| 164 | 
            -
                class SDLTTFRenderer | 
| 166 | 
            +
                class SDLTTFRenderer
         | 
| 165 167 | 
             
                {
         | 
| 168 | 
            +
                    SDLTTFRenderer(const SDLTTFRenderer&);
         | 
| 169 | 
            +
                    SDLTTFRenderer& operator=(const SDLTTFRenderer&);
         | 
| 170 | 
            +
                    
         | 
| 166 171 | 
             
                    TTF_Font* font;
         | 
| 167 172 |  | 
| 168 | 
            -
                    class SDLSurface | 
| 173 | 
            +
                    class SDLSurface
         | 
| 169 174 | 
             
                    {
         | 
| 175 | 
            +
                        SDLSurface(const SDLSurface&);
         | 
| 176 | 
            +
                        SDLSurface& operator=(const SDLSurface&);
         | 
| 177 | 
            +
                        
         | 
| 170 178 | 
             
                        SDL_Surface* surface;
         | 
| 171 179 |  | 
| 172 180 | 
             
                    public:
         | 
| @@ -5,7 +5,6 @@ | |
| 5 5 | 
             
            #include <Gosu/Text.hpp>
         | 
| 6 6 | 
             
            #include <Gosu/Utility.hpp>
         | 
| 7 7 | 
             
            #include <Gosu/WinUtility.hpp>
         | 
| 8 | 
            -
            #include <boost/utility.hpp>
         | 
| 9 8 | 
             
            #include <cstdlib>
         | 
| 10 9 | 
             
            #include <cwchar>
         | 
| 11 10 | 
             
            #include <algorithm>
         | 
| @@ -27,8 +26,11 @@ namespace Gosu | |
| 27 26 |  | 
| 28 27 | 
             
                namespace
         | 
| 29 28 | 
             
                {
         | 
| 30 | 
            -
                    class WinBitmap | 
| 29 | 
            +
                    class WinBitmap
         | 
| 31 30 | 
             
                    {
         | 
| 31 | 
            +
                        WinBitmap(const WinBitmap&);
         | 
| 32 | 
            +
                        WinBitmap& operator=(const WinBitmap&);
         | 
| 33 | 
            +
                        
         | 
| 32 34 | 
             
                        HDC dc;
         | 
| 33 35 | 
             
                        HBITMAP bitmap;
         | 
| 34 36 | 
             
                        char* pixels;
         |