Public Member Functions | Protected Member Functions | Protected Attributes

sp::SoftPixelDevice Class Reference

SoftPixel Engine device interface. More...

#include <spSoftPixelDevice.hpp>

Inheritance diagram for sp::SoftPixelDevice:
sp::SoftPixelDeviceAndroid sp::SoftPixelDeviceIOS sp::SoftPixelDeviceLinux sp::SoftPixelDeviceMacOSX sp::SoftPixelDeviceWin32

List of all members.

Public Member Functions

virtual ~SoftPixelDevice ()
video::RenderSystemgetRenderSystem () const
 Returns the render system. There is only one instance.
video::RenderContextgetRenderContext () const
scene::SceneManagergetSceneManager () const
 Returns the scene manager. There is only one instance.
io::InputControl * getInputControl () const
 Returns the input controller. There is only one instance.
io::OSInformatorgetOSInformator () const
 Returns the OS informator. There is only one instance.
gui::GUIManagergetGUIManager () const
 Creates a new GUI manager.
audio::SoundDevicecreateSoundDevice (const audio::ESoundDevices Type=audio::SOUNDDEVICE_AUTODETECT)
 Creates a new sound device.
void deleteSoundDevice (audio::SoundDevice *SoundDevice)
network::NetworkSystemcreateNetworkSystem (const network::ENetworkSystems Type)
void deleteNetworkSystem (network::NetworkSystem *NetSys)
video::CgShaderContextcreateCgShaderContext ()
 Creates a Cg shader context. Only one instance of this class can be created.
void deleteCgShaderContext ()
scene::SceneGraphcreateSceneGraph (const scene::ESceneGraphs Type=scene::SCENEGRAPH_SIMPLE)
void deleteSceneGraph (scene::SceneGraph *SceneGraph)
template<class T >
T * createSceneGraph ()
 Creates an individual scene graph object.
scene::CollisionGraphcreateCollisionGraph ()
 Creates a new collision graph for collision detection and resolving.
void deleteCollisionGraph (scene::CollisionGraph *CollGraph)
video::RenderContextcreateRenderContext (void *ParentWindow, const dim::size2di &Resolution, const io::stringc &Title="")
void deleteRenderContext (video::RenderContext *Context)
virtual bool updateDeviceSettings (const dim::size2di &Resolution, s32 ColorDepth=DEF_COLORDEPTH, bool isFullscreen=false, const SDeviceFlags &Flags=SDeviceFlags(), void *ParentWindow=0)
virtual bool updateEvents ()=0
void updateBaseEvents ()
 Updates only the base events but not the window events. Use this only if you update the window events by yourself!
void setActiveSceneGraph (scene::SceneGraph *ActiveSceneGraph)
scene::SceneGraphgetActiveSceneGraph () const
virtual void setFrameRate (u32 FrameRate=DEF_FRAMERATE)
virtual io::stringc getVersion () const
virtual void beep (u32 Milliseconds=100, u32 Frequency=1000)
 Occurs a beep sound with the specified frequency and for the spcified duration.
virtual void manipulateScreenSize (const dim::size2di &ScreenSize)
virtual s32 registerFontResource (const io::stringc &Filename)
virtual void unregisterFontResource (const io::stringc &Filename)
 Unregisters the specifies font resource file.
dim::size2di getResolution () const
 Returns the screen resolution. Only the screen from the main context is taken into account.
SDeviceFlags getFlags () const
 Returns the device flags.
const std::list
< network::NetworkSystem * > & 
getNetworkSystemList () const

Protected Member Functions

 SoftPixelDevice (const video::ERenderSystems RendererType, const dim::size2di &Resolution, s32 ColorDepth, bool isFullscreen, const SDeviceFlags &Flags)
virtual void autoDetectRenderSystem ()
virtual bool checkRenderSystem (const video::ERenderSystems Type) const
virtual bool createRenderSystemAndContext ()
virtual video::RenderSystemallocRenderSystem ()
virtual video::RenderContextallocRenderContext ()
virtual void deleteResourceDevices ()
virtual void releaseGraphicsContext ()
virtual void printConsoleHeader ()

Protected Attributes

video::ERenderSystems RendererType_
dim::size2di Resolution_
s32 ColorDepth_
bool isFullscreen_
SDeviceFlags Flags_
u32 FrameRate_
std::list< video::RenderContext * > RenderContextList_
std::list< audio::SoundDevice * > SoundDeviceList_
std::list< scene::SceneGraph * > SceneGraphList_
< scene::CollisionGraph * > 
< network::NetworkSystem * > 

Detailed Description

SoftPixel Engine device interface.

Constructor & Destructor Documentation

sp::SoftPixelDevice::~SoftPixelDevice (  )  [virtual]
sp::SoftPixelDevice::SoftPixelDevice ( const video::ERenderSystems  RendererType,
const dim::size2di Resolution,
s32  ColorDepth,
bool  isFullscreen,
const SDeviceFlags Flags 
) [protected]

Member Function Documentation

video::RenderContext * sp::SoftPixelDevice::allocRenderContext (  )  [protected, virtual]
video::RenderSystem * sp::SoftPixelDevice::allocRenderSystem (  )  [protected, virtual]
void sp::SoftPixelDevice::autoDetectRenderSystem (  )  [protected, virtual]
void sp::SoftPixelDevice::beep ( u32  Milliseconds = 100,
u32  Frequency = 1000 
) [virtual]

Occurs a beep sound with the specified frequency and for the spcified duration.

Reimplemented in sp::SoftPixelDeviceLinux, and sp::SoftPixelDeviceWin32.

bool sp::SoftPixelDevice::checkRenderSystem ( const video::ERenderSystems  Type  )  const [protected, virtual]
video::CgShaderContext * sp::SoftPixelDevice::createCgShaderContext (  ) 

Creates a Cg shader context. Only one instance of this class can be created.

scene::CollisionGraph * sp::SoftPixelDevice::createCollisionGraph (  ) 

Creates a new collision graph for collision detection and resolving.

network::NetworkSystem * sp::SoftPixelDevice::createNetworkSystem ( const network::ENetworkSystems  Type  ) 

Creates a network system.

This is only available if the engine has been compiled while the SP_COMPILE_WITH_NETWORKSYSTEM was defined. Look at "sources/Base/spCompilationOptions.hpp".
video::RenderContext * sp::SoftPixelDevice::createRenderContext ( void *  ParentWindow,
const dim::size2di Resolution,
const io::stringc Title = "" 

Creates a new render context which will autimatically share the resources with the main render context which can be get by "getRenderContext".

ParentWindow,: Specifies a pointer to the parent window (e.g. HWND for Windows) which is to be used for the new render context. If this pointer is null a default graphics window will be created.
Resolution,: Specifies the graphics resolution and window size if no parent window is specified.
Title,: Specifies the title for the graphics window if no parent window is specified.
See also:
Version 3.2
bool sp::SoftPixelDevice::createRenderSystemAndContext (  )  [protected, virtual]
scene::SceneGraph * sp::SoftPixelDevice::createSceneGraph ( const scene::ESceneGraphs  Type = scene::SCENEGRAPH_SIMPLE  ) 

Creates a new scene graph. You can also create several scene graphs (using "new" and "delete" manual).

Type,: Type of the scene graph. Since version 2.1 you can choose the type of the scene graph. By default the straight forwared scene graph is used where each object will be passed through. e.g. for extremely large (or rather expansive) scenes you can use a tree hierarchy (e.g. scene::SCENEGRAPH_TREE).
template<class T >
T* sp::SoftPixelDevice::createSceneGraph (  )  [inline]

Creates an individual scene graph object.

audio::SoundDevice * sp::SoftPixelDevice::createSoundDevice ( const audio::ESoundDevices  Type = audio::SOUNDDEVICE_AUTODETECT  ) 

Creates a new sound device.

void sp::SoftPixelDevice::deleteCgShaderContext (  ) 
void sp::SoftPixelDevice::deleteCollisionGraph ( scene::CollisionGraph CollGraph  ) 
void sp::SoftPixelDevice::deleteNetworkSystem ( network::NetworkSystem NetSys  ) 
void sp::SoftPixelDevice::deleteRenderContext ( video::RenderContext Context  ) 

Deletes the specified render context.

The main render context can not be deleted with this function. It will only be deleted with the whole engine device.
void sp::SoftPixelDevice::deleteResourceDevices (  )  [protected, virtual]
void sp::SoftPixelDevice::deleteSceneGraph ( scene::SceneGraph SceneGraph  ) 
void sp::SoftPixelDevice::deleteSoundDevice ( audio::SoundDevice SoundDevice  ) 
scene::SceneGraph * sp::SoftPixelDevice::getActiveSceneGraph (  )  const
SDeviceFlags sp::SoftPixelDevice::getFlags (  )  const [inline]

Returns the device flags.

gui::GUIManager * sp::SoftPixelDevice::getGUIManager (  )  const

Creates a new GUI manager.

io::InputControl * sp::SoftPixelDevice::getInputControl (  )  const

Returns the input controller. There is only one instance.

const std::list<network::NetworkSystem*>& sp::SoftPixelDevice::getNetworkSystemList (  )  const [inline]
io::OSInformator * sp::SoftPixelDevice::getOSInformator (  )  const

Returns the OS informator. There is only one instance.

video::RenderContext * sp::SoftPixelDevice::getRenderContext (  )  const

Returns the main render context. There is at least one instance.

See also:
video::RenderSystem * sp::SoftPixelDevice::getRenderSystem (  )  const

Returns the render system. There is only one instance.

dim::size2di sp::SoftPixelDevice::getResolution (  )  const [inline]

Returns the screen resolution. Only the screen from the main context is taken into account.

scene::SceneManager * sp::SoftPixelDevice::getSceneManager (  )  const

Returns the scene manager. There is only one instance.

io::stringc sp::SoftPixelDevice::getVersion (  )  const [virtual]
SoftPixel Engine version (e.g. "SoftPixel Engine - v.2.1").
void sp::SoftPixelDevice::manipulateScreenSize ( const dim::size2di ScreenSize  )  [virtual]

Manipulates the internal screen size (or rather resolution) values.

Should only be used by an experienced "SoftPixel Engine" developer!
void sp::SoftPixelDevice::printConsoleHeader (  )  [protected, virtual]
s32 sp::SoftPixelDevice::registerFontResource ( const io::stringc Filename  )  [virtual]

Registers a new font resource file. This is currently only supported on MS/Windows.

Filename,: Specifies the filename for the font resource which is to be registerd. On MS/Windows this should be a TTF (TrueType Font) file.
Number of fonts added to the system.

Reimplemented in sp::SoftPixelDeviceWin32.

void sp::SoftPixelDevice::releaseGraphicsContext (  )  [protected, virtual]
void sp::SoftPixelDevice::setActiveSceneGraph ( scene::SceneGraph ActiveSceneGraph  ) 

Sets the active scene graph. Functions like "draw3DLine" are using the active scene manager.

ActiveSceneGraph,: SceneGraph which is to be set to the new active one. If this parameter is 0 the default SceneGraph is used.
void sp::SoftPixelDevice::setFrameRate ( u32  FrameRate = DEF_FRAMERATE  )  [virtual]

Sets the maximal frame rate. Use this feature if vertical-synchronisation does not effect the program speed and your application runs too fast (in the case of 500 FPS and higher).

FrameRate,: Count of frames per second. If you want to disable maxial frame rate to let the program run with full speed set it to 0.
void sp::SoftPixelDevice::unregisterFontResource ( const io::stringc Filename  )  [virtual]

Unregisters the specifies font resource file.

Reimplemented in sp::SoftPixelDeviceWin32.

void sp::SoftPixelDevice::updateBaseEvents (  ) 

Updates only the base events but not the window events. Use this only if you update the window events by yourself!

bool sp::SoftPixelDevice::updateDeviceSettings ( const dim::size2di Resolution,
s32  ColorDepth = DEF_COLORDEPTH,
bool  isFullscreen = false,
const SDeviceFlags Flags = SDeviceFlags(),
void *  ParentWindow = 0 
) [virtual]

Updates the device settings. This recreated the main window, device- and render context. If any settings has changed all resources will automatically updated. If you want to change the render system you need to delete the device, create a new one and load all resources again. This feature is only supported on desktop platforms like Windows and Linux.

Resolution,: Specifies the new device resolution.
ColorDepth,: Specifies the new color depth (in bits). By default 32.
isFullscreen,: Specifies whether the new device is to be in window mode or fullscreen.
Flags,: Specifies the new devices flags.
ParentWindow,: Specifies the new parent window. On Windows this must be a pointer to a HWND instance.
True on success otherwise false.

Reimplemented in sp::SoftPixelDeviceWin32.

virtual bool sp::SoftPixelDevice::updateEvents (  )  [pure virtual]

Updates all window events. This functions needs to be called every frame. Typically in the main "while" loop. It will update the input states (keyboard, mouse etc.), window callback function on a MS/Windows platform, and some other global state functionality..

False if the user clicked the close button in the window title bar. Otherwise true.

Implemented in sp::SoftPixelDeviceAndroid, sp::SoftPixelDeviceIOS, sp::SoftPixelDeviceLinux, sp::SoftPixelDeviceMacOSX, and sp::SoftPixelDeviceWin32.

Member Data Documentation

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines