The following functions are provided for animating wireless (ex. radio) connections.
void draw_beam( float pos_x1, float pos_y1, float pos_x2, float pos_y2, int color, float thickness );Thickness of 1.0 is normal. Thickness of 2.0 is double-thick.
void draw_ring( float pos_x1, float pos_y1, float radius, int color );
Example - |
void draw_ring2( float pos_x1, float pos_y1, float radius, int color, int nsegs, float thickness, float ang, float point );
Example - |
Colors can be specified by number or name. Available colors are listed in the Color Table.
The functions are automatically stubbed for textual (non-graphical) simulations. (You do not have to #ifdef them away.) The above functions are intended to replace the earlier function paint_beam, which erased underlying objects.
The following functions are provided for moving radio (or any box or entity) positions on the screen.
void MY_POSITION( char *obj_name, float *pos_x, float *pos_y, float *xsz, float *ysz )The coordinates can then be used to erase the object and move it to new coordinates.
void place_box( float pos_x1, float pos_y1, float pos_x2, float pos_y2, int color )
void draw_box( float pos_x, float pos_y, float xsz, float ysz, int color );
Example - Using the above functions to move a box:
/* Get the box's initial position. / MY_POSITION( MY_NAME, &posx, &posy, &szx, &szy ); /* First (once) erase the permanent box, and redraw moveable version. */ place_box( posx, posy, szx, szy, 0 ); draw_box( posx, posy, szx, szy, Green ); While (forever) { DELAY(1.0); /* Erase the box's old location by toggling draw with exact old values. */ draw_box( posx, posy, szx, szy, Green ); /* Update the object's new position somehow. */ posx = trajectory_x(CSIM_TIME); posy = trajectory_y(CSIM_TIME); /* Draw the box at the new location. */ draw_box( posx, posy, szx, szy, Green ); }