From: hackbard Date: Wed, 21 May 2003 17:19:02 +0000 (+0000) Subject: dfbapi: font display changes X-Git-Tag: fpb~51 X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40dfea76e1d7217b798999a5ffdca318ee951b81;p=physik%2Fnlsop.git dfbapi: font display changes nlsop: added info output --- diff --git a/dfbapi.c b/dfbapi.c index 138f7e4..eb74fa3 100644 --- a/dfbapi.c +++ b/dfbapi.c @@ -257,17 +257,17 @@ int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v) d3_l->p_surface->SetColor(d3_l->p_surface,0x80,0x80,0xff,0xff); for(i=1;i<=arg_c;i++) { - if(i<8) + if(i<13) { d3_l->p_surface->DrawString(d3_l->p_surface,arg_v[i],-1, d3_l->info_x+d3_l->fakt_x, - d3_l->info_y+d3_l->fakt_y+d3_l->font_h+(i-1)*2*d3_l->font_h, + d3_l->info_y+2*d3_l->fakt_y+d3_l->font_h+(i-1)*d3_l->font_h, DSTF_LEFT); } else { d3_l->p_surface->DrawString(d3_l->p_surface,arg_v[i],-1, d3_l->info_x+d3_l->info_w/2+d3_l->fakt_x, - d3_l->info_y+d3_l->fakt_y+d3_l->font_h+(i%8-1)*2*d3_l->font_h, + d3_l->info_y+2*d3_l->fakt_y+d3_l->font_h+(i%13-1)*d3_l->font_h, DSTF_LEFT); } } @@ -298,15 +298,16 @@ int scan_event(d3_lattice *d3_l,int *x,int *y,int *z,int *q,int *esc) { DFBInputEvent ke; + d3_l->k_buffer->WaitForEvent(d3_l->k_buffer); d3_l->k_buffer->GetEvent(d3_l->k_buffer,DFB_EVENT(&ke)); if(ke.type==DIET_KEYPRESS) { if(ke.key_id==DIKI_LEFT && *x!=0) *x-=1; if(ke.key_id==DIKI_RIGHT && *x!=d3_l->max_x-1) *x+=1; - if(ke.key_id==DIKI_DOWN && *y!=0) *y-=1; - if(ke.key_id==DIKI_UP && *y!=d3_l->max_y-1) *y+=1; - if(ke.key_id==DIKI_PAGE_DOWN && *z!=0) *z-=1; - if(ke.key_id==DIKI_PAGE_UP && *z!=d3_l->max_z-1) *z+=1; + if(ke.key_id==DIKI_UP && *y!=0) *y-=1; + if(ke.key_id==DIKI_DOWN && *y!=d3_l->max_y-1) *y+=1; + if(ke.key_id==DIKI_PAGE_UP && *z!=0) *z-=1; + if(ke.key_id==DIKI_PAGE_DOWN && *z!=d3_l->max_z-1) *z+=1; if(ke.key_id==DIKI_Q) *q=1; if(ke.key_id==DIKI_ESCAPE) *esc=1; } diff --git a/nlsop.c b/nlsop.c index 7dc862c..4ff1d6e 100644 --- a/nlsop.c +++ b/nlsop.c @@ -78,14 +78,11 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int } } } - // p*=*conc; - // printf("debug: p * conc = %f\n",p); if(!(*thiz&AMORPH)) { if(get_rand(URAND_MAX)<=p) { MAKE_AMORPH(thiz); - printf("debug: c->a %d - %d\n",*t_c,*conc); *t_c=*t_c+1-*conc; } else *t_c+=1; } else @@ -94,7 +91,6 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int if(get_rand(URAND_MAX)>p) { MAKE_CRYST(thiz); - printf("debug: a->c %d - %d\n",*t_c,*conc); *t_c=*t_c+1+*conc; } else *t_c+=1; } @@ -126,17 +122,14 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b) } } temp=(int)((i+1)*a+b)*t_c/(sum*area_h[i]); - // if(temp) - // { - for(j=0;jstatus+(i*area)+j)&AMORPH)) { - if(!(*(d3_l->status+(i*area)+j)&AMORPH)) - { - *(d3_l->extra+(i*area)+j)=temp; - total+=temp; - } + *(d3_l->extra+(i*area)+j)=temp; + total+=temp; } - // } + } left=(int)(((i+1)*a+b)*t_c/sum)%area_h[i]; while(left) { @@ -167,7 +160,7 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b) return 1; } -int save_to_file(char *sf,d3_lattice *d3_l) +int save_to_file(char *sf,d3_lattice *d3_l,info *my_inf) { int sf_fd,c; @@ -181,6 +174,11 @@ int save_to_file(char *sf,d3_lattice *d3_l) puts("failed saving d3 lattice struct"); return -1; } + if(write(sf_fd,my_inf,sizeof(info))max_x*d3_l->max_y*d3_l->max_z; if(write(sf_fd,d3_l->status,c*sizeof(unsigned char))max_x*d3_l->max_y*d3_l->max_z; if((d3_l->status=(unsigned char*)malloc(c*sizeof(unsigned char)))==NULL) { @@ -241,8 +244,7 @@ int main(int argc,char **argv) { u32 max_x,max_y,max_z,x,y,z,x_c,y_c,z_c; int i,quit,escape,nowait; - double a_el,b_el,a_cd,b_cd,a_ap,b_ap; - int cc,steps,range,refresh; + int refresh; char s_file[MAX_CHARS]; char l_file[MAX_CHARS]; char r_file[MAX_CHARS]; @@ -253,22 +255,32 @@ int main(int argc,char **argv) char conc_txt[MAX_TXT]; char steps_txt[MAX_TXT]; char cc_txt[MAX_TXT]; + char a_txt[MAX_TXT]; + char s_txt[MAX_TXT]; + char ap_txt[MAX_TXT]; + char el_txt[MAX_TXT]; + char cd_txt[MAX_TXT]; + char r_txt[MAX_TXT]; + char ap2_txt[MAX_TXT]; + char cd2_txt[MAX_TXT]; + char el2_txt[MAX_TXT]; char *arg_v[MAX_ARGV]; d3_lattice d3_l; + info my_info; max_x=X; max_y=Y; max_z=Z; - steps=STEPS; - range=RANGE; + my_info.steps=STEPS; + my_info.range=RANGE; refresh=REFRESH; - a_el=A_EL; - b_el=B_EL; - a_cd=A_CD; - b_cd=B_CD; - a_ap=A_AP; - b_ap=B_AP; - cc=CC; + my_info.a_el=A_EL; + my_info.b_el=B_EL; + my_info.a_cd=A_CD; + my_info.b_cd=B_CD; + my_info.a_ap=A_AP; + my_info.b_ap=B_AP; + my_info.cc=CC; nowait=0; quit=0; escape=0; @@ -289,10 +301,10 @@ int main(int argc,char **argv) nowait=1; break; case 'a': - a_el=atof(argv[++i]); + my_info.a_el=atof(argv[++i]); break; case 'b': - b_el=atof(argv[++i]); + my_info.b_el=atof(argv[++i]); break; case 'x': max_x=atoi(argv[++i]); @@ -315,28 +327,28 @@ int main(int argc,char **argv) break; */ case 's': - steps=atoi(argv[++i]); + my_info.steps=atoi(argv[++i]); break; case 'd': refresh=atoi(argv[++i]); break; case 'r': - range=atoi(argv[++i]); + my_info.range=atoi(argv[++i]); break; case 'f': - a_ap=atof(argv[++i]); + my_info.a_ap=atof(argv[++i]); break; case 'p': - b_ap=atof(argv[++i]); + my_info.b_ap=atof(argv[++i]); break; case 'A': - a_cd=atof(argv[++i]); + my_info.a_cd=atof(argv[++i]); break; case 'B': - b_cd=atof(argv[++i]); + my_info.b_cd=atof(argv[++i]); break; case 'C': - cc=atoi(argv[++i]); + my_info.cc=atoi(argv[++i]); break; case 'L': strcpy(l_file,argv[++i]); @@ -358,6 +370,8 @@ int main(int argc,char **argv) y=max_y/2-1; z=max_z/2-1; + + if(!strcmp(r_file,"")) rand_init(NULL); else rand_init(r_file); @@ -379,22 +393,55 @@ int main(int argc,char **argv) memset(d3_l.extra,0,i*sizeof(int)); } else { - load_from_file(l_file,&d3_l); + load_from_file(l_file,&d3_l,&my_info); d3_lattice_init(&argc,argv,&d3_l,d3_l.max_x,d3_l.max_y,d3_l.max_z); } d3_event_init(&d3_l); + strcpy(a_txt,"args:"); + sprintf(s_txt,"steps: %d",my_info.steps); + sprintf(r_txt,"pressure range: %d",my_info.range); + sprintf(ap_txt,"p faktor: %.2f",my_info.a_ap); + sprintf(ap2_txt,"p offset: %.2f",my_info.b_ap); + sprintf(el_txt,"e loss slope: %.2f",my_info.a_el); + sprintf(el2_txt,"e loss offset: %.2f",my_info.b_el); + sprintf(cd_txt,"c distrib slope: %.2f",my_info.a_cd); + sprintf(cd2_txt,"c distrib offset: %.2f",my_info.b_cd); + arg_v[1]=x_txt; + arg_v[2]=y_txt; + arg_v[3]=z_txt; + arg_v[4]=NULL; + arg_v[5]=status_txt; + arg_v[6]=conc_txt; + arg_v[7]=NULL; + arg_v[8]=NULL; + arg_v[9]=NULL; + arg_v[10]=steps_txt;; + arg_v[11]=cc_txt; + arg_v[12]=NULL; + arg_v[13]=NULL; + arg_v[14]=a_txt; + arg_v[15]=NULL; + arg_v[16]=s_txt; + arg_v[17]=r_txt; + arg_v[18]=ap_txt; + arg_v[19]=ap2_txt; + arg_v[20]=el_txt; + arg_v[21]=el2_txt; + arg_v[22]=cd_txt; + arg_v[23]=cd2_txt; + if(!strcmp(l_file,"")) { i=0; - while((i