"tiny gui support"-removal part 1:

removed all the if(n)defs from the sources (please review that I got
everything right!)

TODO: remove from build systems and data/
This commit is contained in:
Nils Kneuper 2011-02-12 16:20:24 +00:00
parent f4aeede786
commit a9c341e278
30 changed files with 2 additions and 270 deletions

View file

@ -70,9 +70,6 @@ namespace game_config {
defines_map_.clear();
// set-up default defines map
#ifdef USE_TINY_GUI
defines_map_["TINY"] = preproc_define();
#endif
#ifdef LOW_MEM
defines_map_["LOW_MEM"] = preproc_define();
#endif

View file

@ -46,12 +46,7 @@ const size_t dialog::image_h_pad = font::relative_size(/*image_ == NULL ? 0 :*/
const size_t dialog::top_padding = font::relative_size(10);
const size_t dialog::bottom_padding = font::relative_size(10);
#ifdef USE_TINY_GUI
const int dialog::max_menu_width = 300;
#else
const int dialog::max_menu_width = -1;
#endif
const int dialog::max_menu_width = -1;
}

View file

@ -419,11 +419,7 @@ void save_preview_pane::draw_contents()
map_surf = itor->second;
} else if(map_ != NULL) {
try {
#ifdef USE_TINY_GUI
const int minimap_size = 60;
#else
const int minimap_size = 100;
#endif
map_->read(map_data);
map_surf = image::getMinimap(minimap_size, minimap_size, *map_);
@ -1062,15 +1058,9 @@ void show_unit_description(const unit_type &t)
static network::connection network_data_dialog(display& disp, const std::string& msg, config& cfg, network::connection connection_num, network::statistics (*get_stats)(network::connection handle))
{
#ifdef USE_TINY_GUI
const size_t width = 200;
const size_t height = 40;
const size_t border = 10;
#else
const size_t width = 300;
const size_t height = 80;
const size_t border = 20;
#endif
const int left = disp.w()/2 - width/2;
const int top = disp.h()/2 - height/2;
@ -1175,13 +1165,8 @@ namespace dialogs
network::connection network_connect_dialog(display& disp, const std::string& msg, const std::string& hostname, int port)
{
#ifdef USE_TINY_GUI
const size_t width = 200;
const size_t height = 20;
#else
const size_t width = 250;
const size_t height = 20;
#endif
const int left = disp.w()/2 - width/2;
const int top = disp.h()/2 - height/2;

View file

@ -51,11 +51,7 @@ static lg::log_domain log_display("display");
#define DBG_DP LOG_STREAM(debug, log_display)
namespace {
#ifdef USE_TINY_GUI
const int DefaultZoom = 36;
#else
const int DefaultZoom = 72;
#endif
const int SmallZoom = DefaultZoom / 2;
const int MinZoom = 4;
@ -1144,9 +1140,6 @@ void display::draw_text_in_hex(const map_location& loc,
if (text.empty()) return;
const size_t font_sz = static_cast<size_t>(font_size * get_zoom_factor()
#ifdef USE_TINY_GUI
/ 2 // the hex is only half size
#endif
);
surface text_surf = font::get_rendered_text(text, font_sz, color);

View file

@ -53,28 +53,13 @@ extern const SDL_Color NORMAL_COLOR, GRAY_COLOR, LOBBY_COLOR, GOOD_COLOR, BAD_CO
PETRIFIED_COLOR, TITLE_COLOR, DISABLED_COLOR, LABEL_COLOR;
// font sizes, to be made theme parameters
#ifdef USE_TINY_GUI
// this is not meant for normal play, just for checking other dimensions get adapted accordingly
const int SIZE_NORMAL = 9;
#else
const int SIZE_NORMAL = 14;
#endif
inline int relative_size(int size)
{
return (SIZE_NORMAL * size / 14);
}
// automatic computation of other font sizes, to be made a default for theme-provided values
#ifdef USE_TINY_GUI
const int
SIZE_TINY = 8,
SIZE_SMALL = 8,
SIZE_15 = 9,
SIZE_PLUS = 9,
SIZE_LARGE = 10,
SIZE_XLARGE = 10
;
#else
const int
SIZE_TINY = relative_size(10),
SIZE_SMALL = relative_size(12),
@ -84,7 +69,6 @@ const int
SIZE_LARGE = relative_size(18),
SIZE_XLARGE = relative_size(24)
;
#endif
// Returns a SDL surface containing the text rendered in a given color.
surface get_rendered_text(const std::string& text, int size, const SDL_Color& color, int style=0);

View file

@ -496,9 +496,6 @@ void game_display::draw_bar(const std::string& image, int xpos, int ypos,
filled = std::min<double>(std::max<double>(filled,0.0),1.0);
height = static_cast<size_t>(height*get_zoom_factor());
#ifdef USE_TINY_GUI
height /= 2;
#endif
surface surf(image::get_image(image,image::SCALED_TO_HEX));

View file

@ -226,11 +226,7 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
tab_(GENERAL_TAB), disp_(disp), game_cfg_(game_cfg), parent(NULL)
{
// FIXME: this box should be vertically centered on the screen, but is not
#ifdef USE_TINY_GUI
set_measurements(180, 180); // FIXME: should compute this, but using what data ?
#else
set_measurements(465, 425);
#endif
sound_button_.set_check(sound_on());
@ -501,18 +497,11 @@ void preferences_dialog::update_location(SDL_Rect const &rect)
const int right_border = font::relative_size(10);
const int horizontal_padding = 25;
#if USE_TINY_GUI
const int top_border = 14;
const int bottom_border = 0;
const int short_interline = 20;
const int item_interline = 20;
#else
// please also check 800x600 resolution if you change these spacings
const int top_border = 28;
const int bottom_border = 10;
const int short_interline = 21;
const int item_interline = 40;
#endif
const int bottom_row_y = rect.y + rect.h - bottom_border;
// General tab

View file

@ -2715,11 +2715,7 @@ void help_browser::adjust_layout()
const int menu_buttons_padding = font::relative_size(10);
const int menu_y = location().y;
const int menu_x = location().x;
#ifdef USE_TINY_GUI
const int menu_w = 120;
#else
const int menu_w = 250;
#endif
const int menu_h = height() - back_button_.height() - menu_buttons_padding;
const int menu_text_area_padding = font::relative_size(10);

View file

@ -24,12 +24,7 @@
///the surface corresponding to that image.
//
namespace image {
#ifdef USE_TINY_GUI
// images in tiny-gui will be scaled at install time
const int tile_size = 36;
#else
const int tile_size = 72;
#endif
template<typename T>
class cache_type;

View file

@ -846,9 +846,7 @@ void menu_handler::recall(int side_num, const map_location &last_hex)
<< COLUMN_SEPARATOR << _("Name")
<< COLUMN_SEPARATOR << _("Level^Lvl.")
<< COLUMN_SEPARATOR << _("XP");
#ifndef USE_TINY_GUI
heading << COLUMN_SEPARATOR << _("Traits");
#endif
gui::menu::basic_sorter sorter;
sorter.set_alpha_sort(1).set_alpha_sort(2);
@ -894,13 +892,11 @@ void menu_handler::recall(int side_num, const map_location &last_hex)
option_to_filter << u.type_name() << " " << name << " " << u.level();
#ifndef USE_TINY_GUI
option << COLUMN_SEPARATOR;
foreach (const t_string& trait, u.trait_names()) {
option << trait << '\n';
option_to_filter << " " << trait;
}
#endif
options.push_back(option.str());
options_to_filter.push_back(option_to_filter.str());

View file

@ -411,11 +411,7 @@ void create::process_event()
const int xpmod = xp_modifier_slider_.value();
buf.str("");
#ifdef USE_TINY_GUI
buf << N_("Exp. Mod.: ") << xpmod << "%";
#else
buf << _("Experience Modifier: ") << xpmod << "%";
#endif
xp_modifier_label_.set_text(buf.str());
@ -463,11 +459,9 @@ void create::process_event()
generator_.assign(create_map_generator(level["map_generation"], level.child("generator")));
}
#ifndef USE_TINY_GUI
if (!level["description"].empty()) {
tooltips::add_tooltip(minimap_rect_, level["description"]);
}
#endif
}
} else {
parameters_.scenario_data.clear();
@ -511,10 +505,8 @@ void create::process_event()
} catch(incorrect_map_format_error& e) {
ERR_CF << "map could not be loaded: " << e.message << "\n";
#ifndef USE_TINY_GUI
tooltips::clear_tooltips(minimap_rect_);
tooltips::add_tooltip(minimap_rect_,e.message);
#endif
} catch(twml_exception& e) {
ERR_CF << "map could not be loaded: " << e.dev_message << '\n';
}
@ -533,13 +525,11 @@ void create::process_event()
side["controller"] = "human";
}
#ifndef USE_TINY_GUI
if(map.get() != NULL) {
const surface mini(image::getMinimap(minimap_rect_.w,minimap_rect_.h,*map,0));
SDL_Color back_color = {0,0,0,255};
draw_centered_on_background(mini, minimap_rect_, back_color, video().getSurface());
}
#endif
int nsides = 0;
foreach (const config &k, parameters_.scenario_data.child_range("side")) {
@ -664,11 +654,9 @@ void create::hide_children(bool hide)
try {
gamemap map(game_config(), map_data);
#ifndef USE_TINY_GUI
const surface mini(image::getMinimap(minimap_rect_.w,minimap_rect_.h,map,0));
SDL_Color back_color = {0,0,0,255};
draw_centered_on_background(mini, minimap_rect_, back_color, video().getSurface());
#endif
} catch(incorrect_map_format_error& e) {
ERR_CF << "map could not be loaded: " << e.message << "\n";
} catch(twml_exception& e) {
@ -678,7 +666,6 @@ void create::hide_children(bool hide)
}
}
#ifndef USE_TINY_GUI
void create::layout_children(const SDL_Rect& rect)
{
ui::layout_children(rect);
@ -964,7 +951,5 @@ void create::layout_children(const SDL_Rect& rect)
}
#endif
} // namespace mp

View file

@ -730,18 +730,14 @@ lobby::lobby(game_display& disp, const config& cfg, chat& c, config& gamelist) :
join_game_(disp.video(), _("Join Game")),
create_game_(disp.video(), _("Create Game")),
skip_replay_(disp.video(), _("Quick Replays"), gui::button::TYPE_CHECK),
#ifndef USE_TINY_GUI
game_preferences_(disp.video(), _("Preferences")),
#endif
quit_game_(disp.video(), _("Quit")),
#ifndef USE_TINY_GUI
apply_filter_(disp.video(), _("Apply Filter"), gui::button::TYPE_CHECK),
invert_filter_(disp.video(), _("Invert"), gui::button::TYPE_CHECK),
vacant_slots_(disp.video(), _("Vacant Slots"), gui::button::TYPE_CHECK),
friends_in_game_(disp.video(), _("Friends in Game"), gui::button::TYPE_CHECK),
filter_label_(disp.video(), _("Search:")),
filter_text_(disp.video(), 150),
#endif
last_selected_game_(-1), sorter_(gamelist),
games_menu_(disp.video(),cfg.child("multiplayer_hashes")),
minimaps_(),
@ -750,7 +746,6 @@ lobby::lobby(game_display& disp, const config& cfg, chat& c, config& gamelist) :
skip_replay_.set_check(preferences::skip_mp_replay());
skip_replay_.set_help_string(_("Skip quickly to the active turn when observing"));
#ifndef USE_TINY_GUI
apply_filter_.set_check(preferences::filter_lobby());
apply_filter_.set_help_string(_("Enable the games filter. If unchecked all games are shown, regardless of any filter."));
@ -771,7 +766,6 @@ lobby::lobby(game_display& disp, const config& cfg, chat& c, config& gamelist) :
filter_text_.set_text(search_string_);
filter_text_.set_help_string(_("Only show games whose title or description contain the entered text"));
filter_text_.set_editable(apply_filter_.checked());
#endif
gamelist_updated();
sound::play_music_repeatedly(game_config::lobby_music);
@ -786,40 +780,29 @@ void lobby::hide_children(bool hide)
join_game_.hide(hide);
create_game_.hide(hide);
skip_replay_.hide(hide);
#ifndef USE_TINY_GUI
game_preferences_.hide(hide);
#endif
quit_game_.hide(hide);
#ifndef USE_TINY_GUI
apply_filter_.hide(hide);
invert_filter_.hide(hide);
vacant_slots_.hide(hide);
friends_in_game_.hide(hide);
filter_label_.hide(hide);
filter_text_.hide(hide);
#endif
}
void lobby::layout_children(const SDL_Rect& rect)
{
ui::layout_children(rect);
#ifdef USE_TINY_GUI
int btn_space = 3;
int xborder = 0;
int yborder = 0;
#else
int btn_space = 5;
int xborder = 10;
int yborder = 7;
#endif
// Align to the left border
join_game_.set_location(xscale(xborder), yscale(yborder));
observe_game_.set_location(join_game_.location().x + join_game_.location().w + btn_space, yscale(yborder));
create_game_.set_location(observe_game_.location().x + observe_game_.location().w + btn_space, yscale(yborder));
#ifndef USE_TINY_GUI
// Align 'Quit' to the right border
quit_game_.set_location(xscale(xscale_base - xborder) - quit_game_.location().w, yscale(yborder));
@ -829,20 +812,13 @@ void lobby::layout_children(const SDL_Rect& rect)
if (space < btn_space) space = btn_space;
skip_replay_.set_location(create_game_.location().x + create_game_.location().w + space, yscale(yborder));
game_preferences_.set_location(quit_game_.location().x - game_preferences_.location().w - space, yscale(yborder));
#else
skip_replay_.set_location(create_game_.location().x + create_game_.location().w, yscale(yborder));
quit_game_.set_location(skip_replay_.location().x + skip_replay_.location().w + btn_space, yscale(yborder));
#endif
games_menu_.set_location(client_area().x, client_area().y + title().height());
games_menu_.set_measurements(client_area().w, client_area().h
- title().height() - gui::ButtonVPadding
#ifndef USE_TINY_GUI
- apply_filter_.location().h
#endif
);
#ifndef USE_TINY_GUI
apply_filter_.set_location(client_area().x, games_menu_.location().y + games_menu_.location().h + gui::ButtonVPadding);
invert_filter_.set_location(client_area().x + apply_filter_.location().w + btn_space, games_menu_.location().y + games_menu_.location().h + gui::ButtonVPadding);
vacant_slots_.set_location(client_area().w - apply_filter_.location().w, games_menu_.location().y + games_menu_.location().h + gui::ButtonVPadding);
@ -851,7 +827,6 @@ void lobby::layout_children(const SDL_Rect& rect)
filter_label_.set_location(filter_text_.location().x - filter_label_.location().w - btn_space, games_menu_.location().y + games_menu_.location().h + gui::ButtonVPadding
+ (apply_filter_.location().h - filter_label_.location().h) / 2);
#endif
}
void lobby::gamelist_updated(bool silent)
@ -937,12 +912,10 @@ void lobby::process_event()
return;
}
#ifndef USE_TINY_GUI
if(game_preferences_.pressed()) {
set_result(PREFERENCES);
return;
}
#endif
if(quit_game_.pressed()) {
recorder.set_skip(false);
@ -950,7 +923,6 @@ void lobby::process_event()
return;
}
#ifndef USE_TINY_GUI
if(apply_filter_.pressed()) {
preferences::set_filter_lobby(apply_filter_.checked());
invert_filter_.enable(apply_filter_.checked());
@ -991,7 +963,6 @@ void lobby::process_event()
preferences::set_fi_text(search_string_);
gamelist_updated();
}
#endif
}

View file

@ -168,19 +168,15 @@ private:
gui::button join_game_;
gui::button create_game_;
gui::button skip_replay_;
#ifndef USE_TINY_GUI
gui::button game_preferences_;
#endif
gui::button quit_game_;
#ifndef USE_TINY_GUI
gui::button apply_filter_;
gui::button invert_filter_;
gui::button vacant_slots_;
gui::button friends_in_game_;
gui::label filter_label_;
gui::textbox filter_text_;
#endif
int last_selected_game_;

View file

@ -282,12 +282,8 @@ ui::ui(game_display& disp, const std::string& title, const config& cfg, chat& c,
chat_(c),
gamelist_(gamelist),
#ifdef USE_TINY_GUI
title_(disp.video(), title, font::SIZE_SMALL, font::TITLE_COLOR),
#else
title_(disp.video(), title, font::SIZE_LARGE, font::TITLE_COLOR),
entry_textbox_(disp.video(), 100),
#endif
chat_textbox_(disp.video(), 100, "", false),
users_menu_(disp.video(), std::vector<std::string>(), false, -1, -1, NULL, &umenu_style),
@ -385,11 +381,7 @@ void ui::draw_contents()
{
hide_children();
#ifdef USE_TINY_GUI
surface background(image::get_image("misc/lobby_tiny.png"));
#else
surface background(image::get_image("misc/lobby.png"));
#endif
background = scale_surface(background, video().getx(), video().gety());
if(background == NULL)
return;
@ -492,12 +484,6 @@ void ui::send_chat_message(const std::string& message, bool /*allies_only*/)
network::send_data(data, 0);
}
#ifdef USE_TINY_GUI
void ui::handle_key_event(const SDL_KeyboardEvent& /*event*/)
{
}
#else
void ui::handle_key_event(const SDL_KeyboardEvent& event)
{
//On enter, adds the current chat message to the chat textbox.
@ -526,7 +512,6 @@ void ui::handle_key_event(const SDL_KeyboardEvent& event)
entry_textbox_.set_text(text);
}
}
#endif
void ui::process_message(const config& msg, const bool whisper) {
const std::string& sender = msg["sender"];
@ -636,9 +621,7 @@ void ui::hide_children(bool hide)
{
title_.hide(hide);
chat_textbox_.hide(hide);
#ifndef USE_TINY_GUI
entry_textbox_.hide(hide);
#endif
users_menu_.hide(hide);
}
@ -651,16 +634,10 @@ void ui::layout_children(const SDL_Rect& /*rect*/)
users_menu_.set_location(xscale(856), yscale(42));
users_menu_.set_height(yscale(715));
users_menu_.set_max_height(yscale(715));
#ifdef USE_TINY_GUI
chat_textbox_.set_location(xscale(11) + 4, yscale(625) + 4);
chat_textbox_.set_measurements(xscale(833) - 8, yscale(143) - 8);
#else
chat_textbox_.set_location(xscale(11) + 4, yscale(573) + 4);
chat_textbox_.set_measurements(xscale(833) - 8, yscale(143) - 8);
entry_textbox_.set_location(xscale(11) + 4, yscale(732));
entry_textbox_.set_width(xscale(833) - 8);
#endif
}
bool ui::user_info::operator> (const user_info& b) const {

View file

@ -224,9 +224,7 @@ private:
config& gamelist_;
gui::label title_;
#ifndef USE_TINY_GUI
gui::textbox entry_textbox_;
#endif
gui::textbox chat_textbox_;
gui::menu users_menu_;

View file

@ -585,18 +585,7 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
savegame::scenariostart_savegame save(gamestate, preferences::compress_saves());
#ifdef USE_TINY_GUI
bool retry = true;
while(retry) {
retry = false;
retry = !save.save_game_interactive(disp.video()
, _("Do you want to save your game?")
, gui::YES_NO);
}
#else
save.save_game_automatic(disp.video());
#endif /* USE_TINY_GUI */
}
if (gamestate.classification().campaign_type != "multiplayer"){

View file

@ -178,10 +178,6 @@ void _set_scroll_to_action(bool ison)
int min_allowed_width()
{
#ifdef USE_TINY_GUI
return 320;
#endif
// Most things (not all) in the new widgets library work properly on tiny
// gui resolution. So allow them, which makes initial testing easier.
if(gui2::new_widgets) {
@ -193,10 +189,6 @@ int min_allowed_width()
int min_allowed_height()
{
#ifdef USE_TINY_GUI
return 240;
#endif
// Most things (not all) in the new widgets library work properly on tiny
// gui resolution. So allow them, which makes initial testing easier.
if(gui2::new_widgets) {

View file

@ -78,10 +78,6 @@ bool detect_video_settings(CVideo& video, std::pair<int,int>& resolution, int& b
res_list.push_back(res_t(800, 600));
if (game_config::small_gui)
res_list.push_back(res_t(800, 480));
#ifdef USE_TINY_GUI
res_list.push_back(res_t(640, 480));
res_list.push_back(res_t(320, 240));
#endif
bpp = video.modePossible(resolution.first, resolution.second,
DefaultBPP, video_flags, true);
@ -277,14 +273,8 @@ void show_hotkeys_dialog (display & disp, config *save_config)
const int centerx = disp.w()/2;
const int centery = disp.h()/2;
#ifdef USE_TINY_GUI
const int width = 300; /** @todo FIXME: We should compute this, but using what data ? */
/** @todo FIXME: suokko: window width and height could be useful. min(300,disp.w()*0.9) So it would be either 300 or max 90% of width */
const int height = 220;
#else
const int width = 700;
const int height = 500;
#endif
const int xpos = centerx - width/2;
const int ypos = centery - height/2;

View file

@ -54,13 +54,8 @@ namespace {
int const titleshadow_g = 0;
int const titleshadow_b = 0;
#ifndef USE_TINY_GUI
int const titlebox_font_size = 20; // pt?
int const storybox_font_size = 14; // pt?
#else
int const titlebox_font_size = 11; // pt?
int const storybox_font_size = 10; // pt?
#endif
Uint32 const titlebox_font_color = 0xFFFFFFFF;
Uint32 const storybox_font_color = 0xDDDDDDFF;
@ -135,19 +130,6 @@ void part_ui::prepare_geometry()
base_rect_.w = background_->w;
base_rect_.h = background_->h;
#ifdef USE_TINY_GUI
// Use the whole screen for text on tinygui
text_x_ = 10;
text_y_ = 0;
buttons_x_ = video_.getx() - 50;
buttons_y_ = base_rect_.y + base_rect_.h - 20;
back_button_.set_location(buttons_x_, buttons_y_ - 20);
next_button_.set_location(buttons_x_ + play_button_.width() - next_button_.width(), buttons_y_ - 20);
play_button_.set_location(buttons_x_, buttons_y_);
#else // elif !defined(USE_TINY_GUI)
if(video_.getx() <= 800) {
text_x_ = 10;
buttons_x_ = video_.getx() - 100 - 20;

View file

@ -145,9 +145,6 @@ terrain_type::terrain_type(const config& cfg) :
std::sort(union_type_.begin(),union_type_.end());
union_type_.erase(std::unique(union_type_.begin(), union_type_.end()), union_type_.end());
#ifdef USE_TINY_GUI
height_adjust_ /= 2;
#endif
//mouse over message are only shown on villages

View file

@ -112,26 +112,6 @@ namespace {
}
}
#ifdef USE_TINY_GUI
const tresolution_list& get_tiny_gui_resolutions()
{
static tresolution_list result;
if(result.empty()) {
result.push_back(std::make_pair(320, 240));
result.push_back(std::make_pair(640, 480));
}
return result;
}
template<class T>
void test()
{
test_resolutions<T>(get_tiny_gui_resolutions());
}
#else
const tresolution_list& get_small_gui_resolutions()
{
static tresolution_list result;
@ -183,9 +163,6 @@ BOOST_AUTO_TEST_CASE(test_gui2)
cache.add_define("EDITOR");
#endif
cache.add_define("MULTIPLAYER");
#ifdef USE_TINY_GUI
cache.add_define("TINY");
#endif
cache.get_config(game_config::path +"/data", main_config);
const binary_paths_manager bin_paths_manager(main_config);

View file

@ -33,10 +33,6 @@ static preproc_map setup_test_preproc_map()
{
preproc_map defines_map;
#ifdef USE_TINY_GUI
defines_map["TINY"] = preproc_define();
#endif
if (game_config::small_gui)
defines_map["SMALL_GUI"] = preproc_define();

View file

@ -29,11 +29,7 @@ namespace {
CVideo* video_ = NULL;
static const int font_size = font::SIZE_SMALL;
#ifdef USE_TINY_GUI
static const int text_width = 260;
#else
static const int text_width = 400;
#endif
struct tooltip
{
@ -73,11 +69,7 @@ static void show_tooltip(const tooltip& tip)
const SDL_Color bgcolor = {0,0,0,160};
SDL_Rect area = screen_area();
#ifdef USE_TINY_GUI
unsigned int border = 2;
#else
unsigned int border = 10;
#endif
font::floating_label flabel(tip.message);
flabel.set_font_size(font_size);

View file

@ -1936,11 +1936,7 @@ void unit::redraw_unit()
if(max_hitpoints() > 0) {
unit_energy = double(hitpoints())/double(max_hitpoints());
}
#ifdef USE_TINY_GUI
const int bar_shift = static_cast<int>(-2.5*disp.get_zoom_factor());
#else
const int bar_shift = static_cast<int>(-5*disp.get_zoom_factor());
#endif
const int hp_bar_height = static_cast<int>(max_hitpoints()*game_config::hp_bar_scaling);
const fixed_t bar_alpha = (loc_ == disp.mouseover_hex() || loc_ == disp.selected_hex()) ? ftofxp(1.0): ftofxp(0.8);

View file

@ -460,11 +460,7 @@ int CVideo::set_help_string(const std::string& str)
const SDL_Color color = { 0, 0, 0, 0xbb };
#ifdef USE_TINY_GUI
int size = font::SIZE_NORMAL;
#else
int size = font::SIZE_LARGE;
#endif
while(size > 0) {
if(font::line_width(str, size) > getx()) {
@ -474,11 +470,7 @@ int CVideo::set_help_string(const std::string& str)
}
}
#ifdef USE_TINY_GUI
const int border = 2;
#else
const int border = 5;
#endif
font::floating_label flabel(str);
flabel.set_font_size(size);

View file

@ -138,21 +138,13 @@ void button::calculate_size()
if (!change_size)
return;
#ifdef USE_TINY_GUI
set_height(textRect_.h+vertical_padding);
#else
set_height(std::max(textRect_.h+vertical_padding,base_height_));
#endif
if(type_ == TYPE_PRESS) {
#ifdef USE_TINY_GUI
set_width(textRect_.w + horizontal_padding);
#else
if(spacing_ == MINIMUM_SPACE) {
set_width(textRect_.w + horizontal_padding);
} else {
set_width(std::max(textRect_.w+horizontal_padding,base_width_));
}
#endif
} else {
if(label_.empty()) {
set_width(base_width_);

View file

@ -24,12 +24,7 @@
namespace gui {
#ifdef USE_TINY_GUI
const std::string combo::empty_combo_label = " ";
#else
const std::string combo::empty_combo_label = "";
#endif
const std::string combo::empty_combo_label = "";
const int combo::font_size = font::SIZE_SMALL;
const int combo::horizontal_padding = 10;

View file

@ -485,11 +485,7 @@ size_t menu::max_items_onscreen() const
return size_t(max_items_);
}
#ifdef USE_TINY_GUI
const size_t max_height = (max_height_ == -1 ? (video().gety()*55)/100 : max_height_) - heading_height();
#else
const size_t max_height = (max_height_ == -1 ? (video().gety()*66)/100 : max_height_) - heading_height();
#endif
std::vector<int> heights;
size_t n;

View file

@ -32,11 +32,7 @@ menu::imgsel_style menu::bluebg_style("misc/selection2", true,
0.35, 0.0, 0.3);
menu::style menu::simple_style;
#ifdef USE_TINY_GUI
menu::style &menu::default_style = menu::simple_style;
#else
menu::style &menu::default_style = menu::bluebg_style;
#endif
menu *empty_menu = NULL;
//constructors

View file

@ -28,11 +28,7 @@ static lg::log_domain log_display("display");
namespace gui {
#ifdef USE_TINY_GUI
const int font_size = font::SIZE_TINY;
#else
const int font_size = font::SIZE_PLUS;
#endif
textbox::textbox(CVideo &video, int width, const std::string& text, bool editable, size_t max_size, double alpha, double alpha_focus, const bool auto_join)
: scrollarea(video, auto_join), max_size_(max_size), text_(utils::string_to_wstring(text)),