Skip to content
Snippets Groups Projects
Select Git revision
  • b8b82252279ddcf7f4905b73cef4d9afa5b9f204
  • main default protected
2 results

widget.cpp

Blame
  • widget.cpp 487 B
    #include "widget.h"
    
    using namespace genv;
    
    Widget::Widget(Palya* _p, int _x, int _y, int _w, int _h) : p(_p), x(_x), y(_y), w(_w), h(_h){}
    
    bool Widget::hozzaer(event ev)
    {
        if(ev.pos_x > x && ev.pos_x < x+w && ev.pos_y < y+h && ev.pos_y > y)
            return true;
        else
            return false;
    }
    
    bool Widget::select(event ev)
    {
        if(hozzaer(ev) && ev.button==btn_left)
            return true;
        if(!hozzaer(ev) && ev.button==btn_left)
            return false;
    }