Example #1
0
static void draw_text_info(int x, int y, int dx, int dy, int pos)
{
	char buffer[3][256];

	adv_crtc* crtc = menu_pos(pos);

	if (crtc) {
		format_info(buffer[0], buffer[1], buffer[2], 256, crtc);
	} else {
		sncpy(buffer[0], sizeof(buffer[0]), "");
		sncpy(buffer[1], sizeof(buffer[1]), "");
		sncpy(buffer[2], sizeof(buffer[2]), "");
	}

	draw_text_left(x, y+0, dx, buffer[0], COLOR_INFO_TITLE);
	draw_text_left(x, y+1, dx, buffer[1], COLOR_INFO_NORMAL);
	draw_text_left(x, y+2, dx, buffer[2], COLOR_INFO_NORMAL);

	if (crtc) {
		if (crtc_is_fake(crtc)) {
			draw_text_left(x+dx-8, y, 8, " SYSTEM ", COLOR_INFO_NORMAL);
		} else if (!crtc_clock_check(&the_monitor, crtc)) {
			draw_text_left(x+dx-14, y, 14, " OUT OF RANGE ", COLOR_ERROR);
		} else {
			draw_text_left(x+dx-14, y, 14, " PROGRAMMABLE ", COLOR_INFO_NORMAL);
		}
	} else {
		draw_text_fillrect(x, y, ' ', dx, dy, COLOR_INFO_NORMAL);
	}
}
void key_map::config_input()
{
    CURRENT_FILE_FORMAT::st_game_config game_config_copy = game_config;
    int selected_option = 0;

    while (selected_option != -1) {
        selected_option = draw_config_keys();

        std::cout << "key_map::config_input - selected_option: " << selected_option << std::endl;

        if (selected_option == 0) {
            game_config.set_default_keys();
            std::cout << "key_map::config_input - LEAVE #1" << std::endl;
        } else if (selected_option == -1) {
            std::cout << "key_map::config_input - LEAVE #2" << std::endl;
            // apply changes to game-config
            apply_key_codes_changes(game_config_copy);
            return;

        // -- NEW -- //
        } else if (selected_option == 8) {
            if (game_config.input_mode == INPUT_MODE_DIGITAL) {
                game_config.input_mode = INPUT_MODE_ANALOG;
            } else {
                game_config.input_mode = INPUT_MODE_DIGITAL;
            }
        // -- NEW -- //


        } else {
            std::cout << "key_map::config_input - PICK KEY #1" << std::endl;
            INPUT_COMMANDS selected_key = BTN_JUMP;
            if (selected_option == 1) {
                selected_key = BTN_JUMP;
            } else if (selected_option == 2) {
                selected_key = BTN_ATTACK;
            } else if (selected_option == 3) {
                selected_key = BTN_SHIELD;
            } else if (selected_option == 4) {
                selected_key = BTN_DASH;
            } else if (selected_option == 5) {
                selected_key = BTN_L;
            } else if (selected_option == 6) {
                selected_key = BTN_R;
            } else if (selected_option == 7) {
                selected_key = BTN_START;
            } else if (selected_option == 9) {
                selected_key = BTN_UP;
            } else if (selected_option == 10) {
                selected_key = BTN_DOWN;
            } else if (selected_option == 11) {
                selected_key = BTN_LEFT;
            } else if (selected_option == 12) {
                selected_key = BTN_RIGHT;
            }

            st_position menu_pos(graphLib.get_config_menu_pos().x + 74, graphLib.get_config_menu_pos().y + 40);
            graphLib.clear_area(menu_pos.x, menu_pos.y, 180,  180, 0, 0, 0);
            graphLib.draw_text(menu_pos.x, menu_pos.y, "PRESS A KEY OR BUTTON");
            input.clean();
            input.waitTime(20);
            bool is_joystick = input.pick_key_or_button(game_config_copy, selected_key);
            check_key_duplicates(game_config_copy, selected_key, is_joystick);
        }
    }
    // apply changes to game-config
    apply_key_codes_changes(game_config_copy);
}
Example #3
0
static void menu_item_draw(int x, int y, int dx, int pos, adv_bool selected)
{
	char buffer[256];

	adv_crtc* crtc = menu_pos(pos);

	if (crtc) {
		char tag;
		unsigned pos;
		unsigned color;
		unsigned color_n;
		unsigned color_clock;
		char pfreq_buffer[8];
		char vfreq_buffer[8];
		char hfreq_buffer[8];

		if (selected) {
			if (crtc->user_flags & MODE_FLAGS_USER_BIT0) {
				tag = 'þ';
				color = COLOR_SELECTED_MARK;
				color_n = color;
			} else {
				tag = ' ';
				color = COLOR_SELECTED;
				color_n = color;
			}
		} else {
			if (crtc->user_flags & MODE_FLAGS_USER_BIT0) {
				tag = 'þ';
				if (crtc_is_fake(crtc) || crtc_clock_check(&the_monitor, crtc)) {
					color = COLOR_MARK;
					color_n = color;
				} else {
					color = COLOR_MARK;
					color_n = COLOR_MARK_BAD;
				}
			} else {
				tag = ' ';
				if (crtc_is_fake(crtc) || crtc_clock_check(&the_monitor, crtc)) {
					color = COLOR_NORMAL;
					color_n = color;
				} else {
					color = COLOR_NORMAL;
					color_n = COLOR_BAD;
				}
			}
		}

		snprintf(vfreq_buffer, sizeof(vfreq_buffer), "%7.2f", (double)crtc_vclock_get(crtc));

		snprintf(hfreq_buffer, sizeof(hfreq_buffer), "%7.2f", (double)crtc_hclock_get(crtc) / 1E3);

		snprintf(pfreq_buffer, sizeof(pfreq_buffer), "%7.2f", (double)crtc_pclock_get(crtc) / 1E6);

		snprintf(buffer, sizeof(buffer), " %c %4d %4d", tag, crtc->hde, crtc->vde);

		pos = 0;

		pos += draw_text_string(x + pos, y, buffer, color_n);

		pos += draw_text_string(x + pos, y, pfreq_buffer, color_n);
		pos += draw_text_string(x + pos, y, hfreq_buffer, color_n);
		pos += draw_text_string(x + pos, y, vfreq_buffer, color_n);

		snprintf(buffer, sizeof(buffer), " %s", crtc->name);

		draw_text_left(x + pos, y, dx - pos, buffer, color_n);
	} else {
		draw_text_fill(x, y, ' ', dx, COLOR_NORMAL);
	}
}
Example #4
0
static adv_crtc* menu_current(void)
{
	return menu_pos(menu_base + menu_rel);
}