1 Star 1 Fork 0

LIU42 / Matrix

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
matrix.h 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
LIU42 提交于 2023-02-03 16:04 . 少量修改。
#ifndef __MATRIX_H__
#define __MATRIX_H__
#include <ncurses.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <stdbool.h>
enum Constant
{
DELAY_USEC = 35000,
KEY_ESC = 27,
RANDOM_ADD = 5,
RANDOM_BASE = 100,
STRING_MAX_LEN = 25,
STRING_MIN_LEN = 5,
CHAR_DATA_LEN = 5000,
ADD_DATA_LEN = 200
};
enum Status
{
RUNNING = 0,
EXIT = 1
};
enum Color
{
WHITE = 1,
GREEN = 2
};
typedef enum Status Status;
typedef enum Color Color;
struct CharData
{
int x;
int y;
int color;
char ch;
};
struct AddData
{
int len;
char ch;
};
typedef struct CharData CharData;
typedef struct AddData AddData;
struct Matrix
{
CharData char_data[CHAR_DATA_LEN];
AddData add_data[ADD_DATA_LEN];
Status status;
int screen_rows;
int screen_cols;
int key_code;
int char_count;
};
typedef struct Matrix Matrix;
void init_window(Matrix*);
void set_window(Matrix*);
void set_color(Matrix*);
void unset_window(Matrix*);
void init_data(Matrix*);
bool is_running(Matrix*);
void add_char(Matrix*);
void move_char(Matrix*);
void delete_char(Matrix*);
void update(Matrix*);
void events(Matrix*);
void display(Matrix*);
#endif
C
1
https://gitee.com/liu42/Matrix.git
git@gitee.com:liu42/Matrix.git
liu42
Matrix
Matrix
master

搜索帮助