/***************************************************************************
 *   Copyright (C) 2004-2005 by                                            *
 *     Paolo Sacconier   <axa1981@tin.it>                                  *
 *     Francesco Tamagni <minchiahead@hacari.org>                          *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef GILLOVIEWPORT_H
#define GILLOVIEWPORT_H

#include "main.h"
#include "camera.h"

namespace gillo {

/**
@author ,,,
*/
class Viewport{
	float w;
	float h;
	float x;
	float y;
	Camera* cameraPtr;
	bool visible;
	
public:
    Viewport(float x, float y, float w, float h, Camera* cPtr);

    ~Viewport();
	
	void changeCameraPtr(Camera* cPtr);
	inline void draw(int width, int height) { 
		glViewport(GLint(x*width), GLint(y*height), GLint(w*width), GLint(h*height));
		if(cameraPtr!=NULL) 
			cameraPtr->set(); 
	}
	inline void update(float dt)	{ if (cameraPtr != NULL) cameraPtr->update(dt); }
	inline bool isVisible() { return visible; }
	inline void setVisible(bool v) { visible = v; }
	inline Camera* getCameraPtr() { return cameraPtr; }
};

};

#endif
