Ver Fonte

Removed Viewport.h/.cpp and replaced use via Rectangle class.
Updated Rectangle width/height to be unsigned int's.
Added Game::getViewport() and setViewport to allow for custom user viewports.
Refactored Form class to use Rectangle. This still need further changes by ablake for optimziations.

setaylor há 13 anos atrás
pai
commit
3fbb42bcd9

+ 0 - 2
gameplay/gameplay.vcxproj

@@ -101,7 +101,6 @@
     <ClCompile Include="src\VertexAttributeBinding.cpp" />
     <ClCompile Include="src\VertexFormat.cpp" />
     <ClCompile Include="src\VerticalLayout.cpp" />
-    <ClCompile Include="src\Viewport.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\AbsoluteLayout.h" />
@@ -192,7 +191,6 @@
     <ClInclude Include="src\VertexAttributeBinding.h" />
     <ClInclude Include="src\VertexFormat.h" />
     <ClInclude Include="src\VerticalLayout.h" />
-    <ClInclude Include="src\Viewport.h" />
   </ItemGroup>
   <ItemGroup>
     <None Include="res\logo_black.png" />

+ 0 - 6
gameplay/gameplay.vcxproj.filters

@@ -126,9 +126,6 @@
     <ClCompile Include="src\VertexFormat.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\Viewport.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\AudioController.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -395,9 +392,6 @@
     <ClInclude Include="src\VertexFormat.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\Viewport.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\AudioController.h">
       <Filter>src</Filter>
     </ClInclude>

+ 11 - 33
gameplay/src/Camera.cpp

@@ -243,24 +243,13 @@ const Frustum& Camera::getFrustum() const
     return _bounds;
 }
 
-void Camera::project(const Viewport* viewport, const Vector3& position, float* x, float* y, float* depth)
+void Camera::project(const Rectangle& viewport, const Vector3& position, float* x, float* y, float* depth)
 {
     // Determine viewport coords to use.
-    float vpx, vpy, vpw, vph;
-    if (viewport)
-    {
-        vpx = viewport->getX();
-        vpy = viewport->getY();
-        vpw = viewport->getWidth();
-        vph = viewport->getHeight();
-    }
-    else
-    {
-        vpx = 0;
-        vpy = 0;
-        vpw = Game::getInstance()->getWidth();
-        vph = Game::getInstance()->getHeight();
-    }
+    float vpx = viewport.x;
+    float vpy = viewport.y;
+    float vpw = viewport.width;
+    float vph = viewport.height;
 
     // Transform the point to clip-space.
     Vector4 clipPos;
@@ -280,24 +269,13 @@ void Camera::project(const Viewport* viewport, const Vector3& position, float* x
     }
 }
 
-void Camera::unproject(const Viewport* viewport, float x, float y, float depth, Vector3* dst)
+void Camera::unproject(const Rectangle& viewport, float x, float y, float depth, Vector3* dst)
 {
     // Determine viewport coords to use.
-    float vpx, vpy, vpw, vph;
-    if (viewport)
-    {
-        vpx = viewport->getX();
-        vpy = viewport->getY();
-        vpw = viewport->getWidth();
-        vph = viewport->getHeight();
-    }
-    else
-    {
-        vpx = 0;
-        vpy = 0;
-        vpw = Game::getInstance()->getWidth();
-        vph = Game::getInstance()->getHeight();
-    }
+    float vpx = viewport.x;
+    float vpy = viewport.y;
+    float vpw = viewport.width;
+    float vph = viewport.height;
     
     // Create our screen space position in NDC.
     Vector4 screen(
@@ -325,7 +303,7 @@ void Camera::unproject(const Viewport* viewport, float x, float y, float depth,
     dst->set(screen.x, screen.y, screen.z);
 }
 
-void Camera::pickRay(const Viewport* viewport, float x, float y, Ray* dst)
+void Camera::pickRay(const Rectangle& viewport, float x, float y, Ray* dst)
 {
     // Get the world-space position at the near clip plane.
     Vector3 nearPoint;

+ 7 - 7
gameplay/src/Camera.h

@@ -4,7 +4,7 @@
 #include "Ref.h"
 #include "Transform.h"
 #include "Frustum.h"
-#include "Viewport.h"
+#include "Rectangle.h"
 
 namespace gameplay
 {
@@ -197,13 +197,13 @@ public:
     /**
      * Projects the specified world position into the viewport coordinates.
      *
-     * @param viewport The viewport to use, or NULL to use a viewport the size of the window.
+     * @param viewport The viewport rectangle to use.
      * @param position The world space position.
      * @param x The returned viewport x coordinate.
      * @param y The returned viewport y coordinate.
      * @param depth The returned pixel depth (can be NULL).
      */
-    void project(const Viewport* viewport, const Vector3& position, float* x, float* y, float* depth = NULL);
+    void project(const Rectangle& viewport, const Vector3& position, float* x, float* y, float* depth = NULL);
 
     /**
      * Converts a viewport-space coordinate to a world-space position for the given depth value.
@@ -211,23 +211,23 @@ public:
      * The depth parameter is a value ranging between 0 and 1, where 0 returns a point on the
      * near clipping plane and 1 returns a point on the far clipping plane.
      *
-     * @param viewport The viewport to use, or NULL to use a viewport the size of the window.
+     * @param viewport The viewport rectangle to use.
      * @param x The viewport-space x coordinate.
      * @param y The viewport-space y coordinate.
      * @param depth The depth range.
      * @param dst The world space position.
      */
-    void unproject(const Viewport* viewport, float x, float y, float depth, Vector3* dst);
+    void unproject(const Rectangle& viewport, float x, float y, float depth, Vector3* dst);
 
     /**
      * Picks a ray that can be used for picking given the specified viewport-space coordinates.
      *
-     * @param viewport The viewport to use, or NULL to use a viewport the size of the window.
+     * @param viewport The viewport rectangle to use.
      * @param x The viewport x-coordinate.
      * @param y The viewport y-coordinate.
      * @param dst The computed pick ray.
      */
-    void pickRay(const Viewport* viewport, float x, float y, Ray* dst);
+    void pickRay(const Rectangle& viewport, float x, float y, Ray* dst);
 
 private:
 

+ 0 - 2
gameplay/src/Control.cpp

@@ -43,9 +43,7 @@ namespace gameplay
 
         const char* id = properties->getId();
         if (id)
-        {
             _id = id;
-        }
     }
 
     const char* Control::getID() const

+ 7 - 4
gameplay/src/Font.h

@@ -149,8 +149,8 @@ public:
      * @param rightToLeft Whether to draw text from right to left.
      * @param clip A region to clip text within after applying justification to the viewport area.
      */
-    void drawText(const char* text, const Rectangle& area, const Vector4& color,
-        unsigned int size = 0, Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false, const Rectangle* clip = NULL);
+    void drawText(const char* text, const Rectangle& area, const Vector4& color, unsigned int size = 0, 
+				  Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false, const Rectangle* clip = NULL);
 
     /**
      * Measures a string's width and height without alignment, wrapping or clipping.
@@ -217,12 +217,14 @@ private:
 
     // Utilities
     unsigned int getTokenWidth(const char* token, unsigned int length, unsigned int size, float scale);
+
     unsigned int getReversedTokenLength(const char* token, const char* bufStart);
 
     // Returns 0 if EOF was reached, 1 if delimiters were handles correctly, and 2 if the stopAtPosition was reached while handling delimiters.
     int handleDelimiters(const char** token, const unsigned int size, const int iteration, const int areaX, int* xPos, int* yPos, unsigned int* lineLength,
-                          std::vector<int>::const_iterator* xPositionsIt, std::vector<int>::const_iterator xPositionsEnd, unsigned int* charIndex = NULL,
-                          const Vector2* stopAtPosition = NULL, const int currentIndex = -1, const int destIndex = -1);
+                         std::vector<int>::const_iterator* xPositionsIt, std::vector<int>::const_iterator xPositionsEnd, unsigned int* charIndex = NULL,
+                         const Vector2* stopAtPosition = NULL, const int currentIndex = -1, const int destIndex = -1);
+
     void addLineInfo(const Rectangle& area, int lineWidth, int lineLength, Justify hAlign,
                      std::vector<int>* xPositions, std::vector<unsigned int>* lineLengths, bool rightToLeft);
 
@@ -235,6 +237,7 @@ private:
     unsigned int _glyphCount;
     Texture* _texture;
     SpriteBatch* _batch;
+	Rectangle _viewport;
 };
 
 }

+ 13 - 13
gameplay/src/Form.cpp

@@ -13,7 +13,7 @@ namespace gameplay
 {
     static std::vector<Form*> __forms;
 
-    Form::Form() : _theme(NULL), _quad(NULL), _node(NULL), _frameBuffer(NULL), _viewport(NULL)
+    Form::Form() : _theme(NULL), _quad(NULL), _node(NULL), _frameBuffer(NULL)
     {
     }
 
@@ -27,7 +27,6 @@ namespace gameplay
         SAFE_RELEASE(_node);
         SAFE_RELEASE(_frameBuffer);
         SAFE_RELEASE(_theme);
-        SAFE_DELETE(_viewport);
 
         // Remove this Form from the global list.
         std::vector<Form*>::iterator it = std::find(__forms.begin(), __forms.end(), this);
@@ -45,9 +44,7 @@ namespace gameplay
         Properties* properties = Properties::create(path);
         assert(properties);
         if (properties == NULL)
-        {
             return NULL;
-        }
 
         // Check if the Properties is valid and has a valid namespace.
         Properties* formProperties = properties->getNextNamespace();
@@ -121,14 +118,14 @@ namespace gameplay
     void Form::setQuad(const Vector3& p1, const Vector3& p2, const Vector3& p3, const Vector3& p4)
     {
         Mesh* mesh = Mesh::createQuad(p1, p2, p3, p4);
-        initQuad(mesh);
+        initializeQuad(mesh);
         SAFE_RELEASE(mesh);
     }
 
     void Form::setQuad(float x, float y, float width, float height)
     {
         Mesh* mesh = Mesh::createQuad(x, y, width, height);
-        initQuad(mesh);
+        initializeQuad(mesh);
         SAFE_RELEASE(mesh);
     }
 
@@ -143,7 +140,6 @@ namespace gameplay
 
             Matrix::createOrthographicOffCenter(0, _size.x, _size.y, 0, 0, 1, &_projectionMatrix);
             _theme->setProjectionMatrix(_projectionMatrix);
-            _viewport = new Viewport(0, 0, _size.x, _size.y);
             
             _node->setModel(_quad);
         }
@@ -171,14 +167,19 @@ namespace gameplay
             if (isDirty())
             {
                 _frameBuffer->bind();
-                _viewport->bind();
+
+				Game* game = Game::getInstance();
+				Rectangle prevViewport = game->getViewport();
+                
+				game->setViewport(Rectangle(_position.x, _position.y, _size.x, _size.y));
 
                 draw(_theme->getSpriteBatch(), _clip);
 
                 // Rebind the default framebuffer and game viewport.
                 FrameBuffer::bindDefault();
-                Game* game = Game::getInstance();
-                GL_ASSERT( glViewport(0, 0, game->getWidth(), game->getHeight()) );
+
+				// restore the previous game viewport
+				game->setViewport(prevViewport);
             }
 
             _quad->draw();
@@ -229,7 +230,7 @@ namespace gameplay
         _dirty = false;
     }
 
-    void Form::initQuad(Mesh* mesh)
+    void Form::initializeQuad(Mesh* mesh)
     {
         // Release current model.
         SAFE_RELEASE(_quad);
@@ -266,7 +267,6 @@ namespace gameplay
         Texture::Sampler* sampler = Texture::Sampler::create(_frameBuffer->getRenderTarget()->getTexture());
         sampler->setWrapMode(Texture::CLAMP, Texture::CLAMP);
         material->getParameter("u_texture")->setValue(sampler);
-
         material->getParameter("u_textureRepeat")->setValue(Vector2::one());
         material->getParameter("u_textureTransform")->setValue(Vector2::zero());
 
@@ -299,7 +299,7 @@ namespace gameplay
 
                         // Unproject point into world space.
                         Ray ray;
-                        camera->pickRay(NULL, x, y, &ray);
+						camera->pickRay(Game::getInstance()->getViewport(), x, y, &ray);
 
                         // Find the quad's plane.
                         // We know its normal is the quad's forward vector.

+ 6 - 3
gameplay/src/Form.h

@@ -22,6 +22,7 @@ class Form : public Container
     friend class Platform;
 
 public:
+
     /**
      * Create from properties file.
      * The top-most namespace in the file must be named 'form'.  The following properties are available for forms:
@@ -105,7 +106,9 @@ public:
     void draw();
 
 protected:
-    Form();
+    
+	Form();
+
     virtual ~Form();
 
     static Form* create(const char* textureFile, Layout::Type type);
@@ -115,7 +118,7 @@ protected:
      *
      * @param mesh The mesh to create a model from.
      */
-    void initQuad(Mesh* mesh);
+    void initializeQuad(Mesh* mesh);
 
     /**
      * Draw this form into the current framebuffer.
@@ -142,9 +145,9 @@ protected:
     Node* _node;                // Node for transforming this Form in world-space.
     FrameBuffer* _frameBuffer;  // FBO the Form is rendered into for texturing the quad.
     Matrix _projectionMatrix;   // Orthographic projection matrix to be set on SpriteBatch objects when rendering into the FBO.
-    Viewport* _viewport;        // Viewport for setting before rendering into the FBO.
 
 private:
+
     Form(const Form& copy);
 };
 

+ 8 - 0
gameplay/src/Game.cpp

@@ -93,6 +93,8 @@ bool Game::startup()
     if (_state != UNINITIALIZED)
         return false;
 
+	setViewport(Rectangle(0.0f, 0.0f, (float)_width, (float)_height));
+
     RenderState::initialize();
 
     _animationController = new AnimationController();
@@ -213,6 +215,12 @@ void Game::frame()
     }
 }
 
+void Game::setViewport(const Rectangle& viewport)
+{
+	_viewport = viewport;
+	glViewport((GLuint)viewport.x, (GLuint)viewport.y, (GLuint)viewport.width, (GLuint)viewport.height); 
+}
+
 void Game::clear(ClearFlags flags, const Vector4& clearColor, float clearDepth, int clearStencil)
 {
     GLbitfield bits = 0;

+ 18 - 0
gameplay/src/Game.h

@@ -10,6 +10,7 @@
 #include "AnimationController.h"
 #include "PhysicsController.h"
 #include "AudioListener.h"
+#include "Rectangle.h"
 #include "Vector4.h"
 #include "TimeListener.h"
 
@@ -151,6 +152,22 @@ public:
      */
     inline unsigned int getHeight() const;
 
+	/**
+	 * Gets the game current viewport.
+	 *
+	 * The default viewport is Rectangle(0, 0, Game::getWidth(), Game::getHeight()).
+	 */
+	inline const Rectangle& getViewport() const;
+
+	/**
+	 * Set the game current viewport.
+	 *
+	 * The x, y, width and height of the viewport must all be positive.
+	 *
+	 * viewport The custom viewport to be set on the game.
+	 */
+	void setViewport(const Rectangle& viewport);
+
     /**
      * Clears the specified resource buffers to the specified clear values. 
      *
@@ -385,6 +402,7 @@ private:
     unsigned int _frameRate;                    // The current frame rate.
     unsigned int _width;                        // The game's display width.
     unsigned int _height;                       // The game's display height.
+	Rectangle _viewport;						// the games's current viewport.
     Vector4 _clearColor;                        // The clear color value last used for clearing the color buffer.
     float _clearDepth;                          // The clear depth value last used for clearing the depth buffer.
     int _clearStencil;                          // The clear stencil value last used for clearing the stencil buffer.

+ 5 - 0
gameplay/src/Game.inl

@@ -24,6 +24,11 @@ inline unsigned int Game::getHeight() const
     return _height;
 }
 
+inline const Rectangle& Game::getViewport() const
+{
+	return _viewport;
+}
+
 inline AnimationController* Game::getAnimationController() const
 {
     return _animationController;

+ 14 - 14
gameplay/src/Rectangle.cpp

@@ -9,12 +9,12 @@ Rectangle::Rectangle()
 {
 }
 
-Rectangle::Rectangle(float width, float height) :
+Rectangle::Rectangle(unsigned int width, unsigned int height) :
     x(0), y(0), width(width), height(height)
 {
 }
 
-Rectangle::Rectangle(float x, float y, float width, float height) :
+Rectangle::Rectangle(float x, float y, unsigned int width, unsigned int height) :
     x(x), y(y), width(width), height(height)
 {
 }
@@ -44,18 +44,18 @@ void Rectangle::set(const Rectangle& r)
     set(r.x, r.y, r.width, r.height);
 }
 
-void Rectangle::set(float x, float y)
+void Rectangle::set(float x, float y, unsigned int width, unsigned int height)
 {
     this->x = x;
     this->y = y;
+    this->width = width;
+    this->height = height;
 }
 
-void Rectangle::set(float x, float y, float width, float height)
+void Rectangle::setPosition(float x, float y)
 {
     this->x = x;
     this->y = y;
-    this->width = width;
-    this->height = height;
 }
 
 float Rectangle::left() const
@@ -70,22 +70,22 @@ float Rectangle::top() const
 
 float Rectangle::right() const
 {
-    return x + width;
+    return x + (float)width;
 }
 
 float Rectangle::bottom() const
 {
-    return y + height;
+    return y + (float)height;
 }
 
 bool Rectangle::contains(float x, float y) const
 {
-    return (x >= x && x <= (x + width) && y >= y && y <= (y + height));
+    return (x >= x && x <= (x + (float)width) && y >= y && y <= (y + (float)height));
 }
 
-bool Rectangle::contains(float x, float y, float width, float height) const
+bool Rectangle::contains(float x, float y, unsigned int width, unsigned int height) const
 {
-    return (contains(x, y) && contains(x + width, y + height));
+    return (contains(x, y) && contains(x + (float)width, y + (float)height));
 }
 
 bool Rectangle::contains(const Rectangle& r) const
@@ -93,12 +93,12 @@ bool Rectangle::contains(const Rectangle& r) const
     return contains(r.x, r.y, r.width, r.height);
 }
 
-bool Rectangle::intersects(float x, float y, float width, float height) const
+bool Rectangle::intersects(float x, float y, unsigned int width, unsigned int height) const
 {
     const float left   = max(this->x, x);
     const float top    = max(this->y, y);
-    const float right  = min(x + width, x + width);
-    const float bottom = min(y + height, y + height);
+    const float right  = min(x + (float)width, x + (float)width);
+    const float bottom = min(y + (float)height, y + (float)height);
 
     return (right > left && bottom > top);
 }

+ 14 - 14
gameplay/src/Rectangle.h

@@ -25,12 +25,12 @@ public:
     /**
      * Specifies the width of the rectangle.
      */
-    float width;
+    unsigned int width;
 
     /**
      * Specifies the height of the rectangle.
      */
-    float height;
+    unsigned int height;
 
     /**
      * Constructs a new rectangle initialized to all zeros.
@@ -43,7 +43,7 @@ public:
      * @param width The width of the rectangle.
      * @param height The height of the rectangle.
      */
-    Rectangle(float width, float height);
+    Rectangle(unsigned int width, unsigned int height);
 
     /**
      * Constructs a new rectangle with the specified x, y, width and height.
@@ -53,7 +53,7 @@ public:
      * @param width The width of the rectangle.
      * @param height The height of the rectangle.
      */
-    Rectangle(float x, float y, float width, float height);
+    Rectangle(float x, float y, unsigned int width, unsigned int height);
 
     /**
      * Constructs a new rectangle that is a copy of the specified rectangle.
@@ -89,22 +89,22 @@ public:
      * @param width The width of the rectangle.
      * @param height The height of the rectangle.
      */
-    void set(float x, float y, float width, float height);
+    void set(float x, float y, unsigned int width, unsigned int height);
 
     /**
-     * Sets the x-coordinate and y-coordinate values of this rectangle to the specified values.
+     * Sets the values of this rectangle to those in the specified rectangle.
      *
-     * @param x The x-coordinate of the rectangle.
-     * @param y The y-coordinate of the rectangle.
+     * @param r The rectangle to copy.
      */
-    void set(float x, float y);
+    void set(const Rectangle& r);
 
     /**
-     * Sets the values of this rectangle to those in the specified rectangle.
+     * Sets the x-coordinate and y-coordinate values of this rectangle to the specified values.
      *
-     * @param r The rectangle to copy.
+     * @param x The x-coordinate of the rectangle.
+     * @param y The y-coordinate of the rectangle.
      */
-    void set(const Rectangle& r);
+    void setPosition(float x, float y);
 
     /**
      * Returns the x-coordinate of the left side of the rectangle.
@@ -155,7 +155,7 @@ public:
      * @return true if the rectangle contains the specified rectangle, false
      * otherwise.
      */
-    bool contains(float x, float y, float width, float height) const;
+    bool contains(float x, float y, unsigned int width, unsigned int height) const;
 
     /**
      * Determines whether this rectangle contains a specified rectangle.
@@ -177,7 +177,7 @@ public:
      * 
      * @return true if the specified Rectangle intersects with this one, false otherwise.
      */
-    bool intersects(float x, float y, float width, float height) const;
+    bool intersects(float x, float y, unsigned int width, unsigned int height) const;
 
     /**
      * Determines whether a specified rectangle intersects with this rectangle.

+ 0 - 10
gameplay/src/Scene.cpp

@@ -270,16 +270,6 @@ void Scene::bindAudioListenerToCamera(bool bind)
     }
 }
 
-const Viewport& Scene::getViewport() const
-{
-    return _viewport;
-}
-
-void Scene::setViewport(const Viewport& viewport)
-{
-    _viewport = viewport;
-}
-
 const Vector3& Scene::getAmbientColor() const
 {
     return _ambientColor;

+ 0 - 15
gameplay/src/Scene.h

@@ -142,20 +142,6 @@ public:
      */
     void bindAudioListenerToCamera(bool bind);
 
-    /**
-     * Gets the viewport for the scene.
-     *
-     * @return The scene's viewport.
-     */
-    const Viewport& getViewport() const;
-
-    /**
-     * Sets the scene's viewport.
-     *
-     * @param viewport The viewport to be set for this scene.
-     */
-    void setViewport(const Viewport& viewport);
-
     /**
      * Returns the ambient color of the scene. Black is the default color.
      * 
@@ -223,7 +209,6 @@ private:
 
     std::string _id;
     Camera* _activeCamera;
-    Viewport _viewport;
     Node* _firstNode;
     Node* _lastNode;
     unsigned int _nodeCount;

+ 0 - 86
gameplay/src/Viewport.cpp

@@ -1,86 +0,0 @@
-#include "Base.h"
-#include "Viewport.h"
-
-namespace gameplay
-{
-
-Viewport::Viewport()
-{
-}
-
-Viewport::Viewport(int x, int y, int width, int height)
-{
-    set(x, y, width, height);
-}
-
-Viewport::Viewport(const Viewport& viewport)
-{
-    set(viewport);
-}
-
-Viewport::~Viewport()
-{
-}
-
-void Viewport::set(int x, int y, int width, int height)
-{
-    _x = x;
-    _y = y;
-    _width = width;
-    _height = height;
-}
-
-void Viewport::set(const Viewport& viewport)
-{
-    _x = viewport._x;
-    _y = viewport._y;
-    _width = viewport._width;
-    _height = viewport._height;
-}
-
-int Viewport::getX() const
-{
-    return _x;
-}
-
-void Viewport::setX(int x)
-{
-    _x = x;
-}
-
-int Viewport::getY() const
-{
-    return _y;
-}
-
-void Viewport::setY(int y)
-{
-    _y = y;
-}
-
-int Viewport::getWidth() const
-{
-    return _width;
-}
-
-void Viewport::setWidth(int width)
-{
-    _width = width;
-}
-
-int Viewport::getHeight() const
-{
-    return _height;
-}
-
-void Viewport::setHeight(int height)
-{
-    _height = height;
-}
-
-void Viewport::bind()
-{
-    GL_ASSERT( glViewport(_x, _y, _width, _height) );
-}
-
-}

+ 0 - 132
gameplay/src/Viewport.h

@@ -1,132 +0,0 @@
-#ifndef VIEWPORT_H_
-#define VIEWPORT_H_
-
-namespace gameplay
-{
-
-class Camera;
-
-/**
- * Defines a rectangular viewing region used by camera the project into
- * and used by the GraphicsDevice to control the rendering region.
- */
-class Viewport
-{
-public:
-
-    /**
-     * Constructs a new viewport with all zeros.
-     */
-    Viewport();
-
-    /**
-     * Constructs a new viewport with the specified dimensions.
-     *
-     * @param x The x-coordinate of the viewport.
-     * @param y The y-coordinate of the viewport.
-     * @param width The width of the viewport.
-     * @param height The height of the viewport.
-     */
-    Viewport(int x, int y, int width, int height);
-
-    /**
-     * Constructs a new viewport from a copy.
-     *
-     * @param copy The viewport to copy.
-     */
-    Viewport(const Viewport& copy);
-
-    /**
-     * Destructor.
-     */
-    ~Viewport();
-
-    /**
-     * Sets the viewport to the specified dimensions.
-     *
-     * @param x The x-coordinate of the viewport.
-     * @param y The y-coordinate of the viewport.
-     * @param width The width of the viewport.
-     * @param height The height of the viewport.
-     */
-    void set(int x, int y, int width, int height);
-
-    /**
-     * Sets the viewport to the specified viewport copy.
-     *
-     * @param viewport The viewport to copy.
-     */
-    void set(const Viewport& viewport);
-
-    /**
-     * Gets the x-coordinate of the viewport.
-     *
-     * @return The x-coordinate of the viewport.
-     */
-    int getX() const;
-
-    /**
-     * Sets the x-coordinate of the viewport.
-     *
-     * @param x The x-coordinate of the viewport.
-     */
-    void setX(int x);
-
-    /**
-     * Gets the y-coordinate of the viewport.
-     *
-     * @return The y-coordinate of the viewport.
-     */
-    int getY() const;
-
-    /**
-     * Sets the y-coordinate of the viewport.
-     *
-     * @param y The y-coordinate of the viewport.
-     */
-    void setY(int y);
-
-    /**
-     * Gets the width of the viewport.
-     *
-     * @return The width of the viewport.
-     */
-    int getWidth() const;
-
-    /**
-     * Sets the width of the viewport.
-     *
-     * @param width The width of the viewport.
-     */
-    void setWidth(int width);
-
-    /**
-     * Gets the height of the viewport.
-     *
-     * @return The height of the viewport.
-     */
-    int getHeight() const;
-
-    /**
-     * Sets the height of the viewport.
-     *
-     * @param height The height of the viewport.
-     */
-    void setHeight(int height);
-
-    /**
-     * Makes this the active viewport for rendering.
-     */
-    void bind();
-
-private:
-
-    int _x;
-    int _y;
-    int _width;
-    int _height;
-};
-
-}
-
-#endif