• 大小: 595KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-05-13
  • 语言: C/C++
  • 标签: MFC  opengl  

资源简介

基于MFC的华容道小程序,有界面,有说明文档可以里用鼠标点击实现棋子移动,IDE是基于VC6.0,需要安装opengl的相关文档

资源截图

代码片段和文件信息

// cell.cpp: implementation of the cell class.
//
//////////////////////////////////////////////////////////////////////

#include “stdafx.h“
#include “Hroad.h“
#include “cell.h“

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

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

cell::cell()
{

}

cell::~cell()
{

}
bool cell::CopyCell(cell tcell)
{
chessname=tcell.Getchessname();
cellstate=tcell.Getcellstate();
tcell.clear();
return true;
}

bool cell::clear()
{
chessname=CN_EMPTY;
cellstate=CS_EMPTY;
return true;
}

void cell::Setpos(GLfloat xGLfloat y)
{
pos_x=x;
pos_y=y;
}

void cell::Setchessname(GLint name)
{
chessname=name;
}

void cell::Setcellstate(GLint state)
{
cellstate=state;
}

int cell::Getchessname()
{
return chessname;
}

int cell::Getcellstate()
{
return cellstate;
}

bool cell::DrawChess(GLuint *texture)
{
glPushMatrix();
glTranslatef(pos_xpos_y0.0);

switch (chessname)
{
case CN_CAOCAO:
glBindTexture(GL_TEXTURE_2D texture[0]);
break;
case CN_ZHANGFEI:
switch (cellstate)
{
case CS_LEFT:
case CS_RIGHT:
glBindTexture(GL_TEXTURE_2D texture[6]);
break;
case CS_BOTTOM:
case CS_TOP:
glBindTexture(GL_TEXTURE_2D texture[7]);
break;
}
break;
case CN_ZHAOYUN:
switch (cellstate)
{
case CS_LEFT:
case CS_RIGHT:
glBindTexture(GL_TEXTURE_2D texture[8]);
break;
case CS_BOTTOM:
case CS_TOP:
glBindTexture(GL_TEXTURE_2D texture[9]);
break;
}
break;
case CN_MACHAO:
switch (cellstate)
{
case CS_LEFT:
case CS_RIGHT:
glBindTexture(GL_TEXTURE_2D texture[4]);
break;
case CS_BOTTOM:
case CS_TOP:
glBindTexture(GL_TEXTURE_2D texture[5]);
break;
}
break;
case CN_GUANYU:
switch (cellstate)
{
case CS_LEFT:
case CS_RIGHT:
glBindTexture(GL_TEXTURE_2D texture[1]);
break;
case CS_BOTTOM:
case CS_TOP:
glBindTexture(GL_TEXTURE_2D texture[1]);
break;
}
break;

case CN_HUANGZHONG:
switch (cellstate)
{
case CS_LEFT:
case CS_RIGHT:
glBindTexture(GL_TEXTURE_2D texture[2]);
break;
case CS_BOTTOM:
case CS_TOP:
glBindTexture(GL_TEXTURE_2D texture[3]);
break;
}
break;
case CN_BIN:
case CN_YONG:
case CN_ZU:
case CN_DIN:
glBindTexture(GL_TEXTURE_2D texture[10]);
break;
case CN_EMPTY:
glBindTexture(GL_TEXTURE_2Dtexture[12]);
break;


}
glBegin(GL_QUADS);
switch (cellstate)
{
case CS_TOPLEFT:
glTexCoord2f(0.0f0.5f);glVertex3f(0.00.00.0);
glTexCoord2f(0.5f0.5f);glVertex3f(1.00.00.0);
glTexCoord2f(0.5f1.0f);glVertex3f(1.01.00.0);
glTexCoord2f(0.0f1.0f);glVertex3f(0.01.00.0);
break;
case CS_TOPRIGHT:
glTexCoord2f(0.5f0.5f);glVe

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-04-13 11:44  华容道\
     目录           0  2020-04-13 11:44  华容道\Hroad\
     文件        4913  2020-03-25 09:14  华容道\Hroad\cell.cpp
     文件        2487  2011-04-24 20:19  华容道\Hroad\cell.h
     目录           0  2020-04-13 11:44  华容道\Hroad\Debug\
     文件      163903  2020-04-09 21:01  华容道\Hroad\Debug\Hroad.exe
     文件        4191  2011-04-24 19:13  华容道\Hroad\Hroad.cpp
     文件        4655  2011-04-24 20:24  华容道\Hroad\Hroad.dsp
     文件         518  2011-04-24 19:43  华容道\Hroad\Hroad.dsw
     文件        1345  2011-04-24 19:13  华容道\Hroad\Hroad.h
     文件        1722  2011-04-24 19:13  华容道\Hroad\HroadDoc.cpp
     文件        1464  2011-04-24 19:13  华容道\Hroad\HroadDoc.h
     文件       15217  2020-04-09 21:00  华容道\Hroad\HroadView.cpp
     文件        2866  2020-04-09 21:00  华容道\Hroad\HroadView.h
     文件        2366  2020-04-09 21:01  华容道\Hroad\MainFrm.cpp
     文件        1440  2020-04-09 20:59  华容道\Hroad\MainFrm.h
     目录           0  2020-04-13 11:44  华容道\Hroad\picture\
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\关羽1.bmp
     文件       12342  2008-11-19 00:00  华容道\Hroad\picture\兵.bmp
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\张飞1.bmp
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\张飞2.bmp
     文件       49206  2008-11-19 00:00  华容道\Hroad\picture\曹操.bmp
     文件       49206  2008-11-15 00:00  华容道\Hroad\picture\空格纹理.bmp
     文件       43254  1999-12-26 00:00  华容道\Hroad\picture\背景纹理.bmp
     文件       22047  2000-03-19 00:00  华容道\Hroad\picture\背景纹理2.bmp
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\赵云1.bmp
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\赵云2.bmp
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\马超1.bmp
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\马超2.bmp
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\黄忠1.bmp
     文件       24630  2008-11-19 00:00  华容道\Hroad\picture\黄忠2.bmp
............此处省略10个文件信息

评论

共有 条评论