void lmb_released() { //printf("Left mouse button released.\n"); switch(state){ case main_menu: click_button(start_menu, mouse_info.x, mouse_info.y); break; case highscore: click_button(highscore_menu, mouse_info.x, mouse_info.y); break; case options: click_button(options_menu, mouse_info.x, mouse_info.y); break; case game_over: click_button(game_over_menu, mouse_info.x, mouse_info.y); break; } }
//------------------------------------------------------------------------------ void TPrefsView::ShortCutDown(int32 oChar, int32 oFunc) { switch ( oChar ) { case B_FUNCTION_KEY: if ( oFunc == B_F1_KEY ) { click_button(mButtonHelp); } break; default: SUPER::ShortCutDown(oChar, oFunc); } }
int main(int argc, char *argv[]) { printf("Usage to click buttons: %s <window-title> <button-name>\n", argv[0]); printf("Usage to identify buttons: %s <window-title>\n", argv[0]); printf("Usage to identify windows: %s\n", argv[0]); switch (argc) { case 1: enum_windows(); break; case 2: enum_buttons(argv[1]); break; case 3: click_button(argv[1], argv[2]); break; } return 1; }
void draw_guis(BITMAP *bmp, int col) { if(mouse_b & 1) { if(!mouse_click) mouse_click = 1; else mouse_click = 2; } else mouse_click = 0; GUI *hover = NULL; GUI *G = gui; while(G != NULL) { switch(G->type) { case GUI_BUTTON: { bool sel = false; if(mouse_x >= G->x && mouse_x <= G->x+G->width && mouse_y >= G->y && mouse_y <= G->y+G->height) { sel = true; if(!G->disabled) hover = G; } draw_button(bmp, G->x,G->y, G->width,G->height, col, G->text, sel, G->disabled); if(sel && mouse_click == 1) click_button(G); break; } case GUI_OPTION: { update_option(G); int txtw = G->width; int txth = G->height; int startx = G->x - (G->width/2); int starty = G->y - (G->height/2); draw_button(bmp, startx,starty, txtw,txth+9, col, G->text, false, false); break; } case GUI_LABEL: { int w = text_length(font2,G->text); int h = text_height(font2); textout_ex(bmp, font2, G->text, G->x - (w/2), G->y - (h/2), G->col, -1); break; } case GUI_WINDOW: { draw_window(bmp, G->x,G->y, G->width,G->height, col); break; } } G = G->next; } update_mouse_hover(hover); }
static void handle_click() { if (debug) printf("Clicked\n"); click_button(BTN_MIDDLE, 1); }