Added getColorFormat methods, currently only method stubs.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1385 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2008-06-16 10:06:04 +00:00
parent 8d4c92a751
commit 0874600315
8 changed files with 47 additions and 10 deletions

View File

@ -77,9 +77,6 @@ namespace video
{ {
public: public:
//! Destructor
virtual ~IVideoDriver() {}
//! Applications must call this method before performing any rendering. //! Applications must call this method before performing any rendering.
/** This method can clear the back- and the z-buffer. /** This method can clear the back- and the z-buffer.
\param backBuffer Specifies if the back buffer should be \param backBuffer Specifies if the back buffer should be
@ -639,7 +636,11 @@ namespace video
f32 density=0.01f, f32 density=0.01f,
bool pixelFog=false, bool rangeFog=false) = 0; bool pixelFog=false, bool rangeFog=false) = 0;
//! Returns the size of the screen or render window. //! Get the current color format of the color buffer
/** \return Color format of the color buffer. */
virtual ECOLOR_FORMAT getColorFormat() const = 0;
//! Get the size of the screen or render window.
/** \return Size of screen or render window. */ /** \return Size of screen or render window. */
virtual const core::dimension2d<s32>& getScreenSize() const = 0; virtual const core::dimension2d<s32>& getScreenSize() const = 0;

View File

@ -163,6 +163,10 @@ namespace irr
/** \return True if window is fullscreen. */ /** \return True if window is fullscreen. */
virtual bool isFullscreen() const = 0; virtual bool isFullscreen() const = 0;
//! Get the current color format of the window
/** \return Color format of the window. */
virtual video::ECOLOR_FORMAT getColorFormat() const = 0;
//! Notifies the device that it should close itself. //! Notifies the device that it should close itself.
/** IrrlichtDevice::run() will always return false after closeDevice() was called. */ /** IrrlichtDevice::run() will always return false after closeDevice() was called. */
virtual void closeDevice() = 0; virtual void closeDevice() = 0;

View File

@ -452,12 +452,12 @@ bool CIrrDeviceLinux::createWindow()
int visNumber; // Return value of available visuals int visNumber; // Return value of available visuals
visTempl.screen = screennr; visTempl.screen = screennr;
visTempl.depth = 16; visTempl.depth = 32;
while ((!visual) && (visTempl.depth<=32)) while ((!visual) && (visTempl.depth>=16))
{ {
visual = XGetVisualInfo(display, VisualScreenMask|VisualDepthMask, visual = XGetVisualInfo(display, VisualScreenMask|VisualDepthMask,
&visTempl, &visNumber); &visTempl, &visNumber);
visTempl.depth+=8; visTempl.depth-=8;
} }
} }
@ -1028,6 +1028,16 @@ bool CIrrDeviceLinux::isWindowMinimized() const
} }
//! returns color format of the window.
video::ECOLOR_FORMAT CIrrDeviceLinux::getColorFormat() const
{
if (visual && (visual->depth != 16))
return video::ECF_R8G8B8;
else
return video::ECF_R5G6B5;
}
//! Sets if the window should be resizeable in windowed mode. //! Sets if the window should be resizeable in windowed mode.
void CIrrDeviceLinux::setResizeAble(bool resize) void CIrrDeviceLinux::setResizeAble(bool resize)
{ {

View File

@ -74,6 +74,9 @@ namespace irr
//! returns if window is minimized. //! returns if window is minimized.
virtual bool isWindowMinimized() const; virtual bool isWindowMinimized() const;
//! returns color format of the window.
virtual video::ECOLOR_FORMAT getColorFormat() const;
//! presents a surface in the client area //! presents a surface in the client area
virtual void present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0 ); virtual void present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0 );

View File

@ -241,5 +241,12 @@ bool CIrrDeviceStub::isFullscreen() const
} }
//! returns color format
video::ECOLOR_FORMAT CIrrDeviceStub::getColorFormat() const
{
return video::ECF_R5G6B5;
}
} // end namespace irr } // end namespace irr

View File

@ -104,6 +104,9 @@ namespace irr
//! Checks if the window is running in fullscreen mode. //! Checks if the window is running in fullscreen mode.
virtual bool isFullscreen() const; virtual bool isFullscreen() const;
//! get color format of the current window
virtual video::ECOLOR_FORMAT getColorFormat() const;
protected: protected:
void createGUIAndScene(); void createGUIAndScene();

View File

@ -707,6 +707,11 @@ void CNullDriver::draw2DPolygon(core::position2d<s32> center,
} }
//! returns color format
ECOLOR_FORMAT CNullDriver::getColorFormat() const
{
return ECF_R5G6B5;
}
//! returns screen size //! returns screen size
@ -715,6 +720,7 @@ const core::dimension2d<s32>& CNullDriver::getScreenSize() const
return ScreenSize; return ScreenSize;
} }
//! returns the current render target size, //! returns the current render target size,
//! or the screen size if render targets are not implemented //! or the screen size if render targets are not implemented
const core::dimension2d<s32>& CNullDriver::getCurrentRenderTargetSize() const const core::dimension2d<s32>& CNullDriver::getCurrentRenderTargetSize() const

View File

@ -183,13 +183,16 @@ namespace video
f32 start=50.0f, f32 end=100.0f, f32 start=50.0f, f32 end=100.0f,
f32 density=0.01f, bool pixelFog=false, bool rangeFog=false); f32 density=0.01f, bool pixelFog=false, bool rangeFog=false);
//! returns screen size //! get color format of the current color buffer
virtual ECOLOR_FORMAT getColorFormat() const;
//! get screen size
virtual const core::dimension2d<s32>& getScreenSize() const; virtual const core::dimension2d<s32>& getScreenSize() const;
//! returns screen size //! get render target size
virtual const core::dimension2d<s32>& getCurrentRenderTargetSize() const; virtual const core::dimension2d<s32>& getCurrentRenderTargetSize() const;
// returns current frames per second value // get current frames per second value
virtual s32 getFPS() const; virtual s32 getFPS() const;
//! returns amount of primitives (mostly triangles) were drawn in the last frame. //! returns amount of primitives (mostly triangles) were drawn in the last frame.