View SampleClamp2D.cpp
//==================================================================
template <typename _T>
inline _T SampleClamp2D(
const DVec<_T> &samp,
int sampW,
int sampH,
float u,
float v )
{
u = std::max( u, _T(0) ); // only clamp to min.. max comes below
View event_sample.cpp
// sure cost
void GameMain::UIInputTouchBegan( void *id, float x, float y )
{
DASSERT( !mEventLock ); mEventLock = true;
mEventData.WriteValue<u_int>( EVT_TOUCH_BEGAN );
mEventData.WriteValue<void *>( id );
mEventData.WriteValue<float>( x );
mEventData.WriteValue<float>( y );
mEventLock = false;
}
View DArray.h
template <class _T, size_t _SIZE>
class DArray
{
U32 mBuff[ (sizeof(_T) * _SIZE + 3) / 4 ];
size_t mSize = 0;
#if defined(_DEBUG) || defined(DEBUG)
_T *mpDbgPtr = (_T *)mBuff;
#endif
public:
View gist:10142521
//--------------------------
// setup geometry
const static u_int NDIV_PHI = 20;
const static u_int NDIV_THE = 20;
mPosBase.reserve( NDIV_PHI * NDIV_THE );
auto &geom = *moBaseMesh->mpGeom;
geom.mNor.reserve( mPosBase.size() );
View CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
project (ivcc01_thecrib)
if(MSVC) #((((((((((((((((
set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /DWIN32 /MD /Ox /Ot /Oi /GL /Ob2 /Oy /arch:SSE2")
set(CMAKE_CXX_FLAGS_RELEASE "/DNDEBUG /DWIN32 /MD /Ox /Ot /Oi /GL /Ob2 /Oy /arch:SSE2")
set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /DWIN32 /Zi /MDd /Od /arch:SSE2")
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /DWIN32 /Zi /MDd /Od /arch:SSE2")
add_definitions( "/D_CRT_SECURE_NO_WARNINGS /wd4996 /nologo" ) # disable annoying secure CRT warnings
View CodeStyle.cpp
//==================================================================
/// ClassName
//==================================================================
class ClassName
{
size_t mMember = 0; // 'm' prefix for member variable
U8 *mpPointer = nullptr; // 'mp' prefix for member pointer
uptr<type> moObject; // 'mo' prefix for smart (owned) ptr
public:
View CHECKGLERR -- .cpp
namespace DGLUT
{
//==================================================================
void CheckGLErr( const char *pFileName, int line )
{
GLenum err = glGetError();
while (err != GL_NO_ERROR)
{
const char *pErr = NULL;
View RandPool.cpp
//==================================================================
class RandPool
{
DVec<U32> mVals;
size_t mIterIdx;
public:
RandPool( size_t size, U32 seed=0 )
: mIterIdx(0)
{
View gist:4332700
//==================================================================
template <class _T>
class VecOwn
{
DVec<_T> mVec;
public:
~VecOwn()
{
clear_free();
View gist:4242855
// are we waiting for the introduction to go away ?
if ( mStater[STATE_IN_COMM_INTRODUCTION].IsActive() )
{
if NOT( moCharDlgWin->IsActive() ) // is finally the dialog gone ?
{
mStater[STATE_IN_COMM_INTRODUCTION].Deactivate(); // the wait has ended
updateHomeButtonsState(); // set the fighters button on hover
}
}
else