Почему при наведении курсора на кнопки, они не подсвечиваются, но зато подсвечиваются,…
- User
Почему при наведении курсора на кнопки, они не подсвечиваются, но зато подсвечиваются, если я навожу курсор в местах ниже них? А также судя по всему места наведения не адаптируются под изменение размера окна.
Create
// Логотип _logo_text = LOCALIZE.menu.name; // Инициализация размеров текста логотипа draw_set_font(fnt_centurygothic_logo); _logo_1st_line_text_width = string_width(_logo_text); _logo_2nd_line_text_width = string_width(_logo_text); _logo_text_height = string_height(_logo_text); // Позиции логотипа _logo_1st_line_x1 = 55; _logo_1st_line_y1 = 66; _logo_1st_line_x2 = _logo_1st_line_x1 + _logo_1st_line_text_width; _logo_1st_line_y2 = _logo_1st_line_y1 + _logo_text_height; _logo_2nd_line_x1 = 53; _logo_2nd_line_y1 = 146; _logo_2nd_line_x2 = _logo_2nd_line_x1 + _logo_2nd_line_text_width; _logo_2nd_line_y2 = _logo_2nd_line_y1 + _logo_text_height; // Кнопка 1 _1st_button_text = LOCALIZE.menu.begin_game; // Позиция первой кнопки _1st_button_x1 = 89; _1st_button_y1 = _logo_2nd_line_y1 + _logo_text_height + 63; // Инициализация размеров текста кнопки draw_set_font(os_type == os_android ? fnt_centurygothic_and_btn : fnt_centurygothic_win_btn); _1st_button_text_width = string_width(_1st_button_text); _1st_button_text_height = string_height(_1st_button_text); // Инициализация списка кнопок _button_list = ds_list_create(); // Флаг для проверки необходимости расчётов _layout_computed = false; // Определение текстов кнопок _button_texts = [_1st_button_text, "Магазин", "Дополнительно", "Настройки", "Об игре", "Статистика", "Выйти из игры"]; // Инициализация предыдущих размеров экрана для отслеживания изменений _prev_width = global._crossplatform_window_width / 2; _prev_height = global._crossplatform_window_height;Step
// Проверка изменения размеров экрана if (global._crossplatform_window_width / 2 != _prev_width or global._crossplatform_window_height != _prev_height) { _layout_computed = false; _prev_width = global._crossplatform_window_width / 2; _prev_height = global._crossplatform_window_height; } // Расчёт расположения кнопок, если это необходимо if (!_layout_computed) { // Очистка существующего списка кнопок ds_list_clear(_button_list); // Получение размеров окна var _screen_width = global._crossplatform_window_width / 2; var _screen_height = global._crossplatform_window_height; var _padding = 50; // Отступ между кнопками var _x_pos = _1st_button_x1; // Начальная позиция по X var _y_pos = _1st_button_y1; // Начальная позиция по Y var _line_height = string_height("Т") + _padding; // Высота строки // Установка шрифта в зависимости от ОС if (os_type == os_android) { draw_set_font(fnt_centurygothic_and_btn); } else if (os_type == os_windows) { draw_set_font(fnt_centurygothic_win_btn); } // Расчёт позиций и размеров кнопок for (var _i = 0; _i < array_length_1d(_button_texts); _i++) { var _text = _button_texts[_i]; var _text_width = string_width(_text); var _text_height = string_height(_text); // Проверка, помещается ли текст в текущую строку if (_x_pos + _text_width > _screen_width - _padding) { // Если нет, переход на новую строку _x_pos = _1st_button_x1; _y_pos += _line_height; } // Создание карты с информацией о кнопке var _button = ds_map_create(); ds_map_add(_button, "text", _text); ds_map_add(_button, "x", _x_pos); ds_map_add(_button, "y", _y_pos); ds_map_add(_button, "width", _text_width); ds_map_add(_button, "height", _text_height); ds_map_add(_button, "action", _i); // Индекс кнопки для определения действия // Добавление кнопки в список ds_list_add(_button_list, _button); show_debug_message("Button " + string(_i) + ": " + _text + " at (" + string(_x_pos) + ", " + string(_y_pos) + ")"); // Обновление позиции X для следующей кнопки _x_pos += _text_width + _padding; } // Установка флага, что расчёт выполнен _layout_computed = true; } - Assistant