• 大小: 2.54M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-27
  • 语言: 其他
  • 标签: 其他  

资源简介

连连看.rar

资源截图

代码片段和文件信息

// ChessBoard.cpp: implementation of the CChessBoard class.
//
//////////////////////////////////////////////////////////////////////

#include “stdafx.h“
#include “LLKanClient.h“
#include “ChessBoard.h“
#include “PlayManager.h“
#include “ChessManager.h“
#include 
using namespace std;

// 声音头文件
#include 
#include 
#pragma comment(lib “WINMM.LIB“)

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CChessBoard::CChessBoard()
{

}

CChessBoard::~CChessBoard()
{

}

int CChessBoard::GetTypeNum()
{
return m_typeNum;
}

int CChessBoard::GetChessNum()
{
return m_chessmanNum;
}

CRect CChessBoard::GetRect()
{
return m_rect;
}

CDC* CChessBoard::GetBufDC()
{
return &m_dcBuf;
}

CDC* CChessBoard::GetMemDC()
{
return m_dcMem;
}

CWnd* CChessBoard::GetCWnd()
{
return m_cwnd;
}

CChessManager* CChessBoard::GetChessManager()
{
return m_chessManager;
}

void CChessBoard::DisableAll()
{
for (int i = 1; i < ROW_NUM - 1; i++)
{
for (int j = 1; j < COL_NUM - 1; j++)
{
if (m_map[i][j]->GetState() != -1)
{
m_map[i][j]->SetState(CChessMan::DISABLE);
m_map[i][j]->Draw();
}
}
}
}

void CChessBoard::DeleteAllChessman()
{
for (int i = 1; i < ROW_NUM - 1; i++)
{
for (int j = 1; j < COL_NUM - 1; j++)
{
m_map[i][j]->SetIndex(-1);
m_map[i][j]->SetState(CChessMan::EMPTY);
m_map[i][j]->Draw();
}
}
}

// 初始化棋盘
void CChessBoard::CreateChessBoard(int x int y int cmW int cmH CPlayManager *manager)
{
m_rect.left = x;
m_rect.top = y;
m_rect.right = x + COL_NUM*cmW;
m_rect.bottom = y + ROW_NUM*cmH;
m_manWidth = cmW;
m_manHeight = cmH;
m_manager = manager;
m_cwnd = m_manager->GetCWnd();
m_chessmanNum = (ROW_NUM - 2) * (COL_NUM - 2);
m_typeNum = 16;
m_hasSelect = NULL;
m_chessManager = new CChessManager;
m_chessManager->InitChessManager(this);

m_bmpChessMan.m_hobject = (HBITMAP)::LoadImage(NULL “res\\play\\chessman.bmp“ IMAGE_BITMAP 0 0 LR_LOADFROMFILE);
m_bmpBKMap.m_hobject = (HBITMAP)::LoadImage(NULL “res\\play\\backgroundmap.bmp“ IMAGE_BITMAP 0 0 LR_LOADFROMFILE);
m_bmpMiniMan.m_hobject = (HBITMAP)::LoadImage(NULL “res\\play\\mini_cell.bmp“ IMAGE_BITMAP 0 0 LR_LOADFROMFILE);
m_dcBuf.CreateCompatibleDC(m_manager->GetDC());
m_dcMem = m_manager->GetDC();

CreatChessMan();
}

// 将棋盘内存DC绘到DC上
void CChessBoard::Draw()
{
ShowMap();
m_dcMem->BitBlt(m_rect.left m_rect.top COL_NUM*m_manWidth ROW_NUM*m_manHeight &m_dcBuf 0 0 SRCCOPY);
InvalidateRect(*(m_manager->GetCWnd()) &m_rect FALSE);
}

// 鼠标左击的处理事件
void CChessBoard::OnLButtonDown(CPoint point)
{
CPoint p((point.y-m_rect.top)/m_manHeight (point.x-m_rect.l

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......      2125  2011-01-08 16:13  连连看\连连看\LLKanClient\ChessBoard.h

    .......      2720  2011-01-04 19:22  连连看\连连看\LLKanClient\ChessMan.cpp

    .......      1090  2011-01-06 17:13  连连看\连连看\LLKanClient\ChessMan.h

    .......      6397  2011-01-09 09:32  连连看\连连看\LLKanClient\ChessManager.cpp

    .......      1191  2011-01-08 16:16  连连看\连连看\LLKanClient\ChessManager.h

    .......      2384  2010-12-19 09:00  连连看\连连看\LLKanClient\ClientUDP.cpp

    .......      1152  2011-01-05 19:40  连连看\连连看\LLKanClient\ClientUDP.h

    .......      3381  2011-01-08 10:07  连连看\连连看\LLKanClient\GameBreviary.cpp

    .......       954  2011-01-08 10:07  连连看\连连看\LLKanClient\GameBreviary.h

    .......      1315  2011-01-10 21:05  连连看\连连看\LLKanClient\GameBtn.h

    .......      5412  2011-01-08 09:12  连连看\连连看\LLKanClient\GamerBox.cpp

    .......       952  2011-01-06 16:53  连连看\连连看\LLKanClient\GamerBox.h

    .......      4855  2011-01-06 16:53  连连看\连连看\LLKanClient\Hall.cpp

    .......      1372  2010-12-19 12:41  连连看\连连看\LLKanClient\Hall.h

    .......      2363  2010-12-12 09:02  连连看\连连看\LLKanClient\JInStream.cpp

    .......      1443  2010-12-12 09:02  连连看\连连看\LLKanClient\JInStream.h

    .......      2316  2010-12-12 09:03  连连看\连连看\LLKanClient\JOutStream.cpp

    .......      1488  2010-12-12 09:03  连连看\连连看\LLKanClient\JOutStream.h

     文件      66048  2011-03-09 20:44  连连看\连连看\LLKanClient\LLKanClient.opt

     文件       4080  2011-03-09 20:44  连连看\连连看\LLKanClient\LLKanClient.clw

     文件     726844  2011-02-28 22:18  连连看\连连看\LLKanClient\LLKanClient.aps

     文件      12832  2011-02-28 22:18  连连看\连连看\LLKanClient\LLKanClient.rc

    .......       547  2010-12-01 14:28  连连看\连连看\LLKanClient\LLKanClient.dsw

    .......      1599  2011-01-08 16:11  连连看\连连看\LLKanClient\LLKanClient.h

     文件     590848  2011-03-09 20:44  连连看\连连看\LLKanClient\LLKanClient.ncb

     文件        256  2011-03-06 10:44  连连看\连连看\LLKanClient\LLKanClient.plg

    .......      8978  2010-12-24 22:27  连连看\连连看\LLKanClient\LLKanClientDlg.cpp

    .......      1883  2010-12-24 22:27  连连看\连连看\LLKanClient\LLKanClientDlg.h

    .......      1991  2010-12-29 21:06  连连看\连连看\LLKanClient\MsgBox.cpp

    .......       830  2010-12-29 21:06  连连看\连连看\LLKanClient\MsgBox.h

............此处省略156个文件信息

评论

共有 条评论