C语言简单游戏框架及常用函数及其头文件:
//游戏代码简单框架
# include <stdio.h>
# include <stdlib.h>//malloc()、calloc()、realloc()、free()、system()、atoi()、atol()、rand()、srand()、exit()
# include <windows.h>//Sleep()、gotoxy()、HideCursor()
# include <conio.h>//_getch()、kbhit()
# include <time.h>//time()
//声明游戏数据为全局变量
//函数声明
void startup();
void show();
void updateWithoutInput();
void updateWithInput();
void startup()//数据初始化
{
}
void show()//一次界面展示
{
}
void updateWithoutInput()//与用户输入无关的更新
{
}
void updateWithInput()//与用户输入有关的更新
{
}
int main()
{
startup();//数据初始化
while (1)//游戏循环执行
{
show();//一次界面展示
updateWithoutInput();//与用户输入无关的更新
updateWithInput();//与用户输入有关的更新
}
return 0;
}
各种函数的具体用法建议直接百度