void gui_enter() { int x = 1; DIALOG_PLAYER *dp; while (keypressed()) readkey(); while (key[KEY_F11]) rest(100); gui_update(); if (curtube != 3 && !mouse_amx) install_mouse(); set_color_depth(dcol); show_mouse(screen); bemgui[0].x = (windx / 2) - 36; bemgui[0].y = windy - 8; bemgui[0].fg = makecol(255,255,255); dp=init_dialog(bemgui, 0); while (x && !key[KEY_F11] && !key[KEY_ESC]) { x = update_dialog(dp); } shutdown_dialog(dp); show_mouse(NULL); set_color_depth(8); if (curtube != 3 && !mouse_amx) remove_mouse(); while (key[KEY_F11]) rest(100); video_clearscreen(); }
void options_menu() { show_mouse(screen); DIALOG options_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) */ {d_bitmap_proc, 0, 0,SCREEN_W,SCREEN_H,0,255, 0, 0, 0, 0, title_back}, {d_gamespeed_proc, 20, 10, 0, 0, 0, 0, 0,D_SELECTED, 0, 0, const_cast<char *>("gamespeed")}, {d_slider_proc, 300, 20, 30, 440, 0, 255, 0, 0, 255, get_config_int("MINER","BPS", 32) - 32, NULL, (void *)speedslider_callback}, {d_mapsize_proc, 20, 60, 0, 0, 0, 0, 0, 0, 0, 0, const_cast<char *>("mapsize")}, {d_slider_proc, 300, 20, 30, 440, 0, 255, 0,D_HIDDEN, 80, get_config_int("MINER","MAP_SIZE",20) - 20, NULL, (void *)mapsizeslider_callback}, {d_sound_proc, 20, 110, 0, 0, 0, 0, 0, 0, 0, 0, const_cast<char *>("sound")}, {d_slider_proc, 300, 40, 30, 300, 0, 255, 0,D_HIDDEN, 6, (int)log2(get_config_int("MINER","NR_OF_VOICES",0) + 1), NULL, (void *)soundslider_callback}, {d_text_proc, 300, 10, 200, 30, 0, 255, 0,D_HIDDEN, 0, 0, const_cast<char *>("Nr of simultaneous sounds")}, {d_number_proc, 330, 20, 0, 0, 0, 0, 0, 0, 3, get_config_int("MINER","BPS", 32), NULL}, {d_number_proc, 330, 20, 0, 0, 0, 0, 0,D_HIDDEN, 3, get_config_int("MINER","MAP_SIZE",20) , NULL}, {d_number_proc, 330, 40, 0, 0, 0, 0, 0,D_HIDDEN, 2, get_config_int("MINER","NR_OF_VOICES",1), NULL}, {d_back_proc, 20, 160, 0, 0, 0, 0, 0, 0, 0, 0, const_cast<char *>("exit menu")}, {NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL} }; the_options_dialog = options_dialog; // ugly, but I found it easier to initialise the dialog // within the function, where all BITMAPS's are loaded etc. PALETTE options_palette; for (int i=0;i < 256;i++) { options_palette[i].r = game_palette[i].g; options_palette[i].g = game_palette[i].b; options_palette[i].b = game_palette[i].r; } set_dialog_color(options_dialog, bestfit_color(options_palette,0,0,0), bestfit_color(options_palette,63,63,63)); DIALOG_PLAYER *p = init_dialog(options_dialog, 1); broadcast_dialog_message(MSG_DRAW, 0); // update_dialog(p); if (fade_speed) { fade_from(desktop_palette,options_palette,fade_speed); } else { set_palette(options_palette); } while(update_dialog(p)); shutdown_dialog(p); set_config_int("MINER","BPS", options_dialog[SPEED_SLIDER].d2 + 32); set_config_int("MINER","MAP_SIZE", options_dialog[MAPSIZE_SLIDER].d2 + 20); set_config_int("MINER","NR_OF_VOICES", (1<<options_dialog[SOUND_SLIDER].d2)); show_mouse(NULL); reinit(); return; }
/* Function to select type of activation mode */ int select_act(ptime* v_offset, int numTask) { int i, id, ret, mode; int val; bool box_offset_active = false; char* endptr; char text_offset[NUM_T_TEST][W_TEXT_OFFSET+1]; //all strings OFFSET "Px" (ex.text_offset[0]="Offs0:") char edit_offset[NUM_T_TEST][NUM_CIF_OFFSET+1]; //all strings of edit fields /* add editable fields (offset) to dialog */ update_dialogAct (text_offset, edit_offset); show_mouse(screen); DIALOG_PLAYER *player = init_dialog(taskFunction_dialog, -1); while (update_dialog(player)) { /* reading activation mod (NOW, DEF offset, DEFFERED no offset)*/ mode = taskFunction_dialog[4].d1; if(mode == MOD_DEF_OFFSET && !box_offset_active) { box_offset_active = true; /* it makes offset's box visible and active */ activate_offset_box (ON); } if( mode != MOD_DEF_OFFSET && box_offset_active ) { box_offset_active = false; /* it makes offset's box invisible and inactive */ activate_offset_box (OFF); } if( mode == MOD_DEF_OFFSET) { /* index of object get focus */ id = find_dialog_focus(taskFunction_dialog); /* ex.: if tasks are 5, the index of editable fields to checking are 12 14 16 18 20: * we dont'check editable field that get focus*/ for(i = 9; i <= (NUM_T_TEST * 2 + 7) && i != id; i = i + 2) { val = strtol(taskFunction_dialog[i].dp, &endptr, 10); if (error_edit (taskFunction_dialog[i].dp, "offset", endptr, val, OFFSET_MAX)) { snprintf (taskFunction_dialog[i].dp, NUM_CIF_OFFSET + 1, "%d", OFFSET_MAX); taskFunction_dialog[i].flags = D_DIRTY; } } } } ret = shutdown_dialog(player); scare_mouse(); for(i = 0; i < NUM_T_TEST; i++) { v_offset[i] = strtol(edit_offset[i], &endptr, 10); } if (ret == 6 || ret < 0) return -1; else { return mode; } }