diff options
author | Raphael Langella <raphael.langella@gmail.com> | 2012-10-08 14:12:55 +0200 |
---|---|---|
committer | Raphael Langella <raphael.langella@gmail.com> | 2012-10-08 18:11:11 +0200 |
commit | 74c35ba6f35c2ecb3e6baf8cf1a6ede7cbdda23d (patch) | |
tree | d26a4c2bc065ca3f11dbb4f1bf17ed2314993162 /crawl-ref/source/menu.cc | |
parent | 589acc5e30fdeb6f424fbecb3e0e7539c5bdab94 (diff) | |
download | crawl-ref-74c35ba6f35c2ecb3e6baf8cf1a6ede7cbdda23d.tar.gz crawl-ref-74c35ba6f35c2ecb3e6baf8cf1a6ede7cbdda23d.zip |
Scale the skill menu tiles.
Scale up with the tile_cell_pixels option, and scale down when the
resolution is too low (instead of disabling tiles).
Diffstat (limited to 'crawl-ref/source/menu.cc')
-rw-r--r-- | crawl-ref/source/menu.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index 70b9db627e..a55fc6d7fc 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -2538,9 +2538,9 @@ MenuItem::~MenuItem() } #ifdef USE_TILE_LOCAL -void MenuItem::set_tile_height() +void MenuItem::set_height(const int height) { - m_unit_height_pixels = TILE_Y; + m_unit_height_pixels = height; } #endif @@ -2908,6 +2908,7 @@ TextTileItem::TextTileItem() { for (int i = 0; i < TEX_MAX; i++) m_tile_buf[i].set_tex(&tiles.get_image_manager()->m_textures[i]); + m_unit_height_pixels = max<int>(m_unit_height_pixels, TILE_Y); } TextTileItem::~TextTileItem() @@ -2927,9 +2928,8 @@ void TextTileItem::set_bounds(const coord_def &min_coord, const coord_def &max_c // but tiles starts at (0,0) m_min_coord.x = (min_coord.x - 1) * m_unit_width_pixels; m_max_coord.x = (max_coord.x - 1) * m_unit_width_pixels; - m_min_coord.y = (min_coord.y - 1) * TILE_Y; - m_max_coord.y = (max_coord.y - 1) * TILE_Y; - set_tile_height(); + m_min_coord.y = (min_coord.y - 1) * m_unit_height_pixels; + m_max_coord.y = (max_coord.y - 1) * m_unit_height_pixels; } void TextTileItem::render() @@ -2947,11 +2947,12 @@ void TextTileItem::render() int tile = m_tiles[t].tile; TextureID tex = m_tiles[t].tex; m_tile_buf[tex].add_unscaled(tile, m_min_coord.x, m_min_coord.y, - m_tiles[t].ymax); + m_tiles[t].ymax, + (float)m_unit_height_pixels / TILE_Y); } // center the text // TODO wrap / chop the text - const int tile_offset = m_tiles.empty() ? 0 : 32; + const int tile_offset = m_tiles.empty() ? 0 : m_unit_height_pixels; m_font_buf.add(m_text, term_colours[m_fg_colour], m_min_coord.x + tile_offset, m_min_coord.y + get_vertical_offset()); @@ -3079,9 +3080,9 @@ MenuObject::~MenuObject() } #ifdef USE_TILE_LOCAL -void MenuObject::set_tile_height() +void MenuObject::set_height(const int height) { - m_unit_height_pixels = TILE_Y; + m_unit_height_pixels = height; } #endif |