Show callback.cpp syntax highlighted
/***************************************************************************
callback.cpp - Frame callback management
-------------------
begin : Thu May 22 2003
copyright : (C) 2003 by Reality Rift Studios
email : mattias@realityrift.com
***************************************************************************
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is the NeoEngine, NeoDevOpenGL, callback.cpp
The Initial Developer of the Original Code is Mattias Jansson.
Portions created by Mattias Jansson are Copyright (C) 2003
Reality Rift Studios. All Rights Reserved.
***************************************************************************/
#include "device.h"
#include <neoengine/logstream.h>
using namespace std;
using namespace NeoEngine;
namespace NeoOGL
{
void Device::RegisterFrameCallback( FrameCallback::FRAMECALLBACKTYPE eType, FrameCallback *pkCallback, bool bRegister )
{
if( ( eType < 0 ) || ( eType > FrameCallback::NUMCALLBACKS ) )
return;
vector< FrameCallback* >::iterator ppkCallback = m_avpkFrameCallbacks[ eType ].begin();
vector< FrameCallback* >::iterator ppkCallbackEnd = m_avpkFrameCallbacks[ eType ].end();
for( ; ppkCallback != ppkCallbackEnd; ++ppkCallback )
if( *ppkCallback == pkCallback )
{
if( !bRegister )
m_avpkFrameCallbacks[ eType ].erase( ppkCallback );
else
neolog << LogLevel( WARNING ) << "*** register frame callback failed: callback already registered" << endl;
return;
}
if( !bRegister )
{
neolog << LogLevel( WARNING ) << "*** deregister frame callback failed: callback not found" << endl;
return;
}
m_avpkFrameCallbacks[ eType ].push_back( pkCallback );
}
}; // namespace NeoOGL
See more files for this project here