Fixed getColorFormat for SDL device and compiler errors.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1386 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2008-06-16 14:20:24 +00:00
parent 0874600315
commit 67da89e32c
3 changed files with 40 additions and 2 deletions

View File

@ -5,6 +5,8 @@
#ifndef __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__ #ifndef __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
#define __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__ #define __I_IRRLICHT_CREATION_PARAMETERS_H_INCLUDED__
#include "EDriverTypes.h"
namespace irr namespace irr
{ {
class IEventReceiver; class IEventReceiver;

View File

@ -25,7 +25,7 @@ namespace irr
{ {
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
io::IFileSystem* io); io::IFileSystem* io);
} } // end namespace video
} // end namespace irr } // end namespace irr
@ -104,7 +104,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
CIrrDeviceSDL::~CIrrDeviceSDL() CIrrDeviceSDL::~CIrrDeviceSDL()
{ {
// only free surfaces created by us // only free surfaces created by us
if (Screen && !param.WindowId) if (Screen && !CreationParams.WindowId)
SDL_FreeSurface(Screen); SDL_FreeSurface(Screen);
SDL_Quit(); SDL_Quit();
} }
@ -415,12 +415,39 @@ bool CIrrDeviceSDL::isWindowMinimized() const
} }
//! returns color format of the window.
video::ECOLOR_FORMAT CIrrDeviceSDL::getColorFormat() const
{
if (Screen)
{
if (Screen->format->BitsPerPixel==16)
{
if (Screen->format->Amask != 0)
return video::ECF_A1R5G5B5;
else
return video::ECF_R5G6B5;
}
else
{
if (Screen->format->Amask != 0)
return video::ECF_A8R8G8B8;
else
return video::ECF_R8G8B8;
}
}
else
return CIrrDeviceStub::getColorFormat();
}
void CIrrDeviceSDL::createKeyMap() void CIrrDeviceSDL::createKeyMap()
{ {
// I don't know if this is the best method to create // I don't know if this is the best method to create
// the lookuptable, but I'll leave it like that until // the lookuptable, but I'll leave it like that until
// I find a better version. // I find a better version.
KeyMap.reallocate(105);
// buttons missing // buttons missing
KeyMap.push_back(SKeyMap(SDLK_BACKSPACE, KEY_BACK)); KeyMap.push_back(SKeyMap(SDLK_BACKSPACE, KEY_BACK));

View File

@ -46,6 +46,15 @@ namespace irr
//! returns if window is active. if not, nothing need to be drawn //! returns if window is active. if not, nothing need to be drawn
virtual bool isWindowActive() const; virtual bool isWindowActive() const;
//! returns if window has focus.
bool isWindowFocused() const;
//! returns if window is minimized.
bool isWindowMinimized() const;
//! returns color format of the window.
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);