|
楼主 |
发表于 2006-11-21 08:35:29
|
显示全部楼层
我是在jawbreaker 例程中修改的.其实Jawbreaker原码显示小球颜色也是不对的.
以下我帖出部分我修改有代码.
int main(int argc, char **argv)
{
char * rgbbuf;
int width,height;
Ecolor * bgcolor,color[4];
int w,h;
EGui_Window * ewindow;
EGui_Widget * form;
EGui_Widget * win;
EGui_Widget * edit;
int pictureStartX,pictureStartY,pictureWith,pictureHigh;
if (Egui_open (&Efbinfo))
return ;
bgcolor = malloc (sizeof ( Ecolor));
if (bgcolor == NULL)
{
printf ("malloc color ERROR\n");
return -1;
}
bgcolor->r = bgcolor->g = bgcolor->b = 0xcc;
/* create window will initial color's pixel.
*/
ewindow = Egui_CreateWindow(&Efbinfo,0,0,800,700,bgcolor,EGUI_WINDOW_TOP);
if (ewindow == NULL)
{
printf ("New windows failed\n");
Egui_close ();
return 1;
}
Egui_SetWindowName(ewindow,"Jawbreaker");
Egui_drawwindow(ewindow);
win = new_widget_window(ewindow);
widget_show(win);
form = new_form (win);
widget_show (form);
/* init position */
// init_pos ();
/* random map */
// random_map ();
// if (!init_pixmap(ewindow))
// return 1;
if (get_pixmap_form_file (argv[1],&Pixmap_buf,ewindow)==0)
{
printf("open user jpg error\n");
Egui_close ();
return 1;
}
// get_pixmap_form_file(argv[1],&Pixmap_buf,ewindow);
// map_pixmap(form);
pictureStartX=400;
pictureStartY=400;
pictureWith=300;
pictureHigh=200;
pixmap_tmp_buf = new_pixmap (form,pictureStartX,pictureStartY,pictureWith,pictureHigh); //make a picture form
pixmap_set (pixmap_tmp_buf,&Pixmap_buf);
widget_show(pixmap_tmp_buf);
// memset(col_kill,0,COL);
button_win = new_button (form,20,220,100,20);
widget_set_name(button_win,"New Start");
widget_show(button_win);
widget_register_callback (button_win, BUTTON_REL_LEFT,button_win_click);
button_mark = new_button (form,130,220,100,20);
widget_set_name(button_mark,"0");
widget_show(button_mark);
edit = new_edit(form,240,220,100,20);
widget_show(edit);
widget_draw (win);
/* after form draw line */
// init_background (form,ewindow); // draw line for form
Egui_loop ();
Egui_CloseWindow (ewindow);
free (bgcolor);
Egui_close ();
} |
|