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:
parent
fa59a12469
commit
803957f120
8 changed files with 24 additions and 16 deletions
|
@ -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
|
||||
|
|
BIN
images/editor/tool-overlay-select-brush.png
Normal file
BIN
images/editor/tool-overlay-select-brush.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
images/editor/tool-overlay-select-wand.png
Normal file
BIN
images/editor/tool-overlay-select-wand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
images/editor/tool-overlay-starting-position.png
Normal file
BIN
images/editor/tool-overlay-starting-position.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -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_));
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue