91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 525KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-20
  • 語言: 其他
  • 標簽: C++??Qt??中國象棋??

資源簡介

開發環境:LinuxMint 17.1 開發工具:QtCreator 3.3.1 Qt版本:5.4.1 功能:實現了人機對戰,網絡對戰,自己和自己下棋三種模式。主要功能包括重復局面檢測,長將判負,悔棋,提示音播放,死棋檢測,中文著法顯示,步時限制,保存棋局到文件和從文件加載棋局。總共代碼有5000行左右,歷時200多個小時。

資源截圖

代碼片段和文件信息

#include?“chessboard.h“
#include?“commdef.h“
#include?
#include?

ChessBoard::ChessBoard(QWidget?*parent)?:?QWidget(parent)
{
????resize(CHESSBOARD_WIDTH?CHESSBOARD_HEIGHT);
????move(CHESSBOARD_STARTX?CHESSBOARD_STARTY);
????fliped?=?false;
????loadPixmap(STARTUP_LAYOUT);
}

ChessBoard::~ChessBoard()
{
}

void?ChessBoard::paintEvent(QPaintEvent?*event)
{
????Q_UNUSED(event);
????int?xx?=?0;
????int?yy?=?0;
????int?index?=?0;

????QPainter?painter(this);
????painter.drawPixmap(0?0?background);

????for?(int?row?=?0;?row?????{
????????for?(int?column?=?0;?column?????????{
????????????index?=?row?*?CHESSBOARD_COLUMN?+?column;
????????????getPixmapPos(row?column?xx?yy);
????????????painter.drawPixmap(xx?yy?arrChessman[index]);
????????}
????}
}

void?ChessBoard::mousePressEvent(QMouseEvent?*event)
{
????if?(event->button()?==?Qt::LeftButton)?{
????????int?row?=?0;
????????int?column?=?0;
????????getPixmapIndex(event->pos().x()?event->pos().y()?row?column);

????????int?sq?=?getChessmanIndex(row?column?fliped);
????????emit?doMove(sq);
????}
}

void?ChessBoard::loadPixmap(const?char?*chessman)
{
????int?sq?=?0;
????char?pc?=?0;
????int?index?=?0;

????background.load(“:/images/WOOD.GIF“);
????for(int?row?=?0;?row?????{
????????for?(int?column?=?0;?column?????????{
????????????index?=?row?*?CHESSBOARD_COLUMN?+?column;
????????????sq?=?getChessmanIndex(row?column?fliped);
????????????pc?=?chessman[sq];
????????????arrChessman[index].load(getChessmanPic(pc?false?false));

????????}
????}

}

void?ChessBoard::showMoveRoute(char?movingChessman?int?move?bool?show)
{
????int?srcPos?=?SRC(move);
????int?dstPos?=?DST(move);
????int?srcIndex?=?0;
????int?dstIndex?=?0;

????if?(srcPos?>?0)
????{
????????srcIndex?=?getChessboardCoord(FILE_X(srcPos)?RANK_Y(srcPos)?fliped);
????????arrChessman[srcIndex].load(getChessmanPic(dstPos?>?0???0?:?movingChessman?show?false));
????}

????if?(dstPos?>?0)
????{
????????dstIndex?=?getChessboardCoord(FILE_X(dstPos)?RANK_Y(dstPos)?fliped);
????????arrChessman[dstIndex].load(getChessmanPic(movingChessman?show?false));
????}
}

void?ChessBoard::updateGeneralDisplay(char?chessman?int?pos?bool?dead)
{
????int?index?=?getChessboardCoord(FILE_X(pos)?RANK_Y(pos)?fliped);
????arrChessman[index].load(getChessmanPic(chessman?true?dead));
}

void?ChessBoard::changeFlip()
{
????fliped?=?!fliped;
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-10-11?22:37??QtChess\
?????目錄???????????0??2015-10-11?22:37??QtChess\audios\
?????文件????????5850??2015-10-11?22:37??QtChess\audios\AttackKing.wav
?????文件?????????862??2015-10-11?22:37??QtChess\audios\Choose.wav
?????文件???????24444??2015-10-11?22:37??QtChess\audios\Draw.wav
?????文件????????5802??2015-10-11?22:37??QtChess\audios\Eat.wav
?????文件????????6278??2015-10-11?22:37??QtChess\audios\Forbid.wav
?????文件????????8560??2015-10-11?22:37??QtChess\audios\Loss.wav
?????文件????????1962??2015-10-11?22:37??QtChess\audios\Move.wav
?????文件??????121720??2015-10-11?22:37??QtChess\audios\NewGame.wav
?????文件???????32122??2015-10-11?22:37??QtChess\audios\Win.wav
?????文件????????2509??2015-10-11?22:37??QtChess\chessboard.cpp
?????文件?????????747??2015-10-11?22:37??QtChess\chessboard.h
?????文件???????22229??2015-10-11?22:37??QtChess\chesshandler.cpp
?????文件????????3029??2015-10-11?22:37??QtChess\chesshandler.h
?????文件????????1453??2015-10-11?22:37??QtChess\clientnetwork.cpp
?????文件?????????624??2015-10-11?22:37??QtChess\clientnetwork.h
?????文件???????27057??2015-10-11?22:37??QtChess\commdef.h
?????文件?????????185??2015-10-11?22:37??QtChess\Config.ini
?????文件????????2467??2015-10-11?22:37??QtChess\gamesettings.cpp
?????文件?????????908??2015-10-11?22:37??QtChess\gamesettings.h
?????目錄???????????0??2015-10-11?22:37??QtChess\images\
?????文件????????2425??2015-10-11?22:37??QtChess\images\chess.png
?????文件????????2383??2015-10-11?22:37??QtChess\images\fail.png
?????文件????????2232??2015-10-11?22:37??QtChess\images\fallback.png
?????文件?????????486??2015-10-11?22:37??QtChess\images\fileexit.png
?????文件????????1662??2015-10-11?22:37??QtChess\images\fileopen.png
?????文件????????1205??2015-10-11?22:37??QtChess\images\filesave.png
?????文件?????????944??2015-10-11?22:37??QtChess\images\flip.png
?????文件????????1096??2015-10-11?22:37??QtChess\images\helpabout.png
?????文件????????1231??2015-10-11?22:37??QtChess\images\newgame.png
............此處省略60個文件信息

評論

共有 條評論