免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
1234下一页
最近访问板块 发新帖
查看: 10628 | 回复: 34
打印 上一主题 下一主题

[其他] 其实,我写到现在代码,就是俄罗斯方块的代码写的最满意,那数据结构设计的真绝 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-12-24 08:10 |只看该作者 |倒序浏览
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
2 [报告]
发表于 2013-12-24 08:21 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
5
狮子座
日期:2013-08-20 10:12:24午马
日期:2013-11-23 18:04:102015年辞旧岁徽章
日期:2015-03-03 16:54:152015亚冠之德黑兰石油
日期:2015-06-29 18:11:1115-16赛季CBA联赛之新疆
日期:2024-02-21 10:00:53
3 [报告]
发表于 2013-12-24 09:10 |只看该作者
你的一堆bmp还有mp3资源都没有,编译了也没法跑啊………………

还有,你难道从来不管警告的么?

  1. || Compiling... using GNU C Compiler
  2. || !gcc -Wall "noname\2013-12-24-1.c" -lglut -lopengl32 -o ./output
  3. ||
  4. noname\2013-12-24-1.c|50 col 1| warning: missing braces around initializer [-Wmissing-braces]
  5. ||  GLint map[MAP_HEIGHT+4][MAP_WIDTH][2] = {0};
  6. ||  ^
  7. noname\2013-12-24-1.c|50 col 1| warning: (near initialization for 'map[0]') [-Wmissing-braces]
  8. noname\2013-12-24-1.c|51 col 1| warning: missing braces around initializer [-Wmissing-braces]
  9. ||  GLint net[MAP_HEIGHT+4][MAP_WIDTH] = {0};
  10. ||  ^
  11. noname\2013-12-24-1.c|51 col 1| warning: (near initialization for 'net[0]') [-Wmissing-braces]
  12. noname\2013-12-24-1.c|132 col 22| warning: pointer targets in initialization differ in signedness [-Wpointer-sign]
  13. ||  GLbyte* recordName = "record";
  14. ||                       ^
  15. || noname\2013-12-24-1.c: In function 'initMenu':
  16. noname\2013-12-24-1.c|580 col 9| warning: pointer targets in passing argument 1 of 'readImage' differ in signedness [-Wpointer-sign]
  17. ||          menuImage = readImage("0Menu.bmp");
  18. ||          ^
  19. noname\2013-12-24-1.c|243 col 7| note: expected 'GLbyte *' but argument is of type 'char *'
  20. ||  Image readImage(GLbyte* filename);
  21. ||        ^
  22. || noname\2013-12-24-1.c: In function 'initHelp':
  23. noname\2013-12-24-1.c|622 col 9| warning: pointer targets in passing argument 1 of 'readImage' differ in signedness [-Wpointer-sign]
  24. ||          helpImage = readImage("1Help.bmp");
  25. ||          ^
  26. noname\2013-12-24-1.c|243 col 7| note: expected 'GLbyte *' but argument is of type 'char *'
  27. ||  Image readImage(GLbyte* filename);
  28. ||        ^
  29. || noname\2013-12-24-1.c: In function 'initPlay':
  30. noname\2013-12-24-1.c|681 col 17| warning: pointer targets in passing argument 1 of 'readImage' differ in signedness [-Wpointer-sign]
  31. ||                  backImage = readImage("2Back.bmp");
  32. ||                  ^
  33. noname\2013-12-24-1.c|243 col 7| note: expected 'GLbyte *' but argument is of type 'char *'
  34. ||  Image readImage(GLbyte* filename);
  35. ||        ^
  36. || noname\2013-12-24-1.c: In function 'drawLevel':
  37. noname\2013-12-24-1.c|834 col 9| warning: pointer targets in passing argument 2 of 'integerToArray' differ in signedness [-Wpointer-sign]
  38. ||          integerToArray(level, charArray);
  39. ||          ^
  40. noname\2013-12-24-1.c|249 col 8| note: expected 'GLbyte *' but argument is of type 'char *'
  41. ||  GLvoid integerToArray(GLint n, GLbyte s[]);
  42. ||         ^
  43. || noname\2013-12-24-1.c: In function 'drawLine':
  44. noname\2013-12-24-1.c|857 col 9| warning: pointer targets in passing argument 2 of 'integerToArray' differ in signedness [-Wpointer-sign]
  45. ||          integerToArray(lines, charArray);
  46. ||          ^
  47. noname\2013-12-24-1.c|249 col 8| note: expected 'GLbyte *' but argument is of type 'char *'
  48. ||  GLvoid integerToArray(GLint n, GLbyte s[]);
  49. ||         ^
  50. || noname\2013-12-24-1.c: In function 'drawScore':
  51. noname\2013-12-24-1.c|882 col 9| warning: pointer targets in passing argument 2 of 'integerToArray' differ in signedness [-Wpointer-sign]
  52. ||          integerToArray(score, charArray);
  53. ||          ^
  54. noname\2013-12-24-1.c|249 col 8| note: expected 'GLbyte *' but argument is of type 'char *'
  55. ||  GLvoid integerToArray(GLint n, GLbyte s[]);
  56. ||         ^
  57. || noname\2013-12-24-1.c: In function 'initPause':
  58. noname\2013-12-24-1.c|986 col 9| warning: pointer targets in passing argument 1 of 'readImage' differ in signedness [-Wpointer-sign]
  59. ||          pauseImage = readImage("3Pause.bmp");
  60. ||          ^
  61. noname\2013-12-24-1.c|243 col 7| note: expected 'GLbyte *' but argument is of type 'char *'
  62. ||  Image readImage(GLbyte* filename);
  63. ||        ^
  64. noname\2013-12-24-1.c|987 col 9| warning: pointer targets in passing argument 1 of 'readImage' differ in signedness [-Wpointer-sign]
  65. ||          pause1Image = readImage("4Pause1.bmp");
  66. ||          ^
  67. noname\2013-12-24-1.c|243 col 7| note: expected 'GLbyte *' but argument is of type 'char *'
  68. ||  Image readImage(GLbyte* filename);
  69. ||        ^
  70. noname\2013-12-24-1.c|988 col 9| warning: pointer targets in passing argument 1 of 'readImage' differ in signedness [-Wpointer-sign]
  71. ||          continueImage = readImage("5Continue.bmp");
  72. ||          ^
  73. noname\2013-12-24-1.c|243 col 7| note: expected 'GLbyte *' but argument is of type 'char *'
  74. ||  Image readImage(GLbyte* filename);
  75. ||        ^
  76. || noname\2013-12-24-1.c: In function 'initOver':
  77. noname\2013-12-24-1.c|1046 col 9| warning: pointer targets in passing argument 1 of 'readImage' differ in signedness [-Wpointer-sign]
  78. ||          overImage = readImage("7Over.bmp");
  79. ||          ^
  80. noname\2013-12-24-1.c|243 col 7| note: expected 'GLbyte *' but argument is of type 'char *'
  81. ||  Image readImage(GLbyte* filename);
  82. ||        ^
  83. || noname\2013-12-24-1.c: In function 'initExit':
  84. noname\2013-12-24-1.c|1094 col 9| warning: pointer targets in passing argument 1 of 'readImage' differ in signedness [-Wpointer-sign]
  85. ||          exitImage = readImage("6Exit.bmp");
  86. ||          ^
  87. noname\2013-12-24-1.c|243 col 7| note: expected 'GLbyte *' but argument is of type 'char *'
  88. ||  Image readImage(GLbyte* filename);
  89. ||        ^
  90. || noname\2013-12-24-1.c: In function 'initRecord':
  91. noname\2013-12-24-1.c|1140 col 9| warning: pointer targets in passing argument 1 of 'fopen' differ in signedness [-Wpointer-sign]
  92. ||          record = fopen(recordName, "r");
  93. ||          ^
  94. In file included from noname\2013-12-24-1.c|5| 0:
  95. d:\mingw\i686-w64-mingw32\include\stdio.h|449 col 17| note: expected 'const char * __restrict__' but argument is of type 'GLbyte *'
  96. ||    FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  97. ||                  ^
  98. noname\2013-12-24-1.c|1144 col 17| warning: pointer targets in passing argument 1 of 'fopen' differ in signedness [-Wpointer-sign]
  99. ||                  record = fopen(recordName, "wb");
  100. ||                  ^
  101. In file included from noname\2013-12-24-1.c|5| 0:
  102. d:\mingw\i686-w64-mingw32\include\stdio.h|449 col 17| note: expected 'const char * __restrict__' but argument is of type 'GLbyte *'
  103. ||    FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  104. ||                  ^
  105. || noname\2013-12-24-1.c: In function 'getRecord':
  106. noname\2013-12-24-1.c|1153 col 9| warning: pointer targets in passing argument 1 of 'fopen' differ in signedness [-Wpointer-sign]
  107. ||          record = fopen(recordName, "wb");
  108. ||          ^
  109. In file included from noname\2013-12-24-1.c|5| 0:
  110. d:\mingw\i686-w64-mingw32\include\stdio.h|449 col 17| note: expected 'const char * __restrict__' but argument is of type 'GLbyte *'
  111. ||    FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  112. ||                  ^
  113. || noname\2013-12-24-1.c: In function 'setRecord':
  114. noname\2013-12-24-1.c|1162 col 9| warning: pointer targets in passing argument 1 of 'fopen' differ in signedness [-Wpointer-sign]
  115. ||          record = fopen(recordName, "wb");
  116. ||          ^
  117. In file included from noname\2013-12-24-1.c|5| 0:
  118. d:\mingw\i686-w64-mingw32\include\stdio.h|449 col 17| note: expected 'const char * __restrict__' but argument is of type 'GLbyte *'
  119. ||    FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  120. ||                  ^
  121. || noname\2013-12-24-1.c: In function 'readImage':
  122. noname\2013-12-24-1.c|1638 col 9| warning: pointer targets in passing argument 1 of 'fopen' differ in signedness [-Wpointer-sign]
  123. ||          if ((file = fopen(filename, "rb"))==NULL)
  124. ||          ^
  125. In file included from noname\2013-12-24-1.c|5| 0:
  126. d:\mingw\i686-w64-mingw32\include\stdio.h|449 col 17| note: expected 'const char * __restrict__' but argument is of type 'GLbyte *'
  127. ||    FILE *__cdecl fopen(const char * __restrict__ _Filename,const char * __restrict__ _Mode) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
  128. ||                  ^
  129. noname\2013-12-24-1.c|1651 col 9| warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
  130. ||          printf("Width of %s: %lu\n", filename, img->width);
  131. ||          ^
  132. noname\2013-12-24-1.c|1655 col 9| warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'int' [-Wformat=]
  133. ||          printf("Height of %s: %lu\n", filename, img->height);
  134. ||          ^
  135. || noname\2013-12-24-1.c: In function 'integerToArray':
  136. noname\2013-12-24-1.c|1792 col 9| warning: pointer targets in passing argument 1 of 'reverse' differ in signedness [-Wpointer-sign]
  137. ||          reverse(s);
  138. ||          ^
  139. noname\2013-12-24-1.c|1757 col 8| note: expected 'char *' but argument is of type 'GLbyte *'
  140. ||  GLvoid reverse(char s[])
  141. ||         ^
  142. || gcc returned 0
复制代码

论坛徽章:
5
狮子座
日期:2013-08-20 10:12:24午马
日期:2013-11-23 18:04:102015年辞旧岁徽章
日期:2015-03-03 16:54:152015亚冠之德黑兰石油
日期:2015-06-29 18:11:1115-16赛季CBA联赛之新疆
日期:2024-02-21 10:00:53
4 [报告]
发表于 2013-12-24 09:12 |只看该作者
我记得我08年的时候写俄罗斯方块测试编译器什么的,基本上最长的也没超过300行,一般都是两百多一点,你居然写了1800+这也太那啥了吧?

论坛徽章:
0
5 [报告]
发表于 2013-12-24 10:15 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
6 [报告]
发表于 2013-12-24 10:18 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
7 [报告]
发表于 2013-12-24 10:39 |只看该作者
楼主工作是做什么的呀?怎么天天写这种程序?纯属爱好么!

论坛徽章:
223
2022北京冬奥会纪念版徽章
日期:2015-08-10 16:30:32操作系统版块每日发帖之星
日期:2016-05-10 19:22:58操作系统版块每日发帖之星
日期:2016-02-18 06:20:00操作系统版块每日发帖之星
日期:2016-03-01 06:20:00操作系统版块每日发帖之星
日期:2016-03-02 06:20:0015-16赛季CBA联赛之上海
日期:2019-09-20 12:29:3219周年集字徽章-周
日期:2019-10-01 20:47:4815-16赛季CBA联赛之八一
日期:2020-10-23 18:30:5320周年集字徽章-20	
日期:2020-10-28 14:14:2615-16赛季CBA联赛之广夏
日期:2023-02-25 16:26:26CU十四周年纪念徽章
日期:2023-04-13 12:23:10操作系统版块每日发帖之星
日期:2016-05-10 19:22:58
8 [报告]
发表于 2013-12-24 10:51 |只看该作者
十舍七匹狼 发表于 2013-12-24 10:39
楼主工作是做什么的呀?怎么天天写这种程序?纯属爱好么!


这里是技术爱好者的地方,来这里当然属于爱好

论坛徽章:
0
9 [报告]
发表于 2013-12-24 11:20 |只看该作者
回复 1# _____BlueGuy_
快速的撸一遍楼主的代码,唯一的亮点只有这句注释
  1. //S Z L J I O T
复制代码

论坛徽章:
771
金牛座
日期:2014-02-26 17:49:58水瓶座
日期:2014-02-26 18:10:15白羊座
日期:2014-04-15 19:29:52寅虎
日期:2014-04-17 19:43:21酉鸡
日期:2014-04-19 21:24:10子鼠
日期:2014-04-22 13:55:24卯兔
日期:2014-04-22 14:20:58亥猪
日期:2014-04-22 16:13:09狮子座
日期:2014-05-05 22:31:17摩羯座
日期:2014-05-06 10:32:53处女座
日期:2014-05-12 09:23:11子鼠
日期:2014-05-21 18:21:27
10 [报告]
发表于 2013-12-24 14:19 |只看该作者
回复 9# blue_guy
这个注释很销魂呀,新手表示看不懂,
哪位大侠解释下。

   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP