main.h

来自「细胞自动机的一个源代码」· C头文件 代码 · 共 160 行

H
160
字号
#ifndef MAIN_H#define MAIN_H#include <stdio.h>#include <stdlib.h>#include <string.h>#include <strings.h>#include <curses.h>#include <sys/time.h>#include <unistd.h>#include <dlfcn.h>#include <wlwin.h>#include <loadras.h>#include <trixd.h>#include <GL/glut.h>#include "ca.h"#include "dfa.h"#define eps 0.000001typedef struct Vec3d {  double x, y, z;} vec3d;typedef unsigned int action;typedef struct World {  vec3d com;         /* center of mass */  float wang, zang;  /* zang around z, wang...*/  float zoom;  float curwang, stawang, nexwang;  float curzang, stazang, nexzang;  trixd *trx;        /* orientation */  int nobj;  int curball;  action act;  int width, height;  float pickang, nexpickang, stapickang, nexpickscale, stapickscale, pickscale;  int timer, level;  float curscore;  float v[6];       /* viewport (left, right, up, bottom, near, far) */} world_t;extern world_t worl;extern int debug, cubelist;extern wlWindow gwin;extern ca_t *g_ca;extern dfa_t *g_dfa;extern dfa_ca_t *g_dc;/*input funcs*/void keyfunc(int, int);void buttfunc(int, int, int, int);void configfunc(int, int);void motionfunc(int, int, int);/*display funcs*/void displayfunc(void);void displayfunc_diff(void);void displayfunc_dfa(void);/*void (*displayfunc)(void);void (*displayfunc_diff)(void);void (*displayfunc_dfa)(void);*/void updateworld(void);void idleworld(struct timeval *, struct timeval *, int);void idlefunc(void);/*worl functions*/void worldinit(void);void glinit(int, world_t *, float *);void disp_init(world_t *, ca_t *);/* ca shell variables and functions */typedef struct ca_shell {  float x, y, z;             /* raster pos (upper left of window) */  float cspace, cnl;         /* space/nl offset */  unsigned char **a;         /* alphabet */  char **buf;                /* window buffer */  int bh, bw;                /* buffer height/width */  int wh, ww;                /* window height/width */  int bx, by;                /* buffer pos */  float r, g, b;             /* font color */  int cw, ch;                /* char height/width */  int comx, comy;            /* command position (y) */  int show;} cas_t;void cas_display(cas_t *);void cas_slide(cas_t *);void cas_addch(cas_t *, int);void cas_addch_norun(cas_t *, int);void cas_addstr(cas_t *, char *);void cas_addstr_norun(cas_t *, char *);void cas_runcmd(cas_t *);void cas_init(cas_t *, int, int, char **, int, int);/* ca display lists */typedef struct poly_type {  int n, type;  float r, g, b;  float **v;} poly_t;  typedef struct object_type {  int n;  poly_t *o;  int type;} obj_t;typedef struct disp_object_list {  int n;  int *dl;  obj_t *o;} dl_t;void obj_init(obj_t *, float **, int, int);void dl_init(dl_t *, int);void dl_add(dl_t *, obj_t *, int, int);void dl_gen(dl_t *);int dl_readcfg(dl_t *, FILE *);/* pattern stuff */typedef struct pat_type {  int *p, *pos, *d, fd, dim; /* values, position, dimensions, flat size, dimension */  int on;  int *orig; /* original underlying pattern (save) */  char *name;  int iname;} pat_t;void pat_reset(pat_t *);void pat_init(pat_t *, int *, int *, int *, int);void pat_display(pat_t *, ca_t *);void pat_print(pat_t *);void pat_orig_get(pat_t *, ca_t *);void pat_orig_put(pat_t *, ca_t *);void pat_ca_put(pat_t *, ca_t *);int pat_load_file(pat_t *, FILE *);extern cas_t *g_cas;extern dl_t *g_dl;extern pat_t *g_pat;#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?