• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MY_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MY_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ MY_ASSERT函数的具体用法?C++ MY_ASSERT怎么用?C++ MY_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MY_ASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

//main
int main(int argc ,  char *argv[])
{
	int fd_listen, fd_client;
	MY_ASSERT((fd_listen = socket(AF_INET, SOCK_STREAM , 0)) != -1 ,"listen socket init");//socket


	struct sockaddr_in seraddr, clientaddr;
	socklen_t sock_len = sizeof(clientaddr);
	memset(&seraddr, 0, sizeof(seraddr));
	seraddr.sin_family = AF_INET;
	seraddr.sin_port = htons(atoi(argv[2]) );
	seraddr.sin_addr.s_addr = inet_addr(argv[1]);
	MY_ASSERT(bind(fd_listen, (struct sockaddr*)&seraddr, sizeof(seraddr))==0, "bind");//bind

	MY_ASSERT(listen(fd_listen, 5) == 0, "listen");//listen


	while(1)
	{
		sock_len =sizeof(clientaddr);
		memset(&clientaddr, 0, sock_len);
		fd_client = accept(fd_listen ,(struct sockaddr*)&clientaddr, &sock_len );
		printf("client %s:%d connect!\n", inet_ntoa(clientaddr.sin_addr), ntohs(clientaddr.sin_port));
        if(fork() == 0)
		{
			close(fd_listen);
			child_main(fd_client);
			close(fd_client);
			exit(1);
		}
		close(fd_client);
 
	}
}
开发者ID:jiangp,项目名称:Linux-FTP,代码行数:35,代码来源:server.c


示例2: MY_ASSERT

bool BuffManager::BuildStub(BuffModify *e)
{
	if (!e)
		return false;

	MY_ASSERT(1 != e->m_WillActTimes);

	m_buffList[e->m_ID] = e;

	e->m_curStep = 0;

	if (0 != e->m_WillActTimes)
		EventManager::GetInstance().Register(e, e->m_Margin);

	// 主动触发第一个事件
	//if (e->m_WillActTimes>2)
	{
		e->OnTimer(0);
	}
	

	e->SendNotify(true);

	// 建立Buff组映射
	BuffGroup::iterator it = m_buffGroup.find(e->m_GroupID);
	MY_ASSERT(it == m_buffGroup.end());
	m_buffGroup.insert(make_pair(e->m_GroupID, e->m_ID));

	// 加入交叉索引
	e->m_pusher->m_buffMgr.m_buffToOther.insert(e);

	return TRUE;
}
开发者ID:luw630,项目名称:Server,代码行数:33,代码来源:BuffManager.cpp


示例3: range_test

void range_test()
{
    vector<point_t> points;
    vector<range_t> ranges;


    for (size_t i = 0; i < 1000; ++i)
    {
        const coord_t x = rand();
        const coord_t y = rand();
        points.push_back(point_t(x, y));
        points.push_back(point_t(x, rand()));
    }


    for (size_t i = 0; i < 1000; ++i)
    {
        coord_t inf = rand();
        coord_t sup = rand();
        if (sup < inf)
            std::swap(inf, sup);

        ranges.push_back(range_t(inf, sup));
    }



/*
    for (size_t i = 0; i < 10; ++i)
        points.push_back(point_t(i,  5));
*/


    const range_tree_t range_tree(points);

//    auto ind = range_tree.query(range_t(2, 8), range_t(4, 9));

    vector<bool> returned;
    for (size_t i = 0; i < ranges.size() / 2; ++i)
    {
        returned.resize(range_tree.points().size(), false);
        
        range_t x_range = ranges.at(i * 2 + 0);
        range_t y_range = ranges.at(i * 2 + 1);

        const auto indices = range_tree.query(x_range, y_range);
        BOOST_FOREACH(const auto index, indices)
        {
            returned.at(index) = true;
            const point_t point = range_tree.points().at(index);
            MY_ASSERT(point.x >= x_range.inf && point.x < x_range.sup && point.y >= y_range.inf && point.y < y_range.sup);
        }

        for (size_t index = 0; index < range_tree.points().size(); ++index)
        {
            const point_t point = range_tree.points().at(index);
            if (!returned.at(index))
                MY_ASSERT(point.x < x_range.inf || point.x >= x_range.sup || point.y < y_range.inf || point.y >= y_range.sup);
        }
    }
开发者ID:vasily-knk,项目名称:hw_fall_2013,代码行数:60,代码来源:main.cpp


示例4: Test1

static void Test1()
{
    printf("Test1...\n");
    emThread::StartUnmanaged(ThreadFunc1,(void*)"hello 1");
    MY_ASSERT(!Event1.Receive(1,1000));
    MY_ASSERT(Event1.Receive(1,1000));
}
开发者ID:ackalker,项目名称:eaglemode,代码行数:7,代码来源:emTestThreads.cpp


示例5: SAFE_RELEASE

	//------------------------------------------------------------------------------------------
	bool CGraphicDevice::Reset(int i_nWidth, int i_nHeight )
	{
		HRESULT hr;

		// サーフェースの破棄		
		SAFE_RELEASE( m_pd3dSurface9 );		

		// デバイスのリセット
		// Presentation Parameter の初期化		
		m_d3dpp.BackBufferWidth = i_nWidth;
		m_d3dpp.BackBufferHeight = i_nHeight;	
		hr = m_pd3dDevice9->Reset( &m_d3dpp );
		MY_ASSERT( SUCCEEDED(hr) );
		
		// サーフェースを新しいサイズで再作成
		bool ret = CreateRenderTarget( i_nWidth, i_nHeight );
		MY_ASSERT( ret );

		m_nWidth = i_nWidth;
		m_nHeight = i_nHeight;

		// ビューポートの設定
		m_viewport.X = 0;
		m_viewport.Y = 0;
		m_viewport.Width = i_nWidth;
		m_viewport.Height = i_nHeight;		
		m_viewport.MinZ = 0.0f;
		m_viewport.MaxZ = 1.0f;

		return ret;
	}
开发者ID:larrson,项目名称:metashader,代码行数:32,代码来源:GraphicDevice.cpp


示例6: read_public_key

void read_public_key(drown_ctx * dctx, char *filename)
{
    // Read file
    FILE * fp = fopen(filename, "r");
    MY_ASSERT(fp != NULL, "can't open certificate file");

    // Read cert
    X509 *cert = PEM_read_X509(fp, NULL, NULL, NULL);
    MY_ASSERT(cert != NULL, "file is not a certificate");

    // Read public key
    EVP_PKEY * pkey = X509_get_pubkey(cert);
    MY_ASSERT(pkey != NULL, "can't get public key from certificate");

    // Check RSA key
    MY_ASSERT(pkey->type == EVP_PKEY_RSA, "public key is not RSA");
    MY_ASSERT(EVP_PKEY_bits(pkey) == 2048, "only RSA-2048 is supported for now");

    // Read RSA key
    RSA *rsa = EVP_PKEY_get1_RSA(pkey);

    // Copy the public key
    BN_copy(dctx->n, rsa->n);
    BN_copy(dctx->e, rsa->e);

    RSA_free(rsa);
    EVP_PKEY_free(pkey);
    X509_free(cert);
    fclose(fp);
}
开发者ID:Tim---,项目名称:drown,代码行数:30,代码来源:utils.c


示例7: MY_ASSERT

void CExchangeGoods::ExchgLoseStatus()
{
	CPlayer *pPlayer = static_cast<CPlayer *>(this);
	if (!pPlayer)
		return;

	// 首先看看是否在等待交易回应
	if (pPlayer->m_ChxSentOut.size())
	{
		for (CPlayer::CHXQuestList::iterator it = pPlayer->m_ChxSentOut.begin(); it != pPlayer->m_ChxSentOut.end(); ++it)
		{
			CPlayer *pDestPlayer = (CPlayer *)GetPlayerByGID(it->first)->DynamicCast(IID_PLAYER);
			if (!pDestPlayer)
				continue;

			MY_ASSERT(pDestPlayer->m_CurHp);
			pDestPlayer->m_ChxGetIn.erase(pPlayer->GetGID());
		}

		pPlayer->m_ChxSentOut.clear();
	}

	// 是否在等待响应交易请求
	if (pPlayer->m_ChxGetIn.size())
	{
		CPlayer::CHXQuestList tempCopy(pPlayer->m_ChxGetIn);

		for (CPlayer::CHXQuestList::iterator it = tempCopy.begin(); it != tempCopy.end(); ++it)
		{
			CPlayer *pQuest = (CPlayer *)GetPlayerByGID(it->first)->DynamicCast(IID_PLAYER);
			if (pQuest)
			{
				MY_ASSERT(pQuest->m_CurHp);

				// 超时,拒绝
				SQQuestExchangeMsg rejectMsg;
				rejectMsg.bAccept    = false;
				rejectMsg.dnidClient = 0;
				rejectMsg.dwDestGID  = pPlayer->GetGID();
				rejectMsg.dwSrcGID   = it->first;

				RecvQuestExchangeMsg(&rejectMsg, true);
			}
			else
			{
				MY_ASSERT(0);
				pPlayer->m_ChxGetIn.erase(it->first);
			}
		}

		MY_ASSERT(pPlayer->m_ChxGetIn.empty());
	}

	// 是否处于交易中
	if (pPlayer->InExchange())
	{
		CExchangeGoods::TheEnd();
	}
}
开发者ID:luw630,项目名称:Server,代码行数:59,代码来源:ExchangeGoods.cpp


示例8: ThreadFunc1

static int ThreadFunc1(void * arg)
{
    MY_ASSERT(strcmp((char*)arg,"hello 1")==0);
    emSleepMS(1500);
    MY_ASSERT(Event1.GetCount()==-1);
    Event1.Send();
    return 0;
}
开发者ID:ackalker,项目名称:eaglemode,代码行数:8,代码来源:emTestThreads.cpp


示例9: rfalse

bool BuffManager::CanAddBuff(const SBuffBaseData *pData, CFightObject *pSender)
{
	if (!pData)
	{
		rfalse(4,1,"BuffManager::CanAddBuff(const SBuffBaseData *pData)1");
		return false;
	}

	if (m_curObj&&pSender)
	{
		if (m_curObj->GetGID() != pSender->GetGID()) //给目标添加BUFF
		{
			if (!m_curObj->m_bPlayerAction[CST_ADDBUFF])
			{
				rfalse(2, 1, "目标当前无法添加BUFF");
				return false;
			}
		}
	}

	BuffGroup::iterator groupIt = m_buffGroup.find(pData->m_GroupID);
	if (groupIt == m_buffGroup.end())
	{
		//rfalse(2, 1, "玩家身上没有Buff组%d中的Buff", pData->m_GroupID);
		//MY_ASSERT(m_buffList.end() == m_buffList.find(pData->m_ID));
		return true;
	}

	BuffList::iterator buffIt = m_buffList.find(groupIt->second);
	if (buffIt == m_buffList.end())
	{
		rfalse(4,1,"BuffManager::CanAddBuff(const SBuffBaseData *pData)2");
		return false;
	}
	MY_ASSERT(m_buffList.end() != buffIt);
	//TODO:Tony Modify [2012-3-11]Comment:[IF语句后面有;]
	//if (pData->m_GroupID != buffIt->second->m_GroupID);
	///////////////////////////////////////////////////////////////////
	if (pData->m_GroupID != buffIt->second->m_GroupID)
	{
		rfalse(4,1,"BuffManager::CanAddBuff(const SBuffBaseData *pData)3");
		return false;
	}
	MY_ASSERT(pData->m_GroupID == buffIt->second->m_GroupID);
	
	if (!buffIt->second->m_CanBeReplaced)
		return false;

	// 如果可被替换,那么查看权重
	if (buffIt->second->m_Weight > pData->m_Weight)
		return false;

	// 顶替
	RemoveBuff(buffIt->second);

	return true;
}
开发者ID:luw630,项目名称:Server,代码行数:57,代码来源:BuffManager.cpp


示例10: rfalse

void CExchangeGoods::ExchangeCancel(CPlayer *pDestPlayer, bool isSrc)
{
	if (!pDestPlayer)
		return;

	CPlayer *pSrcPlayer = static_cast<CPlayer *>(this);
	if (!pSrcPlayer)
		return;

	// 交易取消,需要恢复被锁定的道具和金钱
	for (int i=0; i<m_MyBox.m_SellNumber; i++)
	{
		SPackageItem &item  = m_MyBox.m_GoodsArray[i];
		SPackageItem *pItem = pSrcPlayer->FindItemByPos(item.wCellPos, XYD_FT_ONLYLOCK);
		
		if (!pItem)
		{
			rfalse(4, 1, "ExchangeGoods.cpp - ExchangeCancel() - !pItem");
			return;
		}

		MY_ASSERT(pItem);

		pSrcPlayer->LockItemCell(pItem->wCellPos, false);
	}

	for (int i=0; i<m_YouBox.m_SellNumber; i++)
	{
		SPackageItem &item  = m_YouBox.m_GoodsArray[i];
		SPackageItem *pItem = pDestPlayer->FindItemByPos(item.wCellPos, XYD_FT_ONLYLOCK);
		if (!pItem)
		{
			rfalse(4, 1, "ExchangeGoods.cpp - ExchangeCancel() - !pItem");
			return;
		}
		MY_ASSERT(pItem);

		pDestPlayer->LockItemCell(pItem->wCellPos, false);
	}

	// 清除当前的交易状态(包括了金钱的锁定)
	memset((CExchangeGoods *)pSrcPlayer, 0, sizeof(CExchangeGoods));
	memset((CExchangeGoods *)pDestPlayer, 0, sizeof(CExchangeGoods));

	// 通知客户端交易被取消
	SAExchangeOperationMsg opmsg;
	opmsg.dwSrcGID	= pSrcPlayer->GetGID();
	opmsg.dwDestGID = pDestPlayer->GetGID();
	opmsg.isSrc		= isSrc;
	opmsg.operation = SAExchangeOperationMsg::CANCEL;

	g_StoreMessage(pSrcPlayer->m_ClientIndex, &opmsg, sizeof(SAExchangeOperationMsg));
	g_StoreMessage(pDestPlayer->m_ClientIndex, &opmsg, sizeof(SAExchangeOperationMsg));

	return;
}
开发者ID:luw630,项目名称:Server,代码行数:56,代码来源:ExchangeGoods.cpp


示例11: JAWT_GetAWT

/*****************************************************************************
 *
 * Class      : NativeView
 * Method     : getNativeWindow
 * Signature  : ()J
 * Description: returns the native systemw window handle of this object
 */
JNIEXPORT jlong JNICALL Java_NativeView_getNativeWindow
  (JNIEnv * env, jobject obj_this)
{
    jboolean                      result  ;
    jint                          lock    ;
    JAWT                          awt     ;
    JAWT_DrawingSurface*          ds      ;
    JAWT_DrawingSurfaceInfo*      dsi     ;
    JAWT_Win32DrawingSurfaceInfo* dsi_win ;
    HDC                           hdc     ;
    HWND                          hWnd    ;
    LONG                          hFuncPtr;

    /* Get the AWT */
    awt.version = JAWT_VERSION_1_3;
    result      = JAWT_GetAWT(env, &awt);
    MY_ASSERT(result!=JNI_FALSE,"wrong jawt version");

    /* Get the drawing surface */
    if ((ds = awt.GetDrawingSurface(env, obj_this)) == NULL)
        return 0L;

    /* Lock the drawing surface */
    lock = ds->Lock(ds);
    MY_ASSERT((lock & JAWT_LOCK_ERROR)==0,"can't lock the drawing surface");

    /* Get the drawing surface info */
    dsi = ds->GetDrawingSurfaceInfo(ds);

    /* Get the platform-specific drawing info */
    dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
    hdc     = dsi_win->hdc;
    hWnd    = dsi_win->hwnd;

    /* Free the drawing surface info */
    ds->FreeDrawingSurfaceInfo(dsi);
    /* Unlock the drawing surface */
    ds->Unlock(ds);
    /* Free the drawing surface */
    awt.FreeDrawingSurface(ds);

    /* Register own window procedure
       Do it one times only! Otherwhise
       multiple instances will be registered
       and calls on such construct produce
       a stack overflow.
     */
    if (GetProp( hWnd, OLD_PROC_KEY )==0)
    {
        hFuncPtr = SetWindowLong( hWnd, GWL_WNDPROC, (DWORD)NativeViewWndProc );
        SetProp( hWnd, OLD_PROC_KEY, (HANDLE)hFuncPtr );
    }

    return ((jlong)hWnd);
}
开发者ID:CaoMomo,项目名称:core,代码行数:62,代码来源:nativeview.c


示例12: Test6

static void Test6()
{
    printf("Test6...\n");
    emThreadMutex c[5];
    DiningPhilosopher * p[5];
    char str[256],str2[256];
    emUInt64 clk;
    int i;

    for (i=0; i<5; i++) p[i]=new DiningPhilosopher(c[i],c[(i+1)%5]);

    clk=emGetClockMS();
    str2[0]=0;
    while (emGetClockMS()-clk<3000) {
        PrintEvent.Receive();
        strcpy(str,
               "    ?    \n"
               "  -   -  \n"
               "?       ?\n"
               " -     - \n"
               " ?  -  ? \n"
              );
        PrintDataMutex.Lock();
        MY_ASSERT(!p[0]->IsEating() || !p[1]->IsEating());
        MY_ASSERT(!p[1]->IsEating() || !p[2]->IsEating());
        MY_ASSERT(!p[2]->IsEating() || !p[3]->IsEating());
        MY_ASSERT(!p[3]->IsEating() || !p[4]->IsEating());
        MY_ASSERT(!p[4]->IsEating() || !p[0]->IsEating());
        if (p[0]->IsThinking()) str[04]='T';
        if (p[1]->IsThinking()) str[28]='T';
        if (p[2]->IsThinking()) str[47]='T';
        if (p[3]->IsThinking()) str[41]='T';
        if (p[4]->IsThinking()) str[20]='T';
        if (p[0]->IsEating()) str[04]='E';
        if (p[1]->IsEating()) str[28]='E';
        if (p[2]->IsEating()) str[47]='E';
        if (p[3]->IsEating()) str[41]='E';
        if (p[4]->IsEating()) str[20]='E';
        if (c[0].IsLocked()) str[12]=' ';
        if (c[1].IsLocked()) str[16]=' ';
        if (c[2].IsLocked()) str[37]=' ';
        if (c[3].IsLocked()) str[44]=' ';
        if (c[4].IsLocked()) str[31]=' ';
        PrintDataMutex.Unlock();
        if (strcmp(str,str2)!=0) {
            strcpy(str2,str);
            printf("\n\n%s",str);
        }
    }

    for (i=0; i<5; i++) delete p[i];
}
开发者ID:ackalker,项目名称:eaglemode,代码行数:52,代码来源:emTestThreads.cpp


示例13: JAWT_GetAWT

/*****************************************************************************
 *
 * Class      : NativeView
 * Method     : getNativeWindow
 * Signature  : ()J
 * Description: returns the native systemw window handle of this object
 */
JNIEXPORT jlong JNICALL Java_embeddedobj_test_NativeView_getNativeWindow
  (JNIEnv * env, jobject obj_this)
{
    jboolean                      result  ;
    jint                          lock    ;
    JAWT                          awt     ;
    JAWT_DrawingSurface*          ds      ;
    JAWT_DrawingSurfaceInfo*      dsi     ;
#ifdef WNT
    JAWT_Win32DrawingSurfaceInfo* dsi_win ;
#else
    // FIXME: Where is dsi_x11 defined?
    // Added below because I'm guessing this test breaks

    // JAWT_X11DrawingSurfaceInfo*dsi_x11 ;
#endif
    jlong                         drawable;

    /* Get the AWT */
    awt.version = JAWT_VERSION_1_3;
    result      = JAWT_GetAWT(env, &awt);
    MY_ASSERT(result!=JNI_FALSE,"wrong jawt version");

    /* Get the drawing surface */
    if ((ds = awt.GetDrawingSurface(env, obj_this)) == NULL)
        return 0L;

    /* Lock the drawing surface */
    lock = ds->Lock(ds);
    MY_ASSERT((lock & JAWT_LOCK_ERROR)==0,"can't lock the drawing surface");

    /* Get the drawing surface info */
    dsi = ds->GetDrawingSurfaceInfo(ds);

    /* Get the platform-specific drawing info */
#ifdef WNT
    dsi_win  = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
    drawable = (jlong)dsi_win->hwnd;
#else
    dsi_x11  = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
    drawable = (jlong)dsi_x11->drawable;
#endif

    /* Free the drawing surface info */
    ds->FreeDrawingSurfaceInfo(dsi);
    /* Unlock the drawing surface */
    ds->Unlock(ds);
    /* Free the drawing surface */
    awt.FreeDrawingSurface(ds);

    return drawable;
}
开发者ID:MItsutoshiNAKANO,项目名称:core,代码行数:59,代码来源:nativeview.c


示例14: Test4

static void Test4()
{
    printf("Test4...\n");
    emThread t;

    Int4=0;
    Mutex4a.Lock();
    t.Start(ThreadFunc4,NULL);
    emSleepMS(100);
    MY_ASSERT(Int4++==0);
    Mutex4a.Unlock();
    emSleepMS(100);
    Mutex4a.Lock();
    MY_ASSERT(Int4++==3);
    emSleepMS(100);
    MY_ASSERT(Int4++==4);
    Mutex4a.Unlock();
    Mutex4b.Lock();
    MY_ASSERT(Int4++==7);
    emSleepMS(500);
    MY_ASSERT(Int4++==8);
    Mutex4b.Unlock();
    emSleepMS(100);
    Mutex4c.Lock();
    MY_ASSERT(Int4++==11);
    MY_ASSERT(Mutex4b.Lock(0));
    MY_ASSERT(t.WaitForTermination(1000)==true);
}
开发者ID:ackalker,项目名称:eaglemode,代码行数:28,代码来源:emTestThreads.cpp


示例15: ThreadFunc4

static int ThreadFunc4(void * arg)
{
    Mutex4a.Lock();
    MY_ASSERT(Int4++==1);
    emSleepMS(200);
    MY_ASSERT(Int4++==2);
    Mutex4b.Lock();
    Mutex4a.Unlock();
    emSleepMS(100);
    Mutex4a.Lock();
    Mutex4a.Unlock();
    MY_ASSERT(Int4++==5);
    emSleepMS(100);
    MY_ASSERT(Int4++==6);
    Mutex4b.Unlock();
    emSleepMS(100);
    MY_ASSERT(!Mutex4b.LockReadOnly(100));
    MY_ASSERT(Mutex4b.LockReadOnly(1000));
    Mutex4c.Lock();
    Mutex4b.UnlockReadOnly();
    MY_ASSERT(Int4++==9);
    emSleepMS(200);
    MY_ASSERT(Int4++==10);
    Mutex4c.Unlock();

    return 0;
}
开发者ID:ackalker,项目名称:eaglemode,代码行数:27,代码来源:emTestThreads.cpp


示例16: Test2

static void Test2()
{
    printf("Test2...\n");
    emThread t;

    t.Start(ThreadFunc2a,(void*)"hello 2a");
    MY_ASSERT(!t.WaitForTermination(1000));
    MY_ASSERT(t.WaitForTermination(1000));
    MY_ASSERT(t.GetExitStatus()==4711);

    t.Start(ThreadFunc2b,(void*)&t);
    MY_ASSERT(t.WaitForTermination(500));
    MY_ASSERT(t.GetExitStatus()==-12343782);
}
开发者ID:ackalker,项目名称:eaglemode,代码行数:14,代码来源:emTestThreads.cpp


示例17: _T

bool HwAccelManager::SetAccelerationLevel(long ulMode)
{
   if (!isEnabled_)
      return false;

   HKEY hkDevice;
   DWORD dwAccLevel;

   if (!OpenAccelerationLevel(&hkDevice, &dwAccLevel))
      return false;

   if ((long) dwAccLevel != ulMode)
   {
      if (ulMode != 0x0)
      {
         dwAccLevel     = ulMode;
         DWORD dwLength = sizeof DWORD;
         LONG result = ::RegSetValueEx(hkDevice,
                                      _T("Acceleration.Level"),
                                       0,
                                       REG_DWORD,
                                       (LPBYTE) &dwAccLevel,
                                       dwLength);
         ::RegCloseKey(hkDevice);
         MY_ASSERT((result == ERROR_SUCCESS), 
                   _T("Could not set video hardware acceleration level."));
      }
      else
      {
         // delete Acceleration.Level key
         LONG result = ::RegDeleteValue(hkDevice, _T("Acceleration.Level"));
         ::RegCloseKey(hkDevice);
         MY_ASSERT((result == ERROR_SUCCESS),
                   _T("Could not fully enable video hardware acceleration level."));
      }

      // Now tickle Windows to reload settings
      DEVMODE devMode;
      BOOL success = ::EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode);
      MY_ASSERT((success == TRUE),
                _T("Could not retrieve current video device settings."));
      ::ChangeDisplaySettings(&devMode, CDS_RESET);
   }
   else
   {
      ::RegCloseKey(hkDevice);
   }

   return true;
}
开发者ID:identity0815,项目名称:os45,代码行数:50,代码来源:hwaccelmanager.cpp


示例18: LOGD

NativeEngine::NativeEngine(struct android_app *app) {
    LOGD("NativeEngine: initializing.");
    mApp = app;
    mHasFocus = mIsVisible = mHasWindow = false;
    mHasGLObjects = false;
    mEglDisplay = EGL_NO_DISPLAY;
    mEglSurface = EGL_NO_SURFACE;
    mEglContext = EGL_NO_CONTEXT;
    mEglConfig = 0;
    mSurfWidth = mSurfHeight = 0;
    mApiVersion = 0;
    mJniEnv = NULL;
    memset(&mState, 0, sizeof(mState));
    mIsFirstFrame = true;

    if (app->savedState != NULL) {
        // we are starting with previously saved state -- restore it
        mState = *(struct NativeEngineSavedState*) app->savedState;
    }

    // only one instance of NativeEngine may exist!
    MY_ASSERT(_singleton == NULL);
    _singleton = this;

    VLOGD("NativeEngine: querying API level.");
    LOGD("NativeEngine: API version %d.", mApiVersion);
}
开发者ID:AcmeNinjaCorp,项目名称:android-ndk,代码行数:27,代码来源:native_engine.cpp


示例19: OurActivity_ResetEncouragementToasts

void OurActivity_ResetEncouragementToasts(int score) {
    struct JniSetup *setup = GetJNISetup();
    jmethodID m_postResetEncouragementToasts = setup->env->GetMethodID(setup->clazz,
            "postResetEncouragementToasts", "(I)V");
    MY_ASSERT(m_postResetEncouragementToasts);
    setup->env->CallVoidMethod(setup->thiz, m_postResetEncouragementToasts, score);
}
开发者ID:13simon37,项目名称:android-samples,代码行数:7,代码来源:java_ouractivity.cpp


示例20: MY_ASSERT

	//------------------------------------------------------------------------------------------
	void CPreviewerView::Render()
	{
		CGraphicDevice* pDevice = CApp::GetInstance()->GetGraphicDevice(); MY_ASSERT( pDevice );

		// カメラ設定
		CCameraController *pCameraController = dynamic_cast<CCameraController*>( m_pMouseHandler );
		pDevice->SetCameraInfo( pCameraController->GetCameraInfo() );

		// ライト設定				
		// 0 Fill
		D3DXVECTOR3 vLightDir0( 1, -1, -1); D3DXVec3Normalize( &vLightDir0, &vLightDir0);		
		pDevice->SetDirLightDir( 0, vLightDir0.x, vLightDir0.y, vLightDir0.z );
		pDevice->SetDirLightColor( 0, 1.0f, 1.0f, 1.0f );		
		// 1 Back
		D3DXVECTOR3 vLightDir1( 0, 0, -1); D3DXVec3Normalize( &vLightDir1, &vLightDir1);		
		pDevice->SetDirLightDir( 1, vLightDir1.x, vLightDir1.y, vLightDir1.z );
		pDevice->SetDirLightColor( 1, 0.0f, 0.0f, 0.0f );		
		// 2 Key
		D3DXVECTOR3 vLightDir2( -1, -1, 0); D3DXVec3Normalize( &vLightDir2, &vLightDir2);		
		pDevice->SetDirLightDir( 2, vLightDir2.x, vLightDir2.y, vLightDir2.z );
		pDevice->SetDirLightColor( 2, 0.0f, 0.0f, 0.0f );		

		// モデルをレンダリング		
		m_pModel->Render();
	}
开发者ID:larrson,项目名称:metashader,代码行数:26,代码来源:PreviewerView.cpp



注:本文中的MY_ASSERT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MY_DEVNAME函数代码示例发布时间:2022-05-30
下一篇:
C++ MYTRACE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap