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

📄 scrplay.cpp

📁 源代码演示了在Windows下角色扮演游戏的制作过程
💻 CPP
字号:
//
// Script Player Application
//
//		Copyright (c) 2000-2002 Chihiro.SAKAMOTO (HyperWorks)
//
#include "StdAfx.h"
#include "ScrPlay.h"
#include "resource.h"

//
// 应用程序的实体(Instance)
//
CScrPlayApp	theApp;

//
// 构造函数
//
CScrPlayApp::CScrPlayApp()
{
	hMutex = 0;
}

//
// 析构函数
//
CScrPlayApp::~CScrPlayApp()
{
	if (hMutex)
		::CloseHandle(hMutex);
}

//
// 应用程序初始化
//
BOOL CScrPlayApp::InitInstance()
{
	// 防止应用程序多重启动
	if ((hMutex = ::CreateMutex(NULL, FALSE, ApplicationName "_Running")) == NULL)
		return FALSE;

	DWORD	Ret = ::WaitForSingleObject(hMutex, 0);
	if (Ret == WAIT_TIMEOUT || Ret == WAIT_FAILED)
		return FALSE;

	// 显示模式若不是真彩模式则不能启动
	HDC		dc = GetDC(0);
	int		nbits = GetDeviceCaps(dc, BITSPIXEL);
	ReleaseDC(0, dc);

	if (nbits < 15) {
		::MessageBox(0, "不能在256色以下模式启动。\n请更改显示模式。",
			ApplicationTitle, MB_ICONSTOP|MB_OK);
		return FALSE;
	}

	// 建立主窗口
	if (!MainWin.Create(this, ApplicationTitle, LoadMenu(IDC_APPMENU)))
		return FALSE;

	MainWnd = &MainWin;

	return TRUE;
}

⌨️ 快捷键说明

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