Old:
float hw = width * 0.5f; float hh = height * 0.5f; // draw dark background vsDisplayList *list = new vsDisplayList(512); vsVector3D va[4] = { vsVector2D(-hw,-hh), vsVector2D(hw,-hh), vsVector2D(-hw,hh), vsVector2D(hw,hh) }; int ts[4] = { 0,1,2,3 }; int ls[5] = { 0,1,3,2,0 }; list->SetColor(vsColor(0.0f,0.0f,0.0f,0.9f)); list->VertexArray(va,4); list->TriangleStrip(ts,4); list->SetColor( vsColor::White ); list->LineStrip(ls,5); list->ClearVertexArray(); vsFragment *fragment = new vsFragment; fragment->SetDisplayList(list); fragment->SetMaterial( "White" ); AddFragment( fragment );
New:
vsBox2D box( width, height ); box.Recenter(); AddFragment( vsMakeSolidBox2D( box, "TestimonyButton" ) ); AddFragment( vsMakeOutlineBox2D( box, "White" ) );
This is much nicer, innit? :)
Certainly it’s a lot shorter. Both create an identical box with an identical white outline. This is just using the new “vsMakeSolidBox2D()” set of functions which were recently added to VS_Primitive.h. I really ought to have more utility functions like these; they make it an awful lot faster to quickly prototype things!