*
*/
+#ifndef DFBAPI_H
+#define DFBAPI_H
+
#include <directfb.h>
/* two dimensional lattice */
int d3_lattice_init(int *argc,char **argv,d3_lattice *d3_l,int x,int y,int z);
int d3_lattice_release(d3_lattice *d3_l);
int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v);
+int d2_event_init(d2_lattice *d2_l);
+int d3_event_init(d3_lattice *d3_l);
+int scan_event(d3_lattice *d3_l,int *x,int *y,int *z,int *q,int *esc);
int dx_lattice_get_color(unsigned char *status,unsigned char *r,unsigned char *g,unsigned char *b);
+#endif /* DFBAPI_H */
p*=*conc;
if(!(*thiz&AMORPH))
{
- if(rand_get(URAND_MAX)<=p)
+ if(get_rand(URAND_MAX)<=p)
{
MAKE_AMORPH(thiz);
*t_c=*t_c+1-*conc;
} else
{
/* assume 1-p probability */
- if(rand_get(URAND_MAX)>p)
+ if(get_rand(URAND_MAX)>p)
{
MAKE_CRYST(thiz);
*t_c=*t_c+1+*conc;
left=(int)(((i+1)*a+b)*t_c/sum)%area_h[i];
while(left)
{
- x=get_rand(d3_l->max_x);
- y=get_rand(d3_l->max_y);
- if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH))
- {
- *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1;
- total+=1;
- left-=1;
+ x=get_rand(d3_l->max_x);
+ y=get_rand(d3_l->max_y);
+ if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH))
+ {
+ *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1;
+ total+=1;
+ left-=1;
+ }
}
}
left=t_c-total;
{
while((i<steps) && (quit==0) && (escape==0))
{
- x_c=rand_get(d3_l.max_x);
- y_c=rand_get(d3_l.max_y);
- z_c=rand_get_lgp(d3_l.max_z,a_el,b_el);
+ x_c=get_rand(d3_l.max_x);
+ y_c=get_rand(d3_l.max_y);
+ z_c=get_rand_lgp(d3_l.max_z,a_el,b_el);
distrib_c(&d3_l,cc,a_cd,b_cd);
process_cell(&d3_l,x_c,y_c,z_c,range,a_ap,b_ap,&cc);
if(i%refresh==0)
d3_lattice_draw(&d3_l,x,y,z,10,arg_v);
scan_event(&d3_l,&x,&y,&z,&quit,&escape);
}
- ++i;
+ i++;
}
}
+ if(strcmp(s_file,"")) save_to_file(s_file,&d3_l);
+
while((quit==0) && (escape==0) && (nowait==0))
{
sprintf(x_txt,"x: %d",x);