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

📄 showlist.h

📁 空战游戏flacon源码
💻 H
字号:
//___________________________________________________________________

#include <afxwin.h>
#include <mmsystem.h>
#include <mpr.h>
#include "..\..\..\3Dlib\3d.h"
#include "..\..\..\utils\loader.h"
#include "graphics.h"
#include "keyboard.h"

#define	TOTAL_OBJECTS	16

//___________________________________________________________________

class CShowList : public CFrameWnd {
public:
	CShowList();
	afx_msg void OnMove (int x, int y);
	afx_msg void OnKeyUp (UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnKeyDown (UINT nChar, UINT nRepCnt, UINT nFlags);
	DECLARE_MESSAGE_MAP()
};

CShowList::CShowList() 
{
	Create(NULL, "ShowList v1.0");
}

struct objectStructure {
	GLint		objectID;
	GLint		objectheading, objectclimb, objectbank;
	GLmatrix	objectMatrix;
	GLvertex	objcoord;
	GLfloat		scale;
	GLAnimation *anim;
};

class CShowListApp : public CWinApp {
//___________________________________________________________________
protected:
	GLViewport	myViewport;
	ContextMPR	*myContext;
	GLmatrix	myCameraMatrix, myBillboardMatrix, myBillboard1Matrix;
	GLint		cameraheading, cameraclimb, camerabank;
	GLint		objectheading, objectclimb, objectbank;
	GLint		bgcolor, colormode, cameraangle, keypressed;
	GLvertex	curcenter, originalcoord;
	GLvertex	centercoord;
	GLvertex	lightdir, lightcoord;
	objectStructure	obj[TOTAL_OBJECTS];
	GLfloat		TotalFrameRate;
	GLint		TimerStart;
	GLint		shadowflag, currentflag, currentstate;
	GLint		textureset;
GLAnimation	*anim;
//___________________________________________________________________
public:
	GLfloat		CurrentFrameRate;
	GLGraphics	myGraphics;
	BOOL	InitInstance();
	BOOL	ExitInstance();
	BOOL	OnIdle (LONG lCount);
//___________________________________________________________________
	void	SetCamera();
	void	SetCameraAngle();
	void	CheckKeyReleased (WPARAM wParam);
	GLint	ProcessInput (WPARAM wParam, HWND hWnd);
	void	ProgramLoop();
	BOOL	InitProgram ();
	void	ExitProgram ();
	void	StartTimer ();
	void	CalculateFramerate ();
};

//___________________________________________________________________

BOOL CShowListApp::InitInstance()
{
	m_pMainWnd = new CShowList;
	m_pMainWnd -> ShowWindow (m_nCmdShow);
	m_pMainWnd -> UpdateWindow();
	return InitProgram();
}

BOOL CShowListApp::ExitInstance()
{
	ExitProgram ();
	return TRUE;
}

BOOL CShowListApp::OnIdle (LONG lCount)
{
	if (CWinApp::OnIdle(lCount)) return TRUE;
	ProgramLoop();
	return TRUE;
}

CShowListApp App;

BEGIN_MESSAGE_MAP (CShowList, CFrameWnd)
	ON_WM_MOVE()
	ON_WM_KEYUP()
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()

afx_msg void CShowList::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	App.CheckKeyReleased (nChar);
}

afx_msg void CShowList::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	HWND hWnd = App.m_pMainWnd -> GetSafeHwnd();
	if (App.ProcessInput (nChar, hWnd)) {
		PostQuitMessage (0);
		return;
	}
}

afx_msg void CShowList::OnMove(int x, int y)
{
	HWND hWnd = App.m_pMainWnd -> GetSafeHwnd();
	App.myGraphics.WindowMove (hWnd);
}

//___________________________________________________________________

⌨️ 快捷键说明

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