{"id":6919,"date":"2024-07-24T12:01:03","date_gmt":"2024-07-24T04:01:03","guid":{"rendered":""},"modified":"2024-07-24T12:01:03","modified_gmt":"2024-07-24T04:01:03","slug":"\u8d34\u56fe\u6280\u672f\u5165\u95e8\u2014\u2014\u5766\u514b\u5927\u6218\u5730\u56fe","status":"publish","type":"post","link":"https:\/\/mushiming.com\/6919.html","title":{"rendered":"\u8d34\u56fe\u6280\u672f\u5165\u95e8\u2014\u2014\u5766\u514b\u5927\u6218\u5730\u56fe"},"content":{"rendered":"

\u524d\u5929\u535a\u5ba2\u4e2d\u7528C\u8bed\u8a00\u5199\u4e86\u4e2a\u6ca1\u6709\u8d34\u56fe\u7684\u6253\u5b57\u6bcd\u5c0f\u6e38\u620f\uff0c\u63d0\u53ca\u5230\u8d34\u56fe\u6280\u672f\uff0c\u90a3\u4e48\u4eca\u5929\u7684\u4e3b\u9898\u5c31\u662f\u8d34\u56fe\u6280\u672f\u5165\u95e8\u7ea7\u3002<\/p>\n

\u4eca\u5929\u5c31\u4ee5\u5766\u514b\u5927\u6218\u5730\u56fe\u4e3a\u4f8b\uff0c\u5f00\u542f\u6e38\u620f\u8d34\u56fe\u4e4b\u65c5\u3002\u3002\u3002<\/p>\n

#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<graphics.h> \/\/\u6574\u4e2a\u5730\u56fe\u662f\u7531\u56db\u4e2a\u57fa\u672c\u5355\u5143\u7ec4\u6210 \/\/\u4ee5\u56db\u4e2a\u56fe\u7247\u4e3a\u57fa\u672c\u5355\u4f4d\uff0c\u786e\u5b9a\u884c\u6570\u548c\u5217\u6570 const int rows=12;\/\/\u5c06\u884c\u548c\u5217\u5b9a\u4e49\u4e3a\u5e38\u6574\u578b\uff0c\u4f7f\u5176\u4e0d\u53ef\u53d8 const int cols=13;<\/code><\/pre>\n

\u6bcf\u5f20\u56fe\u7247\u5927\u5c0f\u4e3a50*50\uff0c\u4e14\u8981\u5c06\u56fe\u7247\u653e\u5230\u9879\u76ee\u6240\u5728\u6587\u4ef6<\/p>\n

\"\u8d34\u56fe\u6280\u672f\u5165\u95e8\u2014\u2014\u5766\u514b\u5927\u6218\u5730\u56fe <\/p>\n

\u5728\u8fd9\u91cc\uff0c\u6bcf\u5f20\u56fe\u7247\u7684\u547d\u540d\u89c4\u5219\u662fmap0\/1\/2\/3.jpg,\u4e3a\u4e86\u540e\u9762\u56fe\u7247\u7684\u5faa\u73af\u52a0\u8f7d\u3001\u8d34\u56fe\u548c\u8d34\u5904\u51fa\uff0c\u4ee5\u53ca\u56db\u4e2a\u5730\u56fe\u7684\u5e03\u5c40<\/p>\n

\/\/\u8d34\u56fe\u51fd\u6570 void InitInstance() { \/\/\u7528\u6570\u5b57\u4ee3\u8868\u5730\u56fe\u4e2d\u7684\u5143\u7d20 \/\/0\u5927\u9e1f\uff0c1\u94f6\u7816\uff0c2\u9ed1\u5757\uff0c3\u7ea2\u7816 int mapIndex[rows][cols] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 3, 3, 3, 2, 3, 1, 3, 2, 3, 3, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 1, 2, 3, 2, 3, 2, 3, 3, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 3, 2, 3, 2, 3, 3, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 3, 0, 3, 2, 2, 2, 2, 2 }; char filename[10] = \"\"; \/\/\u5b57\u7b26\u4e32\uff1amap%d.jpg IMAGE map[4];\/\/\u4fdd\u5b58\u56fe\u7247\u7684\u53d8\u91cf int x, y;\/\/\u56fe\u7247\u5750\u6807 \/\/\u5faa\u73af\u52a0\u8f7d\u56fe\u7247 for (int i = 0; i < 4; i++) { sprintf(filename,\"map%d.jpg\",i);\/\/\u683c\u5f0f\u5316\u5199\u5165map0\/1\/2\/3.jpg loadimage(&map[i],filename);\/\/\u52a0\u8f7d\u56fe\u7247\u7684\u51fd\u6570 } \/\/\u5faa\u73af\u8d34\u56fe for (int rowNum = 0; rowNum < rows; rowNum++) { for (int colNum = 0; colNum < cols; colNum++) { x = colNum * 50;\/\/\u8d34\u56fe\u6240\u5728\u6a2a\u5750\u6807 y = rowNum * 50;\/\/\u8d34\u56fe\u6240\u5728\u7eb5\u5750\u6807 putimage(x,y,&map[mapIndex[rowNum][colNum]]);\/\/\u8d34\u56fe\uff0c\u524d\u9762\u6570\u5b57\u5730\u56fe\u5728\u6b64\u5904\u8d77\u4f5c\u7528 } } } int main() { initgraph(cols*50,rows*50);\/\/\u521d\u59cb\u753b\u5e03\u5927\u5c0f InitInstance();\/\/\u51fd\u6570\u8c03\u7528 getchar();\/\/\u9632\u6b62\u95ea\u5c4f closegraph();\/\/\u5173\u95ed\u753b\u5e03 return 0; }<\/code><\/pre>\n

\u6548\u679c\u56fe\uff1a<\/p>\n

\"\u8d34\u56fe\u6280\u672f\u5165\u95e8\u2014\u2014\u5766\u514b\u5927\u6218\u5730\u56fe <\/p>\n

<\/p>\n","protected":false},"excerpt":{"rendered":"\u8d34\u56fe\u6280\u672f\u5165\u95e8\u2014\u2014\u5766\u514b\u5927\u6218\u5730\u56fe\u524d\u5929\u535a\u5ba2\u4e2d\u7528C\u8bed\u8a00\u5199\u4e86\u4e2a\u6ca1\u6709\u8d34\u56fe\u7684\u6253\u5b57\u6bcd\u5c0f\u6e38\u620f\uff0c\u63d0\u53ca\u5230\u8d34\u56fe\u6280\u672f\uff0c\u90a3\u4e48\u4eca\u5929\u7684\u4e3b\u9898\u5c31\u662f\u8d34\u56fe\u6280\u672f\u5165...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/6919"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=6919"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/6919\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=6919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=6919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=6919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}