mail[Wesnoth-commits] r20753 - in /trunk/src: multiplayer_lobby.cpp multiplayer_lobby.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by alinktomine on September 27, 2007 - 23:10:
Author: alink
Date: Thu Sep 27 23:10:22 2007
New Revision: 20753

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20753&view=rev
Log:
Center the not-streched-anymore minimaps in the lobby
Note that previously the minimaps were stretched to a rectangle (95x90)

Modified:
    trunk/src/multiplayer_lobby.cpp
    trunk/src/multiplayer_lobby.hpp

Modified: trunk/src/multiplayer_lobby.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer_lobby.cpp?rev=20753&r1=20752&r2=20753&view=diff
==============================================================================
--- trunk/src/multiplayer_lobby.cpp (original)
+++ trunk/src/multiplayer_lobby.cpp Thu Sep 27 23:10:22 2007
@@ -39,7 +39,7 @@
        time_limit_icon_locator_("misc/sand-clock.png"),
        observer_icon_locator_("misc/eye.png"),
        no_observer_icon_locator_("misc/no_observer.png"), 
map_hashes_(map_hashes),
-       item_height_(100), margin_(5), h_padding_(5),
+       item_height_(100), margin_(5), minimap_size_(item_height_ - 
2*margin_),  h_padding_(5),
        header_height_(20), selected_(0), 
visible_range_(std::pair<size_t,size_t>(0,0)),
        double_clicked_(false), ignore_next_doubleclick_(false), 
last_was_doubleclick_(false)
 {
@@ -106,8 +106,10 @@
        int ypos = item_rect.y + margin_;
 
        //draw minimaps
-       video().blit_surface(xpos, ypos, game.mini_map);
-       xpos += item_height_ + margin_;
+       int minimap_x = xpos + (minimap_size_ - game.mini_map->w)/2;
+       int minimap_y = ypos + (minimap_size_ - game.mini_map->h)/2;
+       video().blit_surface(minimap_x, minimap_y, game.mini_map);
+       xpos += minimap_size_ + margin_;
 
        //set font color
        SDL_Color font_color;
@@ -391,7 +393,7 @@
                                if (!found) {
                                        // parsing the map and generating the 
minimap are both cpu expensive
                                        gamemap map(game_config, 
games_.back().map_data);
-                                       games_.back().mini_map = 
image::getMinimap(item_height_ - margin_, item_height_ - 2 * margin_, map, 0);
+                                       games_.back().mini_map = 
image::getMinimap(minimap_size_, minimap_size_, map, 0);
                                        games_.back().map_info_size = 
lexical_cast_default<std::string, int>(map.w(), "??")
                                                + std::string("x") + 
lexical_cast_default<std::string, int>(map.h(), "??");
                                }

Modified: trunk/src/multiplayer_lobby.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer_lobby.hpp?rev=20753&r1=20752&r2=20753&view=diff
==============================================================================
--- trunk/src/multiplayer_lobby.hpp (original)
+++ trunk/src/multiplayer_lobby.hpp Thu Sep 27 23:10:22 2007
@@ -80,6 +80,7 @@
 
        unsigned int item_height_;
        int margin_;
+       int minimap_size_;
        int h_padding_;
        int header_height_;
        size_t selected_;




Related Messages


Powered by MHonArc, Updated Fri Sep 28 01:00:48 2007