{"id":31638067,"url":"https://github.com/diamont1001/c_snake","last_synced_at":"2025-10-07T01:42:07.842Z","repository":{"id":21746581,"uuid":"25068444","full_name":"diamont1001/C_snake","owner":"diamont1001","description":"C语言写的Windows字符界面贪吃蛇 - 不闪屏","archived":false,"fork":false,"pushed_at":"2021-08-02T21:54:39.000Z","size":8720,"stargazers_count":25,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T23:02:54.503Z","etag":null,"topics":["c","snake","snake-game","win-api","windows"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diamont1001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-11T07:43:43.000Z","updated_at":"2024-03-11T14:35:32.000Z","dependencies_parsed_at":"2022-08-17T18:15:29.536Z","dependency_job_id":null,"html_url":"https://github.com/diamont1001/C_snake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/diamont1001/C_snake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamont1001%2FC_snake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamont1001%2FC_snake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamont1001%2FC_snake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamont1001%2FC_snake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diamont1001","download_url":"https://codeload.github.com/diamont1001/C_snake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diamont1001%2FC_snake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278708067,"owners_count":26031932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","snake","snake-game","win-api","windows"],"created_at":"2025-10-07T01:41:41.257Z","updated_at":"2025-10-07T01:42:07.834Z","avatar_url":"https://github.com/diamont1001.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C语言写的字符界面贪吃蛇 - 不闪屏\n\n\u003cimg src=\"https://raw.githubusercontent.com/diamont1001/C_snake/0892ea08817bb7ba7b99fca1ce5fd26c24a76408/docs/Kapture%202021-08-02%20at%2014.37.11.gif\" width=\"540\"/\u003e\n\n之前在网上下载了几位网友的贪吃蛇，看了下，觉得屏幕好闪，因为他们很多人都是用 `system(\"cls\")` 来刷新屏幕的，所以难免会闪。在下一时兴致大发，也写了个，用 WIN—API 函数来控制光标输出，去除了闪屏的问题。有需要的童鞋欢迎下载交流。^_^\n\n1. 该小游戏并没有引用到任何第三方库，完全是调用标准C的库函数和 `WIN-API` 函数的。\n2. 该小游戏引用到之前封装好的几个函数：定时器、随机数、键盘响应、光标移动，所以也可以作为以上几个函数的一个例子。\n3. 字符界面：屏幕根据“按需刷新”原则，每次只是刷新有变化的区域。总体上个人感觉还不错啦，哈哈！\n4. 代码设计：状态加定时器驱动，个人感觉可以满足大多数单线程小游戏的开发。\n\n## 环境\n\n- 开发编译环境：`code::blocks + MinGW`\n- 运行环境：`Windows`\n\n可以直接下载 `/bin/release/` 文件夹里的 `exe` 文件直接运行即可看到效果。\n\n## 问题收集\n\n有的朋友用VS或者VC打开，发现编译不过，是因为编译器不同，VS要求比较严格，声明和定义一定要放到前面，解决方法：在 `JR_timer.c`里面，把以下这句放到函数或者文件的前面就行了： `extern void mainTimer();`\n\n## 附\n\n - [游戏试玩](http://download.csdn.net/download/diamont1001/3033102)\n - [原 CSDN 资源下载地址](http://download.csdn.net/download/diamont1001/3032070)\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiamont1001%2Fc_snake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiamont1001%2Fc_snake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiamont1001%2Fc_snake/lists"}