mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-26 21:56:23 +00:00
minor re-arrangements
This commit is contained in:
parent
deed976a97
commit
1e8c560f07
2
Makefile
2
Makefile
@ -8,7 +8,7 @@ SDL_CFLAGS=`sdl-config --cflags` `freetype-config --cflags`
|
||||
SDL_LIBS=`sdl-config --libs` `freetype-config --libs` -lSDL_mixer -lSDL_ttf -lSDL_image -lSDL_net
|
||||
LIBS=${SDL_LIBS} -lstdc++
|
||||
INCLUDES=-I. -Isrc -Isrc/tools -Isrc/widgets
|
||||
OBJS=src/actions.o src/ai.o src/ai_attack.o src/ai_move.o src/config.o src/dialogs.o src/display.o src/filesystem.o src/font.o src/game.o src/game_config.o src/game_events.o src/gamestatus.o src/hotkeys.o src/intro.o src/key.o src/language.o src/log.o src/map.o src/mouse.o src/multiplayer.o src/multiplayer_client.o src/network.o src/pathfind.o src/playlevel.o src/playturn.o src/preferences.o src/replay.o src/sdl_utils.o src/show_dialog.o src/sound.o src/team.o src/terrain.o src/tooltips.o src/unit.o src/unit_types.o src/video.o src/widgets/button.o src/widgets/menu.o src/widgets/slider.o src/widgets/textbox.o
|
||||
OBJS=src/actions.o src/ai.o src/ai_attack.o src/ai_move.o src/config.o src/dialogs.o src/display.o src/events.o src/filesystem.o src/font.o src/game.o src/game_config.o src/game_events.o src/gamestatus.o src/hotkeys.o src/intro.o src/key.o src/language.o src/log.o src/map.o src/mouse.o src/multiplayer.o src/multiplayer_client.o src/network.o src/pathfind.o src/playlevel.o src/playturn.o src/preferences.o src/replay.o src/sdl_utils.o src/show_dialog.o src/sound.o src/team.o src/terrain.o src/tooltips.o src/unit.o src/unit_types.o src/video.o src/widgets/button.o src/widgets/menu.o src/widgets/slider.o src/widgets/textbox.o
|
||||
|
||||
MAKE_TRANS_OBJS=src/tools/make_translation.o src/config.o src/filesystem.o src/game_config.o src/log.o
|
||||
MERGE_TRANS_OBJS=src/tools/merge_translations.o src/config.o src/filesystem.o src/game_config.o src/log.o
|
||||
|
@ -63,12 +63,12 @@
|
||||
id=intro_11
|
||||
story="Hearing of the orders of Asheviere, Delfador entered the palace by stealth, and stole away Konrad, the youngest of Garard's nephews, saving him from death"
|
||||
delay=4000
|
||||
image=misc/map.png
|
||||
image=misc/story6.png
|
||||
[/part]
|
||||
[part]
|
||||
id=intro_12
|
||||
story="Taking the child away to the forests of the West, Delfador raised him under the protection of the Elves, watching sadly as Asheviere's reign of terror over the land began..."
|
||||
delay=6000
|
||||
image=misc/map.png
|
||||
image=misc/story6.png
|
||||
[/part]
|
||||
[/story]
|
||||
|
@ -348,6 +348,31 @@ Defeat
|
||||
|
||||
[/event]
|
||||
|
||||
{deaths.cfg}
|
||||
#a chest of treasure behind the secret passage
|
||||
[item]
|
||||
image=misc/chest.png
|
||||
x=9
|
||||
y=39
|
||||
[/item]
|
||||
|
||||
[event]
|
||||
name=moveto
|
||||
[filter]
|
||||
x=9
|
||||
y=39
|
||||
side=1
|
||||
[/filter]
|
||||
[message]
|
||||
speaker=unit
|
||||
message="There is a great fortune in this chest of treasure! I can count two hundred pieces of gold!"
|
||||
[/message]
|
||||
[gold]
|
||||
side=1
|
||||
amount=200
|
||||
[/gold]
|
||||
[removeitem]
|
||||
[/removeitem]
|
||||
[/event]
|
||||
|
||||
{deaths.cfg}
|
||||
[/scenario]
|
||||
|
@ -167,7 +167,12 @@ int play_game(int argc, char** argv)
|
||||
game_config::debug = true;
|
||||
} else if(val == "--help" || val == "-h") {
|
||||
std::cout << "usage: " << argv[0]
|
||||
<< " [options] [data-directory]\n";
|
||||
<< " [options] [data-directory]\n"
|
||||
<< " -d, --debug Shows debugging information in-game\n"
|
||||
<< " -f, --fullscreen Runs the game in full-screen\n"
|
||||
<< " -h, --help Prints this message and exits\n"
|
||||
<< " -t, --test Runs the game in a small example scenario\n"
|
||||
<< " -w, --windowed Runs the game in windowed mode\n";
|
||||
return 0;
|
||||
} else if(val == "--version" || val == "-v") {
|
||||
std::cout << "Battle for Wesnoth " << game_config::version
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "config.hpp"
|
||||
#include "events.hpp"
|
||||
#include "hotkeys.hpp"
|
||||
#include "language.hpp"
|
||||
#include "playlevel.hpp"
|
||||
@ -151,7 +153,7 @@ HOTKEY_COMMAND check_keys(display& disp)
|
||||
{
|
||||
const double zoom_amount = 5.0;
|
||||
|
||||
::pump_events();
|
||||
events::pump();
|
||||
|
||||
CKey key;
|
||||
if(key[KEY_ESCAPE]) {
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "events.hpp"
|
||||
#include "font.hpp"
|
||||
#include "intro.hpp"
|
||||
#include "key.hpp"
|
||||
@ -24,7 +26,7 @@
|
||||
void show_intro(display& screen, config& data)
|
||||
{
|
||||
//stop the screen being resized while we're in this function
|
||||
const resize_lock stop_resizing;
|
||||
const events::resize_lock stop_resizing;
|
||||
|
||||
CKey key;
|
||||
|
||||
@ -107,7 +109,7 @@ void show_intro(display& screen, config& data)
|
||||
|
||||
const bool left_button = mouse_flags&SDL_BUTTON_LMASK;
|
||||
|
||||
pump_events();
|
||||
events::pump();
|
||||
|
||||
if(key[KEY_ESCAPE] ||
|
||||
skip_button.process(mousex,mousey,left_button))
|
||||
@ -130,7 +132,7 @@ void show_intro(display& screen, config& data)
|
||||
void show_map_scene(display& screen, config& data)
|
||||
{
|
||||
//stop the screen being resized while we're in this function
|
||||
const resize_lock stop_resizing;
|
||||
const events::resize_lock stop_resizing;
|
||||
|
||||
//clear the screen
|
||||
gui::draw_solid_tinted_rectangle(0,0,screen.x()-1,screen.y()-1,0,0,0,1.0,
|
||||
@ -214,7 +216,7 @@ void show_map_scene(display& screen, config& data)
|
||||
|
||||
SDL_Delay(10);
|
||||
|
||||
pump_events();
|
||||
events::pump();
|
||||
|
||||
int a, b;
|
||||
const int mouse_flags = SDL_GetMouseState(&a,&b);
|
||||
@ -257,7 +259,7 @@ void show_map_scene(display& screen, config& data)
|
||||
last_state = new_state;
|
||||
|
||||
SDL_Delay(20);
|
||||
pump_events();
|
||||
events::pump();
|
||||
}
|
||||
|
||||
//clear the screen
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "events.hpp"
|
||||
#include "game_events.hpp"
|
||||
#include "intro.hpp"
|
||||
#include "language.hpp"
|
||||
@ -231,7 +233,7 @@ LEVEL_RESULT play_level(game_data& gameinfo, config& terrain_config,
|
||||
|
||||
gui.draw();
|
||||
game_events::pump();
|
||||
pump_events();
|
||||
events::pump();
|
||||
}
|
||||
|
||||
std::cerr << "replay: '" << cfg.children["turn"].front()->write() << "'\n";
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "actions.hpp"
|
||||
#include "events.hpp"
|
||||
#include "hotkeys.hpp"
|
||||
#include "language.hpp"
|
||||
#include "log.hpp"
|
||||
@ -965,6 +966,6 @@ void play_turn(game_data& gameinfo, game_state& state_of_game,
|
||||
|
||||
game_events::pump();
|
||||
|
||||
pump_events();
|
||||
events::pump();
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "events.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "font.hpp"
|
||||
#include "hotkeys.hpp"
|
||||
@ -265,7 +267,7 @@ void show_preferences_dialog(display& disp)
|
||||
{
|
||||
assert(::disp != NULL);
|
||||
|
||||
const resize_lock prevent_resizing;
|
||||
const events::resize_lock prevent_resizing;
|
||||
|
||||
log_scope("show_preferences_dialog");
|
||||
|
||||
@ -435,7 +437,7 @@ void show_preferences_dialog(display& disp)
|
||||
disp.update_display();
|
||||
|
||||
SDL_Delay(10);
|
||||
pump_events();
|
||||
events::pump();
|
||||
}
|
||||
|
||||
disp.invalidate_all();
|
||||
@ -444,7 +446,7 @@ void show_preferences_dialog(display& disp)
|
||||
|
||||
void show_video_mode_dialog(display& disp)
|
||||
{
|
||||
const resize_lock prevent_resizing;
|
||||
const events::resize_lock prevent_resizing;
|
||||
|
||||
std::vector<std::pair<int,int> > resolutions;
|
||||
std::vector<std::string> options;
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "config.hpp"
|
||||
#include "events.hpp"
|
||||
#include "font.hpp"
|
||||
#include "language.hpp"
|
||||
#include "playlevel.hpp"
|
||||
@ -188,7 +189,7 @@ int show_dialog(display& disp, SDL_Surface* image,
|
||||
if(disp.update_locked())
|
||||
return -1;
|
||||
|
||||
const resize_lock prevent_resizing;
|
||||
const events::resize_lock prevent_resizing;
|
||||
|
||||
const std::vector<std::string>& menu_items =
|
||||
(menu_items_ptr == NULL) ? std::vector<std::string>() : *menu_items_ptr;
|
||||
@ -454,7 +455,7 @@ int show_dialog(display& disp, SDL_Surface* image,
|
||||
bool first_time = true;
|
||||
|
||||
for(;;) {
|
||||
pump_events();
|
||||
events::pump();
|
||||
|
||||
int mousex, mousey;
|
||||
const int mouse_flags = SDL_GetMouseState(&mousex,&mousey);
|
||||
@ -582,7 +583,7 @@ int show_dialog(display& disp, SDL_Surface* image,
|
||||
|
||||
TITLE_RESULT show_title(display& screen)
|
||||
{
|
||||
const resize_lock prevent_resizing;
|
||||
const events::resize_lock prevent_resizing;
|
||||
|
||||
SDL_Surface* const title_surface = screen.getImage("title.png",
|
||||
display::UNSCALED);
|
||||
@ -672,7 +673,7 @@ TITLE_RESULT show_title(display& screen)
|
||||
if(key[KEY_ESCAPE])
|
||||
return QUIT_GAME;
|
||||
|
||||
pump_events();
|
||||
events::pump();
|
||||
|
||||
SDL_Delay(20);
|
||||
}
|
||||
|
@ -188,65 +188,3 @@ SDL_Surface* CVideo::getSurface( void )
|
||||
}
|
||||
|
||||
bool CVideo::isFullScreen() const { return fullScreen; }
|
||||
|
||||
namespace {
|
||||
int disallow_resize = 0;
|
||||
}
|
||||
|
||||
resize_lock::resize_lock()
|
||||
{
|
||||
++disallow_resize;
|
||||
}
|
||||
|
||||
resize_lock::~resize_lock()
|
||||
{
|
||||
--disallow_resize;
|
||||
}
|
||||
|
||||
void pump_events()
|
||||
{
|
||||
SDL_PumpEvents();
|
||||
|
||||
static std::pair<int,int> resize_dimensions(0,0);
|
||||
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event)) {
|
||||
switch(event.type) {
|
||||
case SDL_VIDEORESIZE: {
|
||||
const SDL_ResizeEvent* const resize
|
||||
= reinterpret_cast<SDL_ResizeEvent*>(&event);
|
||||
|
||||
if(resize->w < 1024 || resize->h < 768) {
|
||||
resize_dimensions.first = 0;
|
||||
resize_dimensions.second = 0;
|
||||
} else {
|
||||
resize_dimensions.first = resize->w;
|
||||
resize_dimensions.second = resize->h;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//mouse wheel support
|
||||
case SDL_MOUSEBUTTONDOWN: {
|
||||
if(event.button.button == 4) {
|
||||
gui::scroll_dec();
|
||||
} else if(event.button.button == 5) {
|
||||
gui::scroll_inc();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_QUIT: {
|
||||
throw CVideo::quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(resize_dimensions.first > 0 && disallow_resize == 0) {
|
||||
preferences::set_resolution(resize_dimensions);
|
||||
resize_dimensions.first = 0;
|
||||
resize_dimensions.second = 0;
|
||||
}
|
||||
}
|
||||
|
@ -58,13 +58,4 @@ class CVideo {
|
||||
SDL_Surface* frameBuffer;
|
||||
};
|
||||
|
||||
void allow_resizing(bool);
|
||||
|
||||
struct resize_lock {
|
||||
resize_lock();
|
||||
~resize_lock();
|
||||
};
|
||||
|
||||
void pump_events();
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user