首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

拼图游戏,C++与easyx实现

游戏开发 52.51MB 21 需要积分: 1
立即下载

资源介绍:

拼图游戏,C++与easyx实现
#include #include #include #include using namespace std; int draw[10][10]; IMAGE YiLeiNa[100],YiReiNa, background_win; void initdraw() { int demp = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { draw[i][j] = demp; demp++; } } IMAGE img; demp = 0; loadimage(&img, ".\\image\\YILeiNa1.png");\ loadimage(&YiReiNa, ".\\image\\YILeiNa1.png", 400, 400); putimage(0, 0, &img); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { getimage(&YiLeiNa[demp++], j * 75, i * 75, 75, 75); } } cleardevice(); } void randimage() { for (int i = 0; i < 300; i++) { //std::srand(std::time(0)); // 生成两个随机数 int random_number1 = std::rand()%100; int random_number2 = std::rand()%100; int temp = draw[random_number1 / 10][random_number1 % 10]; draw[random_number1 / 10][random_number1 % 10] = draw[random_number2 / 10][random_number2 % 10]; draw[random_number2 / 10][random_number2 % 10] = temp; cout << random_number1 << " " << random_number2 << endl; } } void drawallchain() { for (int i = 0; i < 10; i++) { setcolor(WHITE); //上面的按钮 //line(50+i * 75 + 10, 10, 50+i * 75 + 65, 40); line(50 + i * 75 + 10, 10, 50 + i * 75 + 65, 10); line(50 + i * 75 + 65, 40, 50 + i * 75 + 65, 10); line(50 + i * 75 + 10, 40, 50 + i * 75 + 65, 40); line(50 + i * 75 + 10, 10, 50 + i * 75 + 10, 40); line(50 + i * 75 + 15, 20, 50 + i * 75 + 37, 15); line(50 + i * 75 + 60, 20, 50 + i * 75 + 37, 15); line(50 + i * 75 + 15, 30, 50 + i * 75 + 37, 25); line(50 + i * 75 + 60, 30, 50 + i * 75 + 37, 25); //下面的按钮 line(50 + i * 75 + 10, 10 + 800, 50 + i * 75 + 65, 10 + 800); line(50 + i * 75 + 65, 40 + 800, 50 + i * 75 + 65, 10 + 800); line(50 + i * 75 + 10, 40 + 800, 50 + i * 75 + 65, 40 + 800); line(50 + i * 75 + 10, 10 + 800, 50 + i * 75 + 10, 40 + 800); line(50 + i * 75 + 15, 15 + 800, 50 + i * 75 + 37, 25 + 800); line(50 + i * 75 + 60, 15 + 800, 50 + i * 75 + 37, 25 + 800); line(50 + i * 75 + 15, 25 + 800, 50 + i * 75 + 37, 35 + 800); line(50 + i * 75 + 60, 25 + 800, 50 + i * 75 + 37, 35 + 800); //左边的按钮 line(10, 50 + i * 75 + 10, 10, 50 + i * 75 + 65); line(40, 50 + i * 75 + 10, 40, 50 + i * 75 + 65); line(10, 50 + i * 75 + 10, 40, 50 + i * 75 + 10); line(10, 50 + i * 75 + 65, 40, 50 + i * 75 + 65); line(20, 50 + i * 75 + 15, 15, 50 + i * 75 + 37); line(20, 50 + i * 75 + 60, 15, 50 + i * 75 + 37); line(30, 50 + i * 75 + 15, 25, 50 + i * 75 + 37); line(30, 50 + i * 75 + 60, 25, 50 + i * 75 + 37); //左边的按钮 line(10 + 800, 50 + i * 75 + 10, 10 + 800, 50 + i * 75 + 65); line(40 + 800, 50 + i * 75 + 10, 40 + 800, 50 + i * 75 + 65); line(10 + 800, 50 + i * 75 + 10, 40 + 800, 50 + i * 75 + 10); line(10 + 800, 50 + i * 75 + 65, 40 + 800, 50 + i * 75 + 65); line(15 + 800, 50 + i * 75 + 15, 25 + 800, 50 + i * 75 + 37); line(15 + 800, 50 + i * 75 + 60, 25 + 800, 50 + i * 75 + 37); line(25 + 800, 50 + i * 75 + 15, 35 + 800, 50 + i * 75 + 37); line(25 + 800, 50 + i * 75 + 60, 35 + 800, 50 + i * 75 + 37); } for (int i = 0; i < 11; i++) { setcolor(BLACK); line(i * 75 + 50, 50, i * 75 + 50, 850); line(50, i * 75 + 50, 850, i * 75 + 50); } } static void drawImage() { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { putimage(50 + j * 75, 50 + i * 75, &YiLeiNa[draw[i][j]]); } } putimage(875, 25, &YiReiNa); drawallchain(); } void Operate() { if (MouseHit()) { MOUSEMSG msg = GetMouseMsg(); if (msg.uMsg == WM_LBUTTONDOWN) { for (int i = 0; i < 10; i++) { if (msg.x <= 50 + i * 75 + 65 && msg.x >= 50 + i * 75 + 10 && msg.y <= 40 && msg.y >= 10) { int temp = draw[0][i]; for (int j = 0; j < 9; j++) { draw[j][i] = draw[j + 1][i]; } draw[9][i] = temp; } if (msg.x <= 50 + i * 75 + 65 && msg.x >= 50 + i * 75 + 10 && msg.y <= 840 && msg.y >= 810) { int temp = draw[9][i]; for (int j = 9; j >0; j--) { draw[j][i] = draw[j - 1][i]; } draw[0][i] = temp; } if (msg.y <= 50 + i * 75 + 65 && msg.y >= 50 + i * 75 + 10 && msg.x <= 40 && msg.x >= 10) { int temp = draw[i][0]; for (int j = 0; j < 9; j++) { draw[i][j] = draw[i][j + 1]; } draw[i][9] = temp; } if (msg.y <= 50 + i * 75 + 65 && msg.y >= 50 + i * 75 + 10 && msg.x <= 840 && msg.x >= 810) { int temp = draw[i][9]; for (int j = 9; j > 0; j--) { draw[i][j] = draw[i][j - 1]; } draw[i][0] = temp; } } } } } bool panduan() { int temp = 0; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (draw[i][j] != temp) { return 0; } temp++; } } return 1; } void jiemian_win() { loadimage(&background_win, ".\\image\\win.jpg", 700, 700); putimage(300, 75, &background_win); setbkmode(TRANSPARENT); setcolor(BLACK); //setcolor(WHITE); outtextxy(500, 575, _T("真棒,我就知道你能行!!")); Sleep(5000); } int main() { std::srand(std::time(0)); initgraph(1300, 850); //jiemian_win(); //initgraph(1300, 850, EX_SHOWCONSOLE); initdraw(); drawImage(); randimage(); drawallchain(); while (1) { BeginBatchDraw(); cleardevice(); drawImage(); Operate(); if (panduan()) { break; } EndBatchDraw(); } cleardevice(); jiemian_win(); return 0; }

资源文件列表:

ChainDrawing.zip 大约有62个文件
  1. ChainDrawing/.vs/
  2. ChainDrawing/.vs/ChainDrawing/
  3. ChainDrawing/.vs/ChainDrawing/FileContentIndex/
  4. ChainDrawing/.vs/ChainDrawing/FileContentIndex/db30772d-3aad-4309-90f0-22299cc9b023.vsidx 8.22KB
  5. ChainDrawing/.vs/ChainDrawing/FileContentIndex/eeae1b75-8c8e-4946-9bc6-000d802fb971.vsidx 7.65KB
  6. ChainDrawing/.vs/ChainDrawing/v17/
  7. ChainDrawing/.vs/ChainDrawing/v17/.suo 32.5KB
  8. ChainDrawing/.vs/ChainDrawing/v17/Browse.VC.db 37.7MB
  9. ChainDrawing/.vs/ChainDrawing/v17/DocumentLayout.json 1.51KB
  10. ChainDrawing/.vs/ChainDrawing/v17/ipch/
  11. ChainDrawing/.vs/ChainDrawing/v17/ipch/AutoPCH/
  12. ChainDrawing/.vs/ChainDrawing/v17/ipch/AutoPCH/9ad248eaf00f41b5/
  13. ChainDrawing/.vs/ChainDrawing/v17/ipch/AutoPCH/9ad248eaf00f41b5/FILENAME.ipch 78.56MB
  14. ChainDrawing/.vs/ChainDrawing/v17/ipch/AutoPCH/ca940e670e023b63/
  15. ChainDrawing/.vs/ChainDrawing/v17/ipch/AutoPCH/ca940e670e023b63/FILENAME.ipch 80.81MB
  16. ChainDrawing/.vs/ChainDrawing/v17/Solution.VC.db 428KB
  17. ChainDrawing/ChainDrawing.sln 1.42KB
  18. ChainDrawing/ChainDrawing/
  19. ChainDrawing/ChainDrawing/ChainDrawing.vcxproj 6.48KB
  20. ChainDrawing/ChainDrawing/ChainDrawing.vcxproj.filters 970B
  21. ChainDrawing/ChainDrawing/ChainDrawing.vcxproj.user 168B
  22. ChainDrawing/ChainDrawing/FileName.cpp 5.38KB
  23. ChainDrawing/ChainDrawing/image/
  24. ChainDrawing/ChainDrawing/image/win.jpg 65.97KB
  25. ChainDrawing/ChainDrawing/image/YiLeiNa.jpg 895.46KB
  26. ChainDrawing/ChainDrawing/image/YiLeiNa.png 895.46KB
  27. ChainDrawing/ChainDrawing/image/YILeiNa1.png 908.4KB
  28. ChainDrawing/ChainDrawing/x64/
  29. ChainDrawing/ChainDrawing/x64/Debug/
  30. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.exe.recipe 314B
  31. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.ilk 2.08MB
  32. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.log 292B
  33. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/
  34. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/ChainDrawing.lastbuildstate 174B
  35. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/CL.command.1.tlog 778B
  36. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/Cl.items.tlog 153B
  37. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/CL.read.1.tlog 33.24KB
  38. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/CL.write.1.tlog 628B
  39. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/link.command.1.tlog 1.35KB
  40. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/link.read.1.tlog 2.98KB
  41. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/link.secondary.1.tlog 169B
  42. ChainDrawing/ChainDrawing/x64/Debug/ChainDrawing.tlog/link.write.1.tlog 460B
  43. ChainDrawing/ChainDrawing/x64/Debug/FileName.obj 135.31KB
  44. ChainDrawing/ChainDrawing/x64/Debug/vc143.idb 499KB
  45. ChainDrawing/ChainDrawing/x64/Debug/vc143.pdb 476KB
  46. ChainDrawing/ChainDrawing/x64/Release/
  47. ChainDrawing/ChainDrawing/x64/Release/ChainDrawing.log 177B
  48. ChainDrawing/ChainDrawing/x64/Release/ChainDrawing.tlog/
  49. ChainDrawing/ChainDrawing/x64/Release/ChainDrawing.tlog/ChainDrawing.lastbuildstate 176B
  50. ChainDrawing/ChainDrawing/x64/Release/ChainDrawing.tlog/CL.command.1.tlog 2B
  51. ChainDrawing/ChainDrawing/x64/Release/ChainDrawing.tlog/unsuccessfulbuild
  52. ChainDrawing/ChainDrawing/x64/Release/vc143.pdb 229.5KB
  53. ChainDrawing/x64/
  54. ChainDrawing/x64/Debug/
  55. ChainDrawing/x64/Debug/ChainDrawing.exe 163.5KB
  56. ChainDrawing/x64/Debug/ChainDrawing.pdb 5.46MB
  57. ChainDrawing/x64/Debug/image/
  58. ChainDrawing/x64/Debug/image/win.jpg 65.97KB
  59. ChainDrawing/x64/Debug/image/YiLeiNa.jpg 895.46KB
  60. ChainDrawing/x64/Debug/image/YiLeiNa.png 895.46KB
  61. ChainDrawing/x64/Debug/image/YILeiNa1.png 908.4KB
  62. ChainDrawing/x64/Release/
0评论
提交 加载更多评论
其他资源 C++与easyx实现双人象棋
C++与easyx实现双人象棋
暨大线上试题复习资料0706.zip
暨大线上试题复习资料0706.zip
暨大线上试题复习资料0706.zip 暨大线上试题复习资料0706.zip 暨大线上试题复习资料0706.zip
答题卡识别系统代码+报告
数字图像处理实训基于OpenCV的答题卡识别系统代码+报告,使用PYQT5创建GUI界面,可实现简单的用户交互
答题卡识别系统代码+报告 答题卡识别系统代码+报告 答题卡识别系统代码+报告
最新版抖音查投诉运营源码
新版抖音查投诉源码
bugreport-2024-07-14-140100.zip
bugreport-2024-07-14-140100.zip
高一化学暑假作业-选择性必修1化学反应原理导学.zip
高一化学暑假作业-选择性必修1化学反应原理导学.zip
Dev-Cpp-5.11-Setup(二次压缩版)
Dev-Cpp-5.11-Setup(二次压缩版)
打包工具(Inno Setup Compiler)安装包
安装方式:一直点击下一步即可