added icons for preferences and multiplayer dialogs

This commit is contained in:
Dave White 2004-06-21 14:42:18 +00:00
parent 8061d704d5
commit 8f51ff28a0
17 changed files with 73 additions and 34 deletions

View file

@ -5,7 +5,7 @@ image=wose-ancient.png
ability=ambush,regenerates
hitpoints=80
movement_type=treefolk
movement=2
movement=3
experience=500
level=3
alignment=lawful
@ -16,8 +16,8 @@ usage=fighter
name=crush
type=impact
range=short
damage=40
number=1
damage=25
number=2
[frame]
begin=-300
end=-100

View file

@ -17,7 +17,7 @@ usage=fighter
name=crush
type=impact
range=short
damage=14
damage=18
number=2
[frame]
begin=-100

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/icons/icon-music.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -1222,7 +1222,7 @@ void display::draw_unit_on_tile(int x, int y, SDL_Surface* unit_image_override,
if(u.experience() > 0 && u.type().can_advance()) {
const double filled = double(u.experience())/double(u.max_experience());
const int level = maximum<int>(u.type().level(),1);
const SDL_Color normal_colour = {200,200,0,0}, near_advance_colour = {255,255,255,0};
const SDL_Color normal_colour = {173,200,248,0}, near_advance_colour = {255,255,255,0};
const bool near_advance = u.max_experience() - u.experience() <= game_config::kill_experience*level;
const SDL_Color colour = near_advance ? near_advance_colour : normal_colour;
@ -1573,16 +1573,24 @@ void display::draw_footstep(const gamemap::location& loc, int xloc, int yloc)
if(show_time && route_.move_left > 0 && route_.move_left < 10) {
//draw number in yellow if terrain is light, else draw in black
gamemap::TERRAIN terrain = map_.get_terrain(loc);
const bool tile_is_light = map_.get_terrain_info(terrain).is_light();
SDL_Color text_colour = tile_is_light ? font::DARK_COLOUR : font::YELLOW_COLOUR;
const SDL_Rect& rect = map_area();
std::string str(1,'x');
str[0] = '1' + route_.move_left;
const SDL_Rect& text_area = font::draw_text(NULL,rect,18,text_colour,str,0,0);
const SDL_Rect& text_area = font::text_area(str,18);
const int x = xloc + zoom_/2 - text_area.w/2;
const int y = yloc + zoom_/2 - text_area.h/2;
font::draw_text(this,rect,18,text_colour,str,x,y);
//draw the text with a black outline
font::draw_text(this,rect,18,font::DARK_COLOUR,str,x-1,y-1);
font::draw_text(this,rect,18,font::DARK_COLOUR,str,x-1,y);
font::draw_text(this,rect,18,font::DARK_COLOUR,str,x-1,y+1);
font::draw_text(this,rect,18,font::DARK_COLOUR,str,x,y-1);
font::draw_text(this,rect,18,font::DARK_COLOUR,str,x+1,y-1);
font::draw_text(this,rect,18,font::DARK_COLOUR,str,x+1,y);
font::draw_text(this,rect,18,font::DARK_COLOUR,str,x+1,y+1);
font::draw_text(this,rect,18,font::DARK_COLOUR,str,x,y+1);
font::draw_text(this,rect,18,font::YELLOW_COLOUR,str,x,y);
}
}

View file

@ -919,9 +919,9 @@ int play_game(int argc, char** argv)
std::vector<std::string> host_or_join;
const std::string sep(1,gui::menu::HELP_STRING_SEPERATOR);
host_or_join.push_back(string_table["join_server"] + sep + string_table["join_server_help"]);
host_or_join.push_back(string_table["join_game"] + sep + string_table["join_game_help"]);
host_or_join.push_back(string_table["host_game"] + sep + string_table["host_game_help"]);
host_or_join.push_back("&icons/icon-server.png," + string_table["join_server"] + sep + string_table["join_server_help"]);
host_or_join.push_back("&icons/icon-serverother.png," + string_table["join_game"] + sep + string_table["join_game_help"]);
host_or_join.push_back("&icons/icon-hostgame.png," + string_table["host_game"] + sep + string_table["host_game_help"]);
std::string login = preferences::login();
const int res = gui::show_dialog(disp,NULL,string_table["multiplayer_button"],"",gui::OK_CANCEL,&host_or_join,NULL,string_table["login"] + ": ",&login);

View file

@ -7,9 +7,12 @@
#include <algorithm>
#include <cassert>
#include <queue>
#include <iostream>
#include <set>
#include <vector>
#include <signal.h>
namespace {
//We store the details of a connection in a map that must be looked up by its handle.
@ -129,6 +132,12 @@ manager::manager() : free_(true)
return;
}
//on Unix-based systems, set sigpipe to be ignored
#if !(defined(_WIN32) || defined(__APPLE__))
std::cerr << "ignoring SIGPIPE\n";
signal(SIGPIPE,SIG_IGN);
#endif
if(SDLNet_Init() == -1) {
throw error(SDL_GetError());
}

View file

@ -854,10 +854,11 @@ void preferences_dialog::set_selection(int index)
void show_preferences_dialog(display& disp)
{
std::vector<std::string> items;
items.push_back(string_table["preferences_item_general"]);
items.push_back(string_table["preferences_item_display"]);
items.push_back(string_table["preferences_item_sound"]);
items.push_back("&icons/icon-general.png," + string_table["preferences_item_general"]);
items.push_back("&icons/icon-display.png," + string_table["preferences_item_display"]);
items.push_back("&icons/icon-music.png," + string_table["preferences_item_sound"]);
for(;;) {
try {
const events::event_context dialog_events_context;

View file

@ -28,7 +28,6 @@ markov_prefix_map markov_prefixes(const std::vector<std::string>& items, size_t
std::string markov_generate_name(const markov_prefix_map& prefixes, size_t chain_size, size_t max_len)
{
std::cerr << "generating name with chain size of " << chain_size << " and " << prefixes.size() << " prefixes\n";
if(chain_size == 0)
return "";
@ -37,7 +36,6 @@ std::string markov_generate_name(const markov_prefix_map& prefixes, size_t chain
while(res.size() < max_len) {
const markov_prefix_map::const_iterator i = prefixes.find(prefix);
if(i == prefixes.end() || i->second.empty()) {
std::cerr << "failed to find prefix for '" << prefix << "'\n";
return res;
}
@ -107,10 +105,6 @@ unit_race::unit_race(const config& cfg) : name_(cfg["name"]), ntraits_(atoi(cfg[
next_[MALE] = markov_prefixes(names_[MALE],chain_size_);
next_[FEMALE] = markov_prefixes(names_[FEMALE],chain_size_);
if(next_[MALE].size() == 0) {
std::cerr << "empty prefix string: has " << names_[MALE].size() << " names: '" << cfg["male_names"] << "'\n";
}
}
const std::string& unit_race::name() const { return name_; }

View file

@ -397,7 +397,7 @@ SDL_Surface* mask_surface(SDL_Surface* surface, SDL_Surface* mask)
return NULL;
}
SDL_Surface* surf(make_neutral_surface(surface));
SDL_Surface* surf = make_neutral_surface(surface);
scoped_sdl_surface nmask(make_neutral_surface(mask));
if(surf == NULL || nmask == NULL) {

View file

@ -566,11 +566,6 @@ int main(int argc, char** argv)
port = atoi(argv[arg]);
}
}
#ifndef WIN32
//trap the 'SIGPIPE' signal which specifies a broken pipe, and ignore it
signal(SIGPIPE,SIG_IGN);
#endif
try {
server(port).run();

View file

@ -332,12 +332,7 @@ void textbox::handle_event(const SDL_Event& event)
{
bool changed = false;
if(event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_c) {
std::cerr << "got press of 'c': " << int(event.key.keysym.mod) << " " << (event.key.keysym.mod&KMOD_CTRL) << " "
<< size_t(selstart_) << "/" << size_t(selend_) << "/" << text_.size() << " " << (focus() ? "focus" : "no focus") << " " << location().x << "\n";
}
//if someone presses ctrl+c to copy text onto the clipboard
//if the user presses ctrl+c to copy text onto the clipboard
if(event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_c && (event.key.keysym.mod&KMOD_CTRL) != 0
&& size_t(selstart_) <= text_.size() && size_t(selend_) <= text_.size() && selstart_ != selend_) {
const size_t beg = minimum<size_t>(size_t(selstart_),size_t(selend_));
@ -345,11 +340,32 @@ void textbox::handle_event(const SDL_Event& event)
std::string selection(end - beg,'x');
std::copy(text_.begin()+beg,text_.begin()+end,selection.begin());
std::cerr << "copying text to clipboard: '" << selection << "'\n";
copy_to_clipboard(selection);
return;
}
//if the user presses ctrl+v to paste text into the textbox
if(event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_v && (event.key.keysym.mod&KMOD_CTRL) != 0 && editable() && focus()) {
const size_t beg = minimum<size_t>(size_t(selstart_),size_t(selend_));
const size_t end = maximum<size_t>(size_t(selstart_),size_t(selend_));
if(beg < text_.size() && end <= text_.size() && beg != end) {
text_.erase(text_.begin()+beg,text_.begin()+end);
selstart_ = selend_ = cursor_ = int(beg);
}
const std::string& str = copy_from_clipboard();
wide_string tmp;
tmp.resize(str.size());
std::copy(str.begin(),str.end(),tmp.begin());
text_.insert(text_.begin()+minimum(size_t(cursor_),text_.size()),tmp.begin(),tmp.end());
cursor_ += str.size();
update_text_cache(true);
set_dirty();
return;
}
int mousex, mousey;
const Uint8 mousebuttons = SDL_GetMouseState(&mousex,&mousey);
if(!(mousebuttons & SDL_BUTTON(1))) {

View file

@ -124,6 +124,10 @@ SOURCE=.\src\cavegen.cpp
# End Source File
# Begin Source File
SOURCE=.\src\clipboard.cpp
# End Source File
# Begin Source File
SOURCE=.\src\widgets\combo.cpp
# End Source File
# Begin Source File
@ -180,6 +184,10 @@ SOURCE=.\src\halo.cpp
# End Source File
# Begin Source File
SOURCE=.\src\help.cpp
# End Source File
# Begin Source File
SOURCE=.\src\hotkeys.cpp
# End Source File
# Begin Source File
@ -388,6 +396,10 @@ SOURCE=.\src\cavegen.hpp
# End Source File
# Begin Source File
SOURCE=.\src\clipboard.hpp
# End Source File
# Begin Source File
SOURCE=.\src\widgets\combo.hpp
# End Source File
# Begin Source File
@ -440,6 +452,10 @@ SOURCE=.\src\halo.hpp
# End Source File
# Begin Source File
SOURCE=.\src\help.hpp
# End Source File
# Begin Source File
SOURCE=.\src\hotkeys.hpp
# End Source File
# Begin Source File