-
Notifications
You must be signed in to change notification settings - Fork 2
shapes
James Bremner edited this page Oct 29, 2019
·
6 revisions
Draw shapes
// construct top level window
gui& form = wex::windex::topWindow();
form.move({ 50,50,400,400});
form.text("A windex draw demo");
form.events().draw([]( PAINTSTRUCT& ps )
{
shapes S( ps );
S.color( 255, 0, 0 );
S.line( { 10,10, 50,50 } );
S.color( 255,255,255 );
S.rectangle( { 20,20,20,20});
S.color( 255,255,0 );
S.text( "test", {50,50,50,25} );
});
form.show();
form.run();
void color( int r, int g, int b )
Set color for drawing. r, g, b set values for red, green, blue in range 0 to 255.
void line( ( const std::vector<int>& v )
Draw a line from v[0],v[1] to c[2],v[3].
void rectangle( const std::vector<int>& v )
Draw a rectangle. left v[0], top v[1], right v[2], bottom v[3].
void text( const std::string& t, const std::vector<int>& v )
Draw text, clipped to rectangle v