Is there a reason for the code not working with TitleBar as a name?
- Bar Title;
- void setup()
- {
- size(400, 400);
- background(0,0,0);
- Title = new Bar(color(255,255,255),100);
- Title.Draw();
- }
- class Bar
- {
- //Data: Declare variables used in Methods
- color BarColor;
- int TabWide;
- int Tall;
- //Constructor: Variables used in class
- Bar(color tBarColor, int tTabWide)
- {
- BarColor = tBarColor;
- TabWide = tTabWide;
- Tall = 20;
- }
- //Methods
- void Draw()
- {
- // Shape borders and filling
- noStroke();
- fill(BarColor);
- // Rectangle: rect(x1,y2,width,height)
- rectMode(CORNER);
- rect(0,0,width,Tall);
- // Quadrilateral: quad(x1,y1, x2,y2, x3,y3, x4,y4)
- quad(Tall,Tall, Tall+TabWide,Tall, TabWide,2*Tall, 2*Tall,2*Tall);
- }
- }
1