X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbutton.cpp;h=fadd00a0cafedc4dd0d1996f8be7a0ec6ae8fdaf;hb=ecc3ffc4433f14534560bbe51441e7f02e42a0c1;hp=57e5fa42f57981cfb3398576b5a6563b3d5b4843;hpb=707b59d45ae50b69c94918f8f74313283b304597;p=libs%2Fgltk.git diff --git a/source/button.cpp b/source/button.cpp index 57e5fa4..fadd00a 100644 --- a/source/button.cpp +++ b/source/button.cpp @@ -13,6 +13,7 @@ Button::Button(const std::string &t): icon(0), pressed(false) { + input_type = INPUT_NAVIGATION; set_text(t); } @@ -56,15 +57,15 @@ void Button::rebuild_special(const Part &part) GL::MeshBuilder bld(part_cache.create_mesh(part, *icon)); bld.color(1.0f, 1.0f, 1.0f); - bld.begin(GL::QUADS); + bld.begin(GL::TRIANGLE_STRIP); + bld.texcoord(0, 1); + bld.vertex(rgeom.x, rgeom.y+rgeom.h); bld.texcoord(0, 0); bld.vertex(rgeom.x, rgeom.y); - bld.texcoord(1, 0); - bld.vertex(rgeom.x+rgeom.w, rgeom.y); bld.texcoord(1, 1); bld.vertex(rgeom.x+rgeom.w, rgeom.y+rgeom.h); - bld.texcoord(0, 1); - bld.vertex(rgeom.x, rgeom.y+rgeom.h); + bld.texcoord(1, 0); + bld.vertex(rgeom.x+rgeom.w, rgeom.y); bld.end(); } } @@ -102,6 +103,16 @@ void Button::pointer_motion(int x, int y) } } +bool Button::navigate(Navigation nav) +{ + if(nav==NAV_ACTIVATE) + signal_clicked.emit(); + else + return false; + + return true; +} + void Button::on_style_change() { text.set_style(style);