c_cpp pass_function_in_the_class.cpp

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp pass_function_in_the_class.cpp相关的知识,希望对你有一定的参考价值。

// This is from the introduce to 3D game program with directx 11.

// The MainWndProc can't in the class.
// And the MsgProc function is in the class.
// But the MainWndProc need to call MsgProc.
// Also, D3DApp is a abstract class.

// This method is so good.
namespace
{
	D3DApp* gd3dApp = nullptr;
}

LRESULT CALLBACK
MainWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
	return gd3dApp->MsgProc( hwnd, msg, wParam, lParam );
}

D3DApp::D3DApp()
{
	gd3dApp = this;
}

LRESULT D3DApp::MsgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { /* some code */}

bool D3DApp::InitMainWindow()
{
	WNDCLASS wc;
	wc.lpfnWndProc = MainWndProc;
}

以上是关于c_cpp pass_function_in_the_class.cpp的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp 127.单词阶梯

c_cpp MOFSET

c_cpp MOFSET

c_cpp 31.下一个排列

c_cpp string→char *

c_cpp 54.螺旋矩阵