亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? childview.cpp

?? C:Documents and SettingsAdministrator桌面VC++多媒體特效制作百例CHAR22Tearing
?? CPP
字號:
// ChildView.cpp : implementation of the CChildView class
//

#include "stdafx.h"
#include "Tearing Demo.h"
#include "ChildView.h"
#include "DDExcept.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChildView

CChildView::CChildView() :
	m_iCurX(0),
	m_bFlip(FALSE)
{
}

CChildView::~CChildView()
{
}


BEGIN_MESSAGE_MAP(CChildView,CWnd )
	//{{AFX_MSG_MAP(CChildView)
	//}}AFX_MSG_MAP
	// Destruction
	ON_WM_CHAR()
	ON_WM_DESTROY()
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CChildView helpers

BOOL CChildView::InitDD()
{
	BOOL bReturn = TRUE;
	HRESULT hr = S_OK;
	try {
		// Create the DirectDraw object.  We won't need the
		// capabilities of IDirectDraw2, so there isn't
		// a need to QI.
		hr = DirectDrawCreate(NULL,&m_pIDirectDraw,NULL);
		if FAILED( hr ) {
			// Some error
			throw new CDDException(TRUE,"Error creating DirectDraw object");
		} // if

		// Set our cooperative level to be full screen/exclusive...
		hr = m_pIDirectDraw->SetCooperativeLevel(m_hWnd,
						DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
		if FAILED( hr ) {
			// Some error
			throw new CDDException(TRUE,"Error setting cooperative level");
		} // if

		// Set the display mode to 640 by 480, 256 colors.  Normally
		// you would query the driver to see if this mode is
		// supported, but this particular mode is always available. 
		hr =  m_pIDirectDraw->SetDisplayMode(640,480,8);
		if ( FAILED( hr ) ) {
			// Some error
			throw new CDDException(TRUE,"Error setting display mode");
		} // if

		// Create our primary surface
		DDSURFACEDESC ddsd;
		ZeroMemory(&ddsd,sizeof(ddsd));
		ddsd.dwSize = sizeof(ddsd);
		ddsd.dwFlags = DDSD_CAPS;
		ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
		if ( m_bFlip ) {
			// Add the enhancements for page flipping
			ddsd.dwFlags |= DDSD_BACKBUFFERCOUNT;
			ddsd.ddsCaps.dwCaps |= DDSCAPS_FLIP | 
								  DDSCAPS_COMPLEX |
								  DDSCAPS_VIDEOMEMORY;
			ddsd.dwBackBufferCount = NUMBUFFERS;
		} // if
    
		hr = m_pIDirectDraw->CreateSurface(&ddsd,&m_lpDDSPrimary,NULL);
		if ( FAILED( hr ) ) {
			// Some error
			throw new CDDException(TRUE,"Error creating primary surface");
		} // if

		// Check the surface format...will we need a palette?
		DDPIXELFORMAT ddpf;
		ZeroMemory(&ddpf,sizeof(ddpf));
		ddpf.dwSize = sizeof(ddpf);
		hr = m_lpDDSPrimary->GetPixelFormat(&ddpf);
		if ( FAILED( hr ) ) {
			// Some error
			throw new CDDException(TRUE,"Error retrieving pixel format");
		} // if

		if ( ddpf.dwFlags & DDPF_PALETTEINDEXED8 ) {
			// We are palettized, so create a palette and attach it to
			// the primary surface.
			hr = LoadDDPalette(IDB_CAN,&m_lpDDPalette);
			if ( FAILED( hr ) ) {
				// Some error
				throw new CDDException(TRUE,"Error establishing a new palette");
			} // if

			m_lpDDSPrimary->SetPalette(m_lpDDPalette);
			if ( FAILED( hr ) ) {
				// Some error
				throw new CDDException(TRUE,"Error assigning the new palette to the primary surface");
			} // if
		} // if

		// Load our can bitmap
		hr = LoadDDBitmap(IDB_CAN,&m_lpDDSCan);
		if ( FAILED( hr ) ) {
			// Some error
			throw new CDDException(TRUE,"Error loading table bitmap");
		} // if
		
		if ( m_bFlip ) {
			// Locate our secondary surface
			DDSCAPS ddscaps;
			ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
			hr = m_lpDDSPrimary->GetAttachedSurface(&ddscaps,&m_lpDDSSecondary);
			if ( FAILED( hr ) ) {
				// Some error
				throw new CDDException(TRUE,"Error retrieving secondary back buffer");
			} // if
		} // if
		else {
		// Create our back buffer
			hr = CreateSecondarySurface(640,480,&m_lpDDSSecondary);
			if ( FAILED( hr ) ) {
				// Some error
				throw new CDDException(TRUE,"Error creating secondary back buffer");
			} // if
		} // else
	} // try
	catch (CDDException* dde) {
		// Intercept our special exception and
		// tell user of error
		dde->ReportError(MB_OK | MB_ICONERROR,hr);

		// Delete the exception
		dde->Delete();

		// Return failure
		bReturn = FALSE;
	} // catch
	catch (...) {
		// Return failure
		bReturn = FALSE;
	} // catch

	// NOTE:  At this point the window has been
	// created.  If we threw an exception and are
	// returning -1 (to indicate failure during
	// creation), a WM_DESTROY message will still
	// be issued.  The net result is if we created
	// and DirectDraw objects prior to the
	// exception, they will automatically be
	// released at that time.  No special action is
	// required here.
	return bReturn;
}

void CChildView::ReleaseDDObjects()
{
	// Release our surfaces first.  The order in which
	// DirectDraw objects are released is important.
	// Surfaces first, then the palette, then finally
	// the DirectDraw object.
	if ( !m_bFlip ) {
		// When we're not page flipping, we release the
		// DirectDraw objects in the normal order.
		m_lpDDSPrimary = NULL;
		m_lpDDSSecondary = NULL;
	} // if
	else {
		// When we're page flipping, we reverse the order
		// of release for the primary and secondary 
		// surfaces.  This is because they really are
		// the SAME surface and must be released in an
		// order opposite to that which created them.
		m_lpDDSSecondary = NULL;
		m_lpDDSPrimary = NULL;
	} // else
	m_lpDDSCan = NULL;

	// Now the palette.  If we never created one,
	// this call will still succeed (thanks to
	// CComPtr).
	m_lpDDPalette = NULL;

	// Finally release our DirectDraw object
	m_pIDirectDraw = NULL;
}

LRESULT CChildView::AnimateFrame()
{
	// Calculate new coordinates
	static BOOL bMoveRight = TRUE;
	if ( bMoveRight ) {
		++m_iCurX;
		if ( m_iCurX >= (480-CANWIDTH-1) ) {
			// Bounce off of right-hand edge
			m_iCurX -= 2;
			bMoveRight = FALSE;
		} // if
	} // if
	else {
		--m_iCurX;
		if ( m_iCurX < 0 ) {
			// Bounce off of left-hand edge
			m_iCurX = 1;
			bMoveRight = TRUE;
		} // if
	} // else

	// Blt our bitmap
	Blt(m_iCurX);

	return 1;
}

/////////////////////////////////////////////////////////////////////////////
// CChildView message handlers

BOOL CChildView::Create(BOOL bEnableFlipping /*=FALSE*/) 
{
	// Register a new window class
	LPCSTR strClass = AfxRegisterWndClass(CS_DBLCLKS,
						::LoadCursor(NULL,IDC_ARROW),
						(HBRUSH)GetStockObject(WHITE_BRUSH),
						AfxGetApp()->LoadIcon(IDR_MAINFRAME));

	if ( !CreateEx(WS_EX_APPWINDOW,strClass,_T("Tearing Demo"),WS_SYSMENU | WS_POPUP | WS_VISIBLE,
		0,0,::GetSystemMetrics(SM_CXSCREEN),::GetSystemMetrics(SM_CYSCREEN),NULL,NULL,0) ) {
		// Failed to create the window
		return FALSE;
	} // if

	// Paint ourselves
	UpdateWindow();

	// Init DirectDraw
	m_bFlip = bEnableFlipping;
	return InitDD();
}

void CChildView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	// Check for <Esc>
	if ( nChar == VK_ESCAPE ) {
		// User wants to quit...
		CTearingDemoApp* pApp = (CTearingDemoApp*)AfxGetApp();
		ASSERT(pApp != NULL);
		pApp->Stop();
	} // if

	CWnd::OnChar(nChar,nRepCnt,nFlags);
}

void CChildView::PostNcDestroy() 
{
	// Call our base class
	CWnd::PostNcDestroy();

	// Destroy our CWnd pointer
	delete this;
}

BOOL CChildView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
	// No cursor
	::SetCursor(NULL);
	return TRUE;
}

void CChildView::OnDestroy() 
{
	// Release our DirectDraw objects (just making
	// sure they're gone...)
	ReleaseDDObjects();

	CWnd::OnDestroy();
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲电影一级片| 日本欧美一区二区| 欧美日韩激情在线| 国产精品一色哟哟哟| 亚洲一区二区四区蜜桃| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 欧美精选一区二区| 高清不卡一区二区| 日本免费新一区视频| 亚洲欧美激情在线| 国产日韩欧美激情| 91麻豆精品国产91久久久使用方法| 国产成人精品一区二区三区四区 | 国产丶欧美丶日本不卡视频| 亚洲乱码国产乱码精品精可以看| 精品福利二区三区| 欧美日韩亚洲国产综合| 91蜜桃在线免费视频| 国产一区激情在线| 午夜精品福利在线| 亚洲精品日产精品乱码不卡| 国产三级精品三级| 欧美xfplay| 91麻豆精品国产自产在线| 色偷偷成人一区二区三区91 | 91欧美激情一区二区三区成人| 麻豆国产精品视频| 性做久久久久久免费观看| 亚洲欧美区自拍先锋| 国产精品乱码妇女bbbb| 精品日韩一区二区| 日韩三级在线观看| 777a∨成人精品桃花网| 欧美色爱综合网| 91偷拍与自偷拍精品| av在线这里只有精品| 国产福利91精品一区二区三区| 蜜桃久久av一区| 日韩福利电影在线观看| 日韩精品久久理论片| 午夜精品久久一牛影视| 亚洲综合色视频| 亚洲国产毛片aaaaa无费看| 一区二区三区不卡在线观看| 亚洲日本电影在线| 亚洲精品日韩一| 亚洲综合色网站| 亚洲成人av免费| 午夜av一区二区| 日本伊人精品一区二区三区观看方式| 亚洲国产视频在线| 亚洲大片在线观看| 日韩国产欧美在线观看| 裸体歌舞表演一区二区| 激情av综合网| 国产91丝袜在线18| 91麻豆免费视频| 欧美在线观看视频一区二区三区| 在线观看不卡视频| 在线不卡中文字幕| 日韩一级二级三级| 久久久久久久国产精品影院| 日本一区二区三区电影| 亚洲色图清纯唯美| 丝袜诱惑制服诱惑色一区在线观看 | 国产一区二区三区在线观看免费| 国产传媒日韩欧美成人| thepron国产精品| 欧美性色aⅴ视频一区日韩精品| 欧美男男青年gay1069videost| 91精品国产黑色紧身裤美女| 精品久久久久久久人人人人传媒| 久久精品日韩一区二区三区| 国产精品传媒在线| 日韩精品乱码av一区二区| 国产在线一区观看| 色综合欧美在线| 精品人伦一区二区色婷婷| 国产精品久久久久久亚洲伦| 亚洲福中文字幕伊人影院| 久久草av在线| 91免费版在线看| 日韩视频在线观看一区二区| 亚洲国产精品ⅴa在线观看| 亚洲激情综合网| 国产在线一区观看| 欧美性色欧美a在线播放| 精品久久久三级丝袜| 有码一区二区三区| 激情综合色丁香一区二区| 99久久久久久| 精品国产伦一区二区三区免费| 国产精品国产三级国产有无不卡 | 久久网这里都是精品| 夜夜嗨av一区二区三区| 激情深爱一区二区| 欧美亚洲自拍偷拍| 中文av一区二区| 免费一级欧美片在线观看| 99久久国产免费看| 精品国产三级a在线观看| 一区二区三区中文字幕精品精品 | 一区二区在线免费观看| 激情图片小说一区| 67194成人在线观看| 一色屋精品亚洲香蕉网站| 久久爱www久久做| 欧美午夜电影一区| 综合网在线视频| 国产成人av电影在线播放| 日韩免费一区二区| 亚洲成a人在线观看| 94-欧美-setu| 中文字幕久久午夜不卡| 狠狠色丁香婷婷综合| 7878成人国产在线观看| 一区二区免费在线播放| 99精品国产91久久久久久| 久久婷婷色综合| 精品在线一区二区| 91精品国产综合久久国产大片| 一区二区三区.www| 成人av网站在线观看| 精品国产一区二区三区不卡| 亚洲精品中文字幕在线观看| 青青青爽久久午夜综合久久午夜| 91免费视频网址| 美女一区二区三区| 欧美性视频一区二区三区| 国产精品久久久久久久久快鸭| 国内外精品视频| 日韩视频不卡中文| 日本不卡不码高清免费观看| 色综合久久天天| 精品动漫一区二区三区在线观看| 麻豆freexxxx性91精品| 欧美视频中文一区二区三区在线观看| 中文字幕国产一区二区| 狠狠狠色丁香婷婷综合激情 | av日韩在线网站| 久久女同互慰一区二区三区| 蜜臀av国产精品久久久久| 顶级嫩模精品视频在线看| 日本一区二区综合亚洲| 国产乱码精品1区2区3区| 欧美草草影院在线视频| 日韩国产精品久久| 91九色最新地址| 午夜私人影院久久久久| 欧美在线观看你懂的| 亚洲图片欧美视频| 色天天综合久久久久综合片| 亚洲成人激情自拍| 欧美精品 国产精品| 一区二区三区在线播放| 色婷婷av一区二区三区gif| 亚洲女同ⅹxx女同tv| 欧美日韩一区二区三区高清| 亚洲激情图片一区| 欧美在线你懂得| 石原莉奈一区二区三区在线观看| 欧美体内she精高潮| 国产精品麻豆视频| 欧美亚洲综合在线| 天天操天天综合网| 日韩欧美在线影院| 精品影院一区二区久久久| 国产精品嫩草影院com| 成人av免费在线播放| 亚洲乱码日产精品bd| 欧美性色综合网| 久久se这里有精品| 久久众筹精品私拍模特| 国产精品99久久久久| 国产精品久久福利| 色妞www精品视频| 久久av老司机精品网站导航| 国产偷国产偷亚洲高清人白洁| 成人精品免费看| 亚洲黄一区二区三区| 日韩情涩欧美日韩视频| 国产精品亚洲午夜一区二区三区| 亚洲国产精品高清| 欧美优质美女网站| 国产不卡在线视频| 一区二区三区中文在线观看| 欧美一区二区私人影院日本| 国产一区三区三区| 亚洲一区中文在线| 欧美成人精精品一区二区频| 国产经典欧美精品| 伊人开心综合网| 日韩一区二区三区在线视频| 99国产精品久久久久久久久久 | 亚洲一区二区三区美女| 26uuu亚洲综合色欧美 | 欧美日本一区二区三区四区| 久久精品国产**网站演员| 欧美激情一区在线| 色婷婷久久综合|