Editor 2: a feature to draw hex coordinates and/or terrain code on every hex.
Also a minor changelog backlog.
This commit is contained in:
parent
df6ad3a378
commit
6dea6180f0
9 changed files with 88 additions and 7 deletions
|
@ -5,6 +5,8 @@ Version 1.5.4+svn:
|
|||
(hardcoded) list of time_of_days. Can change the settings and see the
|
||||
effects without having to close the settings dialog. The preferences
|
||||
are shared with the old editor.
|
||||
* Added a feature to draw hex coordinates and/or terrain code on every hex
|
||||
* Auto update transitions option is stored in the preferences
|
||||
* Graphics:
|
||||
* New or updated unit frames: Walking Corpse swimmer, Soulless swimmer
|
||||
* Language and i18n:
|
||||
|
|
|
@ -137,4 +137,18 @@
|
|||
key="t"
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editor-update-transitions"
|
||||
key="t"
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editor-draw-coordinates"
|
||||
key="o"
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editor-draw-terrain-codes"
|
||||
key="i"
|
||||
[/hotkey]
|
||||
#undef IF_APPLE_CMD_ELSE_CTRL
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
id=menu-editor-map
|
||||
title= _ "Map"
|
||||
image=lite
|
||||
items=editor-map-resize,editor-map-rotate,editor-map-flip-x,editor-map-flip-y,editor-map-generate,editor-refresh,editor-update-transitions,editor-auto-update-transitions,editor-refresh-image-cache
|
||||
items=editor-map-resize,editor-map-rotate,editor-map-flip-x,editor-map-flip-y,editor-map-generate,editor-refresh,editor-update-transitions,editor-auto-update-transitions,editor-refresh-image-cache,editor-draw-coordinates,editor-draw-terrain-codes
|
||||
rect="+2,=,+100,="
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
|
|
|
@ -6,6 +6,7 @@ Version 1.5.4+svn:
|
|||
* Editor2
|
||||
* Allow changing the display time of day from a preset list or to custom
|
||||
values via sliders, available in the new editor settings dialog.
|
||||
* Added a feature to draw hex coordinates and/or terrain code on every hex
|
||||
|
||||
* Language and translations
|
||||
* updated translations: Finnish, German, Lithuanian, Slovak, Valencian.
|
||||
|
|
|
@ -593,6 +593,9 @@ bool editor_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int
|
|||
return true;
|
||||
case HOTKEY_EDITOR_MAP_ROTATE:
|
||||
return false; //not implemented
|
||||
case HOTKEY_EDITOR_DRAW_COORDINATES:
|
||||
case HOTKEY_EDITOR_DRAW_TERRAIN_CODES:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -608,6 +611,10 @@ hotkey::ACTION_STATE editor_controller::get_action_state(hotkey::HOTKEY_COMMAND
|
|||
return is_mouse_action_set(command) ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS:
|
||||
return auto_update_transitions_ ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_EDITOR_DRAW_COORDINATES:
|
||||
return gui_->get_draw_coordinates() ? ACTION_ON : ACTION_OFF;
|
||||
case HOTKEY_EDITOR_DRAW_TERRAIN_CODES:
|
||||
return gui_->get_draw_terrain_codes() ? ACTION_ON : ACTION_OFF;
|
||||
default:
|
||||
return command_executor::get_action_state(command);
|
||||
}
|
||||
|
@ -727,6 +734,14 @@ bool editor_controller::execute_command(hotkey::HOTKEY_COMMAND command, int inde
|
|||
case HOTKEY_EDITOR_REFRESH_IMAGE_CACHE:
|
||||
refresh_image_cache();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_DRAW_COORDINATES:
|
||||
gui().set_draw_coordinates(!gui().get_draw_coordinates());
|
||||
gui().invalidate_all();
|
||||
return true;
|
||||
case HOTKEY_EDITOR_DRAW_TERRAIN_CODES:
|
||||
gui().set_draw_terrain_codes(!gui().get_draw_terrain_codes());
|
||||
gui().invalidate_all();
|
||||
return true;
|
||||
default:
|
||||
return controller_base::execute_command(command, index);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ editor_display::editor_display(CVideo& video, const editor_map& map,
|
|||
: display(video, map, theme_cfg, cfg, level)
|
||||
, brush_locations_()
|
||||
, toolbar_hint_()
|
||||
, draw_coordinates_(false)
|
||||
, draw_terrain_codes_(false)
|
||||
{
|
||||
clear_screen();
|
||||
}
|
||||
|
@ -84,9 +86,43 @@ void editor_display::draw_hex(const gamemap::location& loc)
|
|||
int drawing_order = gamemap::get_drawing_order(loc);
|
||||
tblit blit(xpos, ypos);
|
||||
display::draw_hex(loc);
|
||||
if (map().on_board_with_border(loc) && map().in_selection(loc)) {
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image("editor/selection-overlay.png", image::SCALED_TO_HEX)));
|
||||
if (map().on_board_with_border(loc)) {
|
||||
if (map().in_selection(loc)) {
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image("editor/selection-overlay.png", image::SCALED_TO_HEX)));
|
||||
}
|
||||
}
|
||||
if (map().on_board(loc)) {
|
||||
if (draw_coordinates_) {
|
||||
int off_x = xpos + hex_size()/2;
|
||||
int off_y = ypos + hex_size()/2;
|
||||
surface text = font::get_rendered_text(lexical_cast<std::string>(loc), font::SIZE_SMALL, font::NORMAL_COLOUR);
|
||||
surface bg = create_neutral_surface(text->w, text->h);
|
||||
SDL_Rect bg_rect = {0, 0, text->w, text->h};
|
||||
SDL_FillRect(bg, &bg_rect, 0xff000000);
|
||||
off_x -= text->w / 2;
|
||||
if (draw_terrain_codes_) {
|
||||
off_y -= text->h;
|
||||
} else {
|
||||
off_y -= text->h / 2;
|
||||
}
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order, tblit(off_x, off_y, bg));
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order, tblit(off_x, off_y, text));
|
||||
}
|
||||
if (draw_terrain_codes_) {
|
||||
int off_x = xpos + hex_size()/2;
|
||||
int off_y = ypos + hex_size()/2;
|
||||
surface text = font::get_rendered_text(lexical_cast<std::string>(map().get_terrain(loc)), font::SIZE_SMALL, font::NORMAL_COLOUR);
|
||||
surface bg = create_neutral_surface(text->w, text->h);
|
||||
SDL_Rect bg_rect = {0, 0, text->w, text->h};
|
||||
SDL_FillRect(bg, &bg_rect, 0xff000000);
|
||||
off_x -= text->w / 2;
|
||||
if (!draw_coordinates_) {
|
||||
off_y -= text->h / 2;
|
||||
}
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order, tblit(off_x, off_y, bg));
|
||||
drawing_buffer_add(LAYER_FOG_SHROUD, drawing_order, tblit(off_x, off_y, text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@ public:
|
|||
const editor_map& map() const { return static_cast<const editor_map&>(map_); }
|
||||
void rebuild_terrain(const gamemap::location &loc);
|
||||
void set_toolbar_hint(const std::string value) { toolbar_hint_ = value; }
|
||||
bool get_draw_coordinates() { return draw_coordinates_; }
|
||||
void set_draw_coordinates(bool value) { draw_coordinates_ = value; }
|
||||
bool get_draw_terrain_codes() { return draw_terrain_codes_; }
|
||||
void set_draw_terrain_codes(bool value) { draw_terrain_codes_ = value; }
|
||||
protected:
|
||||
void pre_draw();
|
||||
/**
|
||||
|
@ -48,6 +52,9 @@ protected:
|
|||
|
||||
std::set<gamemap::location> brush_locations_;
|
||||
std::string toolbar_hint_;
|
||||
|
||||
bool draw_coordinates_;
|
||||
bool draw_terrain_codes_;
|
||||
};
|
||||
|
||||
} //end namespace editor2
|
||||
|
|
|
@ -186,11 +186,16 @@ const struct {
|
|||
{ hotkey::HOTKEY_EDITOR_REFRESH, "editor-refresh",
|
||||
N_("Refresh Display"), false, hotkey::SCOPE_EDITOR },
|
||||
{ hotkey::HOTKEY_EDITOR_UPDATE_TRANSITIONS, "editor-update-transitions",
|
||||
N_("Update Terrain Tranistions"), false, hotkey::SCOPE_EDITOR },
|
||||
N_("Update Terrain Transitions"), false, hotkey::SCOPE_EDITOR },
|
||||
{ hotkey::HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS, "editor-auto-update-transitions",
|
||||
N_("Auto-update Terrain Transitions"), false, hotkey::SCOPE_EDITOR },
|
||||
N_("Auto-update Terrain Transitions"), false, hotkey::SCOPE_EDITOR },
|
||||
{ hotkey::HOTKEY_EDITOR_REFRESH_IMAGE_CACHE, "editor-refresh-image-cache",
|
||||
N_("Refresh Image Cache"), false, hotkey::SCOPE_EDITOR },
|
||||
N_("Refresh Image Cache"), false, hotkey::SCOPE_EDITOR },
|
||||
{ hotkey::HOTKEY_EDITOR_DRAW_COORDINATES, "editor-draw-coordinates",
|
||||
N_("Draw Hex Coordinates"), false, hotkey::SCOPE_EDITOR },
|
||||
{ hotkey::HOTKEY_EDITOR_DRAW_TERRAIN_CODES, "editor-draw-terrain-codes",
|
||||
N_("Draw Terrain Codes"), false, hotkey::SCOPE_EDITOR },
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@ enum HOTKEY_COMMAND {
|
|||
HOTKEY_EDITOR_REFRESH, HOTKEY_EDITOR_UPDATE_TRANSITIONS,
|
||||
HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS,
|
||||
HOTKEY_EDITOR_REFRESH_IMAGE_CACHE,
|
||||
HOTKEY_EDITOR_DRAW_COORDINATES, HOTKEY_EDITOR_DRAW_TERRAIN_CODES,
|
||||
#endif
|
||||
|
||||
//misc.
|
||||
|
|
Loading…
Add table
Reference in a new issue