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

📄 gstools.cpp

📁 混乱竞技场的全套代码,客户端资源可以网上搜
💻 CPP
字号:
// GsTools.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "GsTools.h"

#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGsToolsApp

BEGIN_MESSAGE_MAP(CGsToolsApp, CWinApp)
	//{{AFX_MSG_MAP(CGsToolsApp)
	ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CGsToolsApp construction

CGsToolsApp::CGsToolsApp()
{
	// TODO: add construction code here,
	m_dwSpeedRate	= 10;
	m_isFullspeedMode	= false;
	m_enableBackgroundActive	= false;//false;
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CGsToolsApp object

CGsToolsApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CGsToolsApp initialization

BOOL CGsToolsApp::InitInstance()
{
	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));


	// To create the main window, this code creates a new frame window
	// object and then sets it as the application's main window object.
	InitIconList();

	CMainFrame* pFrame = new CMainFrame;
	m_pMainWnd = pFrame;

	// create and load the frame with its resources

	if(!pFrame->LoadFrame(IDR_MAINFRAME,
		WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
		NULL))
	{
		ASSERT(FALSE); // Unable to load frame
		return FALSE;
	}



	// If you want to automatically load the last active workspace, you
	// could use the following code. From inside this method, you can also 
	// load a workspace from a command line parameter if your application
	// parses the command line.
	// Additional note: The default mode is set in the call to InitWorkspaceMgrEx
	// in CMainFrame::OnCreate.  It can be changed there, or may be modified by
	// calling SECWorkspaceManagerEx::SetRegistryMode.
#ifdef LOAD_LAST_WORKSPACE_ON_STARTUP
	SECWorkspaceManagerEx* pWsMgr = ((SECFrameWnd*)m_pMainWnd)->GetWorkspaceMgrEx();
	if (pWsMgr) {
		pWsMgr->OpenWorkspace(TRUE);		// True to open MRU workspace, False to Prompt
	}
#endif


	InitApp(pFrame->GetSafeHwnd());

	g_config.SetINIFile((LPCSTR)(CString(GetAppPath(NULL)) + _T("\\GsTools.cfg")));

	// The one and only window has been initialized, so show and update it.
	pFrame->ShowWindow(SW_SHOW);
	pFrame->UpdateWindow();


	g_pMainFrame	= pFrame;
	pFrame->InitWorkSpace();

 	g_pWizard->InitTree();


	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CGsToolsApp message handlers





/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
		// No message handlers
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

// App command to run the dialog
void CGsToolsApp::OnAppAbout()
{
	CAboutDlg aboutDlg;
	aboutDlg.DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// CGsToolsApp message handlers


VOID CGsToolsApp::InitIconList()
{
	// TODO: create and load your image lists
	CBitmap bmp;
	// normal tree images
	g_icon_list_small.Create(16,
				 16,
				 ILC_COLOR8|ILC_MASK,
				 32,	// number of initial images
				 32);
	g_icon_list_large.Create(32,
				 32,
				 ILC_COLOR8|ILC_MASK,
				 32,	// number of initial images
				 32);

	g_icon_list_state.Create(IDB_STATEICONS, 16, 1, RGB(255, 0, 0));

	ASSERT(g_icon_list_small.m_hImageList);
	ASSERT(g_icon_list_large.m_hImageList);
	ASSERT(g_icon_list_state.m_hImageList);

	HICON hIcon;
	//0 文件夹
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_CFOLDER));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//1 打开文件夹
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_OFOLDER));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//2 资源
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_GSS));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//3 纹理
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_TEX));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//4 动画
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_TXG));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//5 PGM
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_PGM));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//6 PGG
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_PGG));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//7 BMP
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_BMP));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//8 TGA
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_TGA));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);
	//9 JPG
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_JPG));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);



	//10 音效
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_WAVE));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);

	//11 TXT
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_TXT));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);

	//12 INI
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_INI));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);

	//13 
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_UNKNOWN));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);

	//14 
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_AUDIO));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);

	//15
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_VIDEO));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);

	//16
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_MAP));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);

	//17 font
	hIcon = ::LoadIcon (AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_FNT));
	ASSERT( hIcon );
	g_icon_list_small.Add(hIcon);
	g_icon_list_large.Add(hIcon);

}

int CGsToolsApp::ExitInstance() 
{
	// TODO: Add your specialized code here and/or call the base class
	g_source.Cleanup();
	return CWinApp::ExitInstance();
}


VOID CGsToolsApp::OnLpsChange(float fLps)
{
	sprintf(g_strInfo, "fps:%.02f",fLps );
}

⌨️ 快捷键说明

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