editor2: add tool overlays for select and starting position,

...remove the redundant tool menu, make the mouse overlay draw on
border tiles when in the editor
This commit is contained in:
Tomasz Śniatowski 2008-09-26 15:38:27 +01:00
parent fa59a12469
commit 803957f120
8 changed files with 24 additions and 16 deletions

View file

@ -146,16 +146,6 @@
yanchor=fixed
[/menu]
[menu]
id=menu-editor-tool
title= _ "Tool"
image=lite
items=editor-tool-paint,editor-tool-fill,editor-tool-select,editor-tool-starting-position
rect="+2,=,+100,="
xanchor=fixed
yanchor=fixed
[/menu]
[menu]
id=menu-editor-selection
is_context_menu=true

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1906,7 +1906,7 @@ void display::draw_hex(const gamemap::location& loc) {
if(loc == selectedHex_ && on_map && selected_hex_overlay_ != NULL) {
drawing_buffer_add(LAYER_TERRAIN_TMP_BG, drawing_order, tblit(xpos, ypos, selected_hex_overlay_));
}
if(loc == mouseoverHex_ && on_map && mouseover_hex_overlay_ != NULL) {
if(loc == mouseoverHex_ && (on_map || in_editor() && map_.on_board_with_border(loc)) && mouseover_hex_overlay_ != NULL) {
drawing_buffer_add(LAYER_TERRAIN_TMP_BG, drawing_order, tblit(xpos, ypos, mouseover_hex_overlay_));
}

View file

@ -1101,6 +1101,7 @@ void editor_controller::process_keyup_event(const SDL_Event& event)
{
editor_action* a = get_mouse_action()->key_event(gui(), event);
perform_refresh_delete(a);
set_mouseover_overlay();
}
void editor_controller::set_mouseover_overlay()

View file

@ -65,9 +65,7 @@ void editor_display::pre_draw()
image::TYPE editor_display::get_image_type(const gamemap::location& loc)
{
if(brush_locations_.empty() && loc == mouseoverHex_ && map_.on_board_with_border(mouseoverHex_)) {
return image::BRIGHTENED;
} else if (brush_locations_.find(loc) != brush_locations_.end()) {
if (brush_locations_.find(loc) != brush_locations_.end()) {
return image::BRIGHTENED;
} else if (highlighted_locations_.find(loc) != highlighted_locations_.end()) {
return image::SEMI_BRIGHTENED;

View file

@ -297,7 +297,19 @@ editor_action* mouse_action_select::click_perform_right(
void mouse_action_select::set_mouse_overlay(editor_display& disp)
{
disp.set_mouseover_hex_overlay(NULL); //TODO
surface image;
if (has_shift_modifier()) {
image = image::get_image("editor/tool-overlay-select-wand.png");
} else {
image = image::get_image("editor/tool-overlay-select-brush.png");
}
Uint8 alpha = 196;
int size = image->w;
int zoom = static_cast<int>(size * disp.get_zoom_factor());
// Add the alpha factor and scale the image
image = scale_surface(adjust_surface_alpha(image, alpha), zoom, zoom);
disp.set_mouseover_hex_overlay(image);
}
@ -411,7 +423,14 @@ editor_action* mouse_action_starting_position::click_right(editor_display& /*dis
void mouse_action_starting_position::set_mouse_overlay(editor_display& disp)
{
disp.set_mouseover_hex_overlay(NULL); //TODO
surface image = image::get_image("editor/tool-overlay-starting-position.png");
Uint8 alpha = 196;
int size = image->w;
int zoom = static_cast<int>(size * disp.get_zoom_factor());
// Add the alpha factor and scale the image
image = scale_surface(adjust_surface_alpha(image, alpha), zoom, zoom);
disp.set_mouseover_hex_overlay(image);
}