예제 #1
0
	//Update all possible button states (hover, click, toggle etc.)
	void gui_window::update(gs_scalar tx, gs_scalar ty){
    if (enigma_user::mouse_check_button_pressed(enigma_user::mb_left) && gui::windowStopPropagation == false){ //Press
      if(box.point_inside(tx,ty)){
        state = enigma_user::gui_state_on;
        if (draggable == true){
          drag = true;
          drag_xoffset = tx-box.x;
          drag_yoffset = ty-box.y;
        }
      }else{
        state = enigma_user::gui_state_default;
      }
    }

    if (box.point_inside(tx,ty)){ //Hover
        windowStopPropagation = true;
    }

		if (drag == true){
      windowStopPropagation = true;
			box.x = tx-drag_xoffset;
			box.y = ty-drag_yoffset;
			if (enigma_user::mouse_check_button_released(enigma_user::mb_left)){
				drag = false;
			}
			update_text_pos();
		}
	}
예제 #2
0
파일: button.c 프로젝트: rofl0r/mtk
static void but_updatepos(BUTTON *b)
{
    update_text_pos(b);
    orig_updatepos(b);
}