Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

DeviceContextC Class Reference

Device context class. More...

#include <DeviceContextC.h>

List of all members.

Public Methods

 DeviceContextC ()
 Default constructor.

virtual ~DeviceContextC ()
 Default destructor.

virtual DeviceInterfaceIquery_interface (const PluginClass::ClassIdC &rClassId)
 Query specified device interface.

virtual DeviceInterfaceIquery_interface (const PluginClass::SuperClassIdC &rSClassId)
 Queries an interface based on super class ID.

virtual void register_interface (DeviceInterfaceI *pInterface)
 Register device interface.

virtual void unregister_interface (const PluginClass::ClassIdC &rClassId)
 Unregister device interface.

virtual PajaTypes::uint32 get_interface_count () const
 Returns number of interfaces in the device context.

virtual DeviceInterfaceIget_interface (PajaTypes::uint32 ui32Index)
 Returns specified interface.


Detailed Description

Device context class.

The purpose of the device context class is to gather all the device interfaces available to the effects. The interfaces may range from renderin APIs (such as OpenGL, or Direct3D) to music system APIs. The interface holds just enough information to use the API and some helper methods to help the use of the API under the editor. Device context simply holds these interfaces. These interfaces can be queried from the context.

This class is implemented by the system.


Constructor & Destructor Documentation

DeviceContextC  
 

Default constructor.

Initialises the structures used by the device context. Used internally.

virtual ~DeviceContextC   [virtual]
 

Default destructor.

The destructor. Releases all resgitered interfaces. Used internally.


Member Function Documentation

virtual DeviceInterfaceI* get_interface PajaTypes::uint32    ui32Index [virtual]
 

Returns specified interface.

virtual PajaTypes::uint32 get_interface_count   const [virtual]
 

Returns number of interfaces in the device context.

virtual DeviceInterfaceI* query_interface const PluginClass::SuperClassIdC   rSClassId [virtual]
 

Queries an interface based on super class ID.

Example:

            ...
            GraphicsDeviceI*    pGraphDevice = (GraphicsDeviceI*)pContext->query_interface( SUPERCLASS_GRAPHICSDEVICE );
            ...

virtual DeviceInterfaceI* query_interface const PluginClass::ClassIdC   rClassId [virtual]
 

Query specified device interface.

Parameters:
rClassId  ID of the interface to query.
Returns :
Pointer to existing interface. If no interface was found the return value is NULL.
This is the only method user needs to call from this class. It makes a query to the list inside the device context to see if the queried interface is available. If it is available pointer to the interface will be returned, otherwise the return value is NULL.

The class IDs for the interfaces are defined in the header files of the interfaces.

Example:

            void
            TestEffectC::do_frame( DeviceContextC* pContext )
            {

                // Get the OpenGL device.
                OpenGLDeviceC*  pDevice = (OpenGLDeviceC*)pContext->query_interface( CLASS_OPENGL_DEVICEDRIVER );
                if( !pDevice ) {
                    // No device available... bail out!
                    return;
                }

                // do the effect...
            }

virtual void register_interface DeviceInterfaceI   pInterface [virtual]
 

Register device interface.

The system (or the Demopaja player) uses this method internally to register device interfaces to the device context.

virtual void unregister_interface const PluginClass::ClassIdC   rClassId [virtual]
 

Unregister device interface.

The system (or the Demopaja player) uses this method internally to register device interfaces to the device context.


Moppi Demopaja SDK Documentation -- Copyright © 2000-2002 Moppi Productions