|
|
On 4/10/24 15:20 'pvr...@btinternet.com' via fltk.general wrote:
So as I understood the process - to draw an arrow with the
head starting 3/4 the length and +/-5 pixels wide. It looks a
lot better than my trying to work out the angles and hoping I
was using the trig functions correctly.
fl_push_matrix(); // Set the drawing to be centred in the widget and rotated by the wind direction fl_translate(x_zero, y_zero); fl_rotate(-(double)dirn); fl_begin_complex_polygon(); // Draw an arrow down from North fl_vertex(1, -radius); fl_vertex(1, radius/2); fl_vertex(5, radius/2); fl_vertex(0, radius); fl_vertex(-5, radius/2); fl_vertex(-1, radius/2); fl_vertex(-1, -radius); // fl_end_complex_polygon(); fl_pop_matrix();
Thanks for sharing your code.
An even more simplistic approach would be to use FLTK's "symbols" if
you only need the eight main directions (N, W, E, W, NW, NE, SW,
SE). See the test/symbols.cxx demo, using the "symbol" '@N->' or
any other appropriate symbol, e.g. '@Narrow' etc.
Of course, drawing the arrow yourself is more flexible...
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/e89b3ba9-9ecd-4234-bfa6-db0abab27223%40aljus.de.
[ Direct Link to Message ] | |
|
| |