highlight editor right button selected

This commit is contained in:
2025-05-13 12:40:37 -05:00
parent c1c18adf8e
commit 3ee36b6dbc
3 changed files with 17 additions and 1 deletions

View File

@@ -71,6 +71,7 @@ std::vector<rb_t> right_button_status;
rectangle right_buttons[NRSONPAGE];
rectangle palette_buttons[10][6];
short current_rs_top = 0;
extern short right_button_hovered;
ePalBtn out_buttons[6][10] = {
{PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET, PAL_DROPPER},
@@ -186,8 +187,17 @@ void update_mouse_spot(location the_point) {
rectangle terrain_rect = ::terrain_rect;
terrain_rect.inset(8,8);
terrain_rect.right -= 4;
if(overall_mode >= MODE_MAIN_SCREEN)
if(overall_mode >= MODE_MAIN_SCREEN){
set_cursor(sword_curs);
// Mouse over right-side buttons: highlight which is selected, because accidental misclicks are common
right_button_hovered = -1;
for(int i = 0; i < NRSONPAGE; i++){
if(the_point.in(right_buttons[i])){
right_button_hovered = i;
}
}
}
else if(terrain_rect.contains(the_point)) {
set_cursor(get_edit_cursor());
if(cur_viewing_mode == 0) {

View File

@@ -64,6 +64,7 @@ short mini_map_scales[3] = {12, 6, 4};
//extern btn_t buttons[];
extern location cur_out, mouse_spot;
extern ter_num_t current_ground;
extern short right_button_hovered;
short num_ir[3] = {12,10,4};
@@ -511,6 +512,9 @@ void draw_rb_slot (short which,short mode) {
TextStyle style;
if(mode > 0)
style.colour = Colours::RED;
else if(right_button_hovered == which - pos)
style.colour = Colours::GREEN;
style.lineHeight = 12;
win_draw_string(mainPtr(),text_rect,right_button_status[which].label,eTextMode::WRAP,style);
}

View File

@@ -60,6 +60,8 @@ short cen_x, cen_y;
eScenMode overall_mode = MODE_INTRO_SCREEN;
std::shared_ptr<cScrollbar> right_sbar, pal_sbar;
short mode_count = 0;
short right_button_hovered = -1;
cOutdoors* current_terrain;
std::string scenario_temp_dir_name = "ed_scenario";