#include "menubutton.h"
#include "drawutils.h"


MenuButton::MenuButton(string text, TTF_Font* font, int x, int y,
		       ButtonAction action)
{
    this->text = text;
    this->x = x;
    this->y = y;
    this->font = font;
    this->action = action;

    hover = false;
}


void MenuButton::set_hover(bool is_hovering)
{
    hover = is_hovering;
}


void MenuButton::draw(SDL_Surface* display, int colour, int background_colour)
{
    SDL_Rect pen = {x, y, 80, 20};

    SDL_FillRect(display, &pen, background_colour);

    int temp_colour = 0x000000;

    DrawUtils::draw_text(display, text, x + 40, y + 10, font, colour, 1, 1);
}


bool MenuButton::is_at(int test_x, int test_y)
{
    return test_x >= x && test_y >= y && test_x <= x + 100 && test_y <= y + 40;
}