/***************************************************************************
*   Copyright (C) 2004 by Denis A. Birukov aka Messenger of death         *
*   riper@fromru.com                                                      *
*                                                                         *
*   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.             *
***************************************************************************/
#include "me_c_video.h"
#include "me_c_video_driver_interface.h"
#include "me_debug.h"
#include "me_c_video_features.h"
#include "me_c_opengl_video_driver.h"

ME_n_Video::ME_c_Video_Driver_Interface *_video_drv_;

/*!
    \fn ME_n_Video::ME_c_Video::_init_video(ME_c_Video_Driver_Interface* drv)
 */
bool ME_n_Video::ME_c_Video::_init_video( ME_c_Video_Driver_Interface* drv )
{
	_video_drv_ = drv;
	return _video_drv_->_init();
}


/*!
    \fn ME_n_Video::ME_c_Video::_init_video(std::string name)
 */
bool ME_n_Video::ME_c_Video::_init_video( std::string name )
{
	_video_drv_ = new ME_c_OpenGL_Video_Driver;
	return true;
/*	ME_n_Log::_debug( ME_n_Log::ME_DEBUG_INFO ) << __FILE__ << ":" << __LINE__ << "-ME_c_Video: initializing video from library " << name << std::endl;

	ME_n_Dynamic_Module::ME_c_Dynamic_Module_Interface Dynamic_Module;

	_video_drv_ = ( ME_c_Video_Driver_Interface * ) ( ( ME_c_Video_Driver_Interface * ( * ) ( void ) ) ( Dynamic_Module[ name ] ) [ "_create_video_driver" ] ) ();
	return _video_drv_->_init();*/
}


/*!
    \fn ME_n_Video::ME_c_Video::operator->()
 */
ME_n_Video::ME_c_Video_Driver_Interface& ME_n_Video::ME_c_Video::ME_c_Video::operator->()
{
	return * _video_drv_;
}
/*!
    \fn ME_n_Video::ME_c_Video::operator*()
 */
ME_n_Video::ME_c_Video_Driver_Interface& ME_n_Video::ME_c_Video::ME_c_Video::operator*()
{
	return * _video_drv_;
}


/*!
    \fn ME_n_Video::ME_c_Video::_get_driver_name()
 */
std::string ME_n_Video::ME_c_Video::_get_driver_name()
{
	if ( _video_drv_ != NULL ) return _video_drv_->_get_driver_name();
	return "nodriver";
}


/*!
    \fn ME_n_Video::ME_c_Video::_deinit_video()
 */
void ME_n_Video::ME_c_Video::ME_c_Video::_deinit_video()
{
	_video_drv_->_deinit();
	delete _video_drv_;
}
/*!
    \fn ME_n_Video::ME_c_Video::_get_features()
 */
ME_n_Video::ME_c_Video_Features ME_n_Video::ME_c_Video::_get_features( )
{
	return _video_drv_->_get_features();
}
