#ifndef TOOLBAR_H #define TOOLBAR_H #include "Rectangle.h" #include "Texture.h" enum Button {UP, DOWN, NONE}; class Toolbar { Rectangle area; Texture upArrow; Button button; Texture downArrow; public: Toolbar(){ area = Rectangle(-1.0f, 1.0f, 2.0f, 0.2f, Color(1.0f, 1.0f, 1.0f)); upArrow = Texture("assets/upArrow.png", 0.7f, 0.95f, 0.1f, 0.1f, true); downArrow = Texture("assets/downArrow.png", 0.8f, 0.95f, 0.1f, 0.1f, true); } void handleMouseClick(float x, float y){ } void draw(){ area.draw(); upArrow.draw(); downArrow.draw(); } Button handleMouse(float x, float y){ if(upArrow.contains(x, y)){ return UP; } else if(downArrow.contains(x, y)){ return DOWN; } else{ return NONE; } } bool contains(float x, float y){ return area.contains(x, y); } }; #endif
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter