⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tearing demo.cpp

📁 C:Documents and SettingsAdministrator桌面VC++多媒体特效制作百例CHAR22Tearing
💻 CPP
字号:
// Tearing Demo.cpp : Defines the class behaviors for the application.
//

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

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

/////////////////////////////////////////////////////////////////////////////
// CTearingDemoApp

BEGIN_MESSAGE_MAP(CTearingDemoApp, CWinApp)
	//{{AFX_MSG_MAP(CTearingDemoApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTearingDemoApp construction

CTearingDemoApp::CTearingDemoApp() :
	m_bStop(FALSE)
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CTearingDemoApp object

CTearingDemoApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CTearingDemoApp initialization

BOOL CTearingDemoApp::InitInstance()
{
	// Ask what type of demo the use wants
	BOOL bEnable = FALSE;
	CDemoTypeDialog dlgType;
	if ( dlgType.DoModal() == IDOK ) {
		// Enable flipping
		bEnable = TRUE;
	} // if

	// Create the main window
	CChildView* pView = new CChildView;
	m_pMainWnd = pView;
	return pView->Create(bEnable);
}

/////////////////////////////////////////////////////////////////////////////
// CTearingDemoApp message handlers

int CTearingDemoApp::Run() 
{
	// TODO: Add your specialized code here and/or call the base class
	CChildView* pView = reinterpret_cast<CChildView*>(m_pMainWnd);
	ASSERT(pView != NULL);
	if ( pView != NULL ) {
		// For performance reasons, we handle the messages
		// ourselves when the demo is running...
		MSG msg;
		while ( TRUE ) {
			if ( m_bStop ) {
				// We're quitting
				m_pMainWnd->DestroyWindow();
				ExitInstance();
				return 0;
			} // if
			if ( ::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE) ) {
				// We have messages...
				if ( !::GetMessage(&msg,NULL,0,0) ) {
					ExitInstance();
					return msg.wParam;
				} // if
				// Translate and dispatch
				::TranslateMessage(&msg);
				::DispatchMessage(&msg);
			} // if
			else if ( !m_bStop ) {
				// Nothing else to do, next frame please...
				pView->AnimateFrame();
			} // else if
			else {
				// Sleep
				::WaitMessage();
			} // else
		} // while
	} // if

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -