/* Irrlicht Library Wrapper Created by: Nathan Adams Copyright (C) 2008 This software is licensed under the GNU/GPL. This software may not be used for commerical purposes. */ #include #include #include "IrrLibBase.h" #include #include using namespace irr; using namespace core; using namespace scene; using namespace video; using namespace io; using namespace gui; using namespace std; /* * Code from http://articles.techrepublic.com.com/5100-22-5079969.html# * struct str_stream { std::stringstream & underlying_stream() const { return m_streamOut; } operator std::string() const { return m_streamOut.str(); } private: mutable std::stringstream m_streamOut; }; template< class type> inline const str_stream & operator<< ( const str_stream & out, const type & value) { out.underlying_stream() << value; return out; } template std::string to_string( const type & value) { std::ostringstream streamOut; streamOut << value; return streamOut.str(); } * End code copy */ void IrrLibBase::SetDriver(IVideoDriver* driver) //can be overloaded { this->driver = driver; } void IrrLibBase::SetSmgr(ISceneManager* smgr) { this->smgr = smgr; } std::string IrrLibBase::wchar_to_stdstring (const wchar_t* wc) { //cout << "Starting conversion"; //wcstombs(tmp, in, 255); char c[255]; for(int t = 0; wc[t] != '\0'; t++) c[t] = (char)wc[t]; /*for(int t = 0; c[t] != '\0'; t++) wc[t] = c[t];*/ std::stringstream ss; ss << c; //cout << "Conversion OK"; return ss.str(); } std::string IrrLibBase::int_to_string (int t) { std::stringstream ss; ss << t; return ss.str(); } std::string IrrLibBase::stringw_to_stdstring(irr::core::stringw sw) { std::stringstream ss; ss << sw.c_str(); return ss.str(); } irr::core::stringw IrrLibBase::stdstring_to_stringw(std::string ss) { stringw tmpw(ss.c_str()); return tmpw; } /*void IrrLibBase::SetDevice(irr::IrrlichtDevice *device) { this->device = device; }*/ void IrrLibBase::init() { } /*irr::core::stringw int_to_stringw(int t) { std::stringstream ss; ss << t; //stringw ret(ss.str()); return ret; }*/