Sha256: 9910cb932646d4e9df13f43ca03dfb02b1b06e185660e85d90cf8e0b36e30cb9

Contents?: true

Size: 989 Bytes

Versions: 4

Compression:

Stored size: 989 Bytes

Contents

#ifndef GOSUIMPL_GRAPHICS_COMMON_HPP
#define GOSUIMPL_GRAPHICS_COMMON_HPP

#include <Gosu/Platform.hpp>

#if defined(GOSU_IS_WIN)
#include <windows.h>
#include <GL/gl.h>
#elif defined(GOSU_IS_IPHONE)
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#elif defined(GOSU_IS_MAC)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif

#include <algorithm>

namespace Gosu
{
    class Texture;
    class TexChunk;
    struct DrawOp;
    class DrawOpQueue;
    
    template<typename T>
    bool isPToTheLeftOfAB(T xa, T ya,
        T xb, T yb, T xp, T yp)
    {
        return (xb - xa) * (yp - ya) - (xp - xa) * (yb - ya) > 0;
    }
    
    template<typename T>
    void reorderCoordinatesIfNecessary(T& x1, T& y1,
        T& x2, T& y2, T& x3, T& y3, T& x4, T& y4)
    {
        if (isPToTheLeftOfAB(x1, y1, x2, y2, x3, y3) ==
            isPToTheLeftOfAB(x2, y2, x3, y3, x4, y4))
        {
            std::swap(x3, x4);
            std::swap(y3, y4);
        }
    }
}

#endif

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gosu-0.7.14 GosuImpl/Graphics/Common.hpp
gosu-0.7.13.2 GosuImpl/Graphics/Common.hpp
gosu-0.7.13.3 GosuImpl/Graphics/Common.hpp
gosu-0.7.13 GosuImpl/Graphics/Common.hpp