Toolbar

PHOTO EMBED

Mon Apr 01 2024 02:04:22 GMT+0000 (Coordinated Universal Time)

Saved by @rvargas

#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
content_copyCOPY