// ElsGameDlg.cpp : implementation file
//*********************************************//
//吴志刚(2003-05) for Microsoft Visual C++6.0
//俄罗斯方块程序
//*********************************************//
#include "stdafx.h"
#include "ElsGame.h"
#include "ElsGameDlg.h"
#include "DlgHelp.h"
#include "DlgSetting.h"
#include "DlgSetFace.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// 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)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CElsGameDlg dialog
CElsGameDlg::CElsGameDlg(CWnd* pParent /*=NULL*/)
: CDialog(CElsGameDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CElsGameDlg)
m_sumLev = _T("");
m_score = _T("");
m_hiscore = _T("");
m_slevel = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_pDlgSetFace=NULL;
}
void CElsGameDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CElsGameDlg)
DDX_Control(pDX, IDC_BTNDOWN, m_BtnDown);
DDX_Control(pDX, IDC_BTNLEFT, m_BtnLeft);
DDX_Control(pDX, IDC_BTNRIGHT, m_BtnRight);
DDX_Control(pDX, IDC_BTNROTATE, m_BtnRotate);
DDX_Text(pDX, IDC_SUMLEV, m_sumLev);
DDX_Text(pDX, IDC_SCORE, m_score);
DDX_Text(pDX, IDC_HISCORE, m_hiscore);
DDX_Text(pDX, IDC_SPEEDLEVEL, m_slevel);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CElsGameDlg, CDialog)
//{{AFX_MSG_MAP(CElsGameDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_COMMAND(IDM_EXIT, OnExit)
ON_COMMAND(IDM_START, OnStart)
ON_WM_TIMER()
ON_WM_KEYDOWN()
ON_COMMAND(IDM_ABOUT, OnAbout)
ON_COMMAND(IDM_CONTENTS, OnContents)
ON_COMMAND(IDM_PAUSE, OnPause)
ON_COMMAND(IDM_LEVEL, OnLevel)
ON_COMMAND(IDM_STOP, OnStop)
ON_COMMAND(IDM_SETFACE, OnSetface)
ON_BN_CLICKED(IDC_BTNROTATE, OnBtnrotate)
ON_BN_CLICKED(IDC_BTNLEFT, OnBtnleft)
ON_BN_CLICKED(IDC_BTNDOWN, OnBtndown)
ON_BN_CLICKED(IDC_BTNRIGHT, OnBtnright)
ON_WM_SHOWWINDOW()
ON_WM_CLOSE()
ON_WM_MOUSEMOVE()
ON_COMMAND(IDM_SAVEBMP, OnSavebmp)
ON_COMMAND(IDM_BACKGROUND, OnBackground)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CElsGameDlg message handlers
BOOL CElsGameDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
//================================================================//
//m_bSupportAlpha=FALSE;
//m_pSetLayerWindow=NULL;
//OSVERSIONINFO os;
//os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
//::GetVersionEx(&os);
//if(os.dwPlatformId == VER_PLATFORM_WIN32_NT)//WindowsNT!
//{
//HMODULE hUser32=GetModuleHandle(_T("USER32.DLL"));
//m_pSetLayerWindow=(lpfn)GetProcAddress(hUser32,_T("SetLayeredWindowAttributes"));
//if(m_pSetLayerWindow)
//{
//::SetWindowLong(*this,GWL_EXSTYLE,::GetWindowLong(*this,GWL_EXSTYLE)|WS_EX_LAYERED);
//m_nCurAlphaDegree=255;
//m_pSetLayerWindow(*this,0,m_nCurAlphaDegree,LWA_ALPHA);
//m_bSupportAlpha=TRUE;
//}
//}
//================================================================//
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
m_hIcon=LoadIcon(AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDR_MAINFRM));
SetIcon(m_hIcon, TRUE); // Set big icon
m_hIcon=LoadIcon(AfxGetApp()->m_hInstance,MAKEINTRESOURCE(IDI_MAINFRMSM));
SetIcon(m_hIcon, FALSE); // Set small icon
////////////////////////init status bar//////////////////////////////
m_wndStatusBar.Create(WS_CHILD|WS_VISIBLE|CCS_BOTTOM,CRect(0,0,0,0),this,102);
int iPartDim[3]={100,370,-1};
m_wndStatusBar.SetParts(2,iPartDim);
m_wndStatusBar.SetText("停止游戏",0,0);
m_wndStatusBar.SetText("方向键控制移动,空格键或上箭头控制旋转",1,0);
////////////////////////////////////////////////////////////////////////
//m_ToolBar
m_wndToolBar.CreateEx(this,TBSTYLE_FLAT,
WS_CHILD|WS_VISIBLE|CBRS_GRIPPER|CBRS_ALIGN_TOP|CBRS_TOOLTIPS,CRect(4,4,0,0));
m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST,AFX_IDW_CONTROLBAR_LAST,0);
////////////////////////按钮初始化////////////////////////
m_BtnDown.SetDirection(CTriangleButton::POINT_DOWN);
m_BtnRotate.SetDirection(CTriangleButton::POINT_UP);
m_BtnLeft.SetDirection(CTriangleButton::POINT_LEFT);
m_BtnRight.SetDirection(CTriangleButton::POINT_RIGHT);
//////////////////Clear Array Load bitmap/////////////////
CWinApp * pApp=AfxGetApp();
m_nBmpType=pApp->GetProfileInt("GAMEFACE","BLOCKTYPE",0);
m_bSameGraph=pApp->GetProfileInt("GAMEFACE","SAMEGRAPH",1);
m_bBackGround=pApp->GetProfileInt("GAMEFACE","BACKGROUND",0);
//////////////////////////////////////////////////////////
if(m_bBackGround)
{
m_strMapPath=pApp->GetProfileString("GAMEFACE","FILEPATH",NULL);
HBITMAP bitmap=(HBITMAP)LoadImage(AfxGetInstanceHandle(),m_strMapPath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
if(bitmap)
{
CMenu* hMenu=GetMenu();
hMenu=hMenu->GetSubMenu(1);
CBitmap hBitmap;
hBitmap.Attach(bitmap);
m_brBack.CreatePatternBrush(&hBitmap);
hMenu->CheckMenuItem(IDM_BACKGROUND,MF_CHECKED);
}
else
m_bBackGround=FALSE;
}
///////////////////////////////////////////////////////////
ReLoadBitmap();
m_nCurBmpIndex=0;
InitTheArray();
m_bPlaying=FALSE;
srand(GetTickCount());
DemoStatic(rand()%7);
/////////////////////////////////////////
m_nSpeedTime=1000;
m_nSpeedLevel=0;
m_nUserSpeed=0;
/////////////////////////////////////////
m_nInitX=20;
m_nInitY=40;
m_rcGame.SetRect(m_nInitX,m_nInitY,m_nInitX+10*20,m_nInitY+19*20);
m_rcNext.SetRect(m_rcGame.right+20,m_rcGame.top,m_rcGame.right+20+80,m_rcGame.top+80);
return TRUE; // return TRUE unless you set the focus to a control
}
void CElsGameDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CElsGameDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetric
没有合适的资源?快使用搜索试试~ 我知道了~
VC编的小游戏
共148个文件
bmp:66个
h:18个
ico:15个
需积分: 0 81 下载量 198 浏览量
2008-06-16
15:20:42
上传
评论 1
收藏 460KB ZIP 举报
温馨提示
VC编写的小游戏,包括扫雷,俄罗斯方块等
资源详情
资源评论
资源推荐
收起资源包目录
VC编的小游戏 (148个子文件)
TcsGame.aps 170KB
ElsGame.aps 81KB
Script1.aps 61KB
Splash.bmp 27KB
PowerLogo.bmp 27KB
DIEWAIT.bmp 15KB
LEVUP.bmp 15KB
SWORD.bmp 9KB
toolbar1.bmp 3KB
Faces.bmp 2KB
LIFE.bmp 1KB
N7.bmp 1KB
N1.bmp 1KB
N8.bmp 1KB
Bomb.bmp 1KB
N5.bmp 1KB
N2.bmp 1KB
Mark.bmp 1KB
Block.bmp 1KB
N3.bmp 1KB
N4.bmp 1KB
Black.bmp 1KB
N6.bmp 1KB
XB_7.bmp 1KB
XB_4.bmp 1KB
3.bmp 1KB
2.bmp 1KB
XB_1.bmp 1KB
XB_5.bmp 1KB
XB_3.bmp 1KB
XB_2.bmp 1KB
6.bmp 1KB
XB_6.bmp 1KB
4.bmp 1KB
7.bmp 1KB
5.bmp 1KB
1.bmp 1KB
Toolbar.bmp 1KB
toolbar1.bmp 886B
SnakeDie.bmp 822B
Tomato.bmp 822B
Gold.bmp 822B
Yellow.bmp 822B
Snake1.bmp 822B
Stone.bmp 822B
Snake.bmp 822B
NUM7.bmp 302B
NUM5.bmp 302B
NUM9.bmp 302B
NUM3.bmp 302B
NUMBACK.bmp 302B
NUM4.bmp 302B
NUM2.bmp 302B
NUM8.bmp 302B
NUM0.bmp 302B
NUM6.bmp 302B
NUM1.bmp 302B
N7.bmp 302B
N1.bmp 302B
N8.bmp 302B
N5.bmp 302B
N9.bmp 302B
N2.bmp 302B
N3.bmp 302B
N4.bmp 302B
N0.bmp 302B
N6.bmp 302B
NBlack.bmp 302B
toolbar2.bmp 238B
ElsGame.clw 3KB
TcsGame.clw 3KB
ElsGameDlg.cpp 36KB
TcsGameDlg.cpp 28KB
Monkey24.cpp 15KB
TriangleButton.CPP 14KB
SplashWnd.cpp 3KB
SplashWnd.cpp 3KB
DlgSetFace.cpp 3KB
ElsGame.cpp 2KB
TcsGame.cpp 2KB
DlgVictory.cpp 2KB
DlgSetting.cpp 1KB
DlgHelp.cpp 998B
StdAfx.cpp 209B
StdAfx.cpp 209B
Thumbs.db 85KB
Thumbs.db 66KB
Thumbs.db 36KB
Monkey24.dsp 7KB
TcsGame.dsp 7KB
ElsGame.dsp 7KB
Monkey24.dsw 541B
ElsGame.dsw 539B
TcsGame.dsw 539B
TcsGame.exe 168KB
ElsGame.exe 108KB
Monkey24.exe 56KB
Monkey24.h 12KB
ElsGameDlg.h 4KB
TcsGameDlg.h 3KB
共 148 条
- 1
- 2
kakaxifsi
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0