Fix several little issues with cursors

- Sometimes they didn't reappear when the program was reactivated
- Watch is now used in more places
This commit is contained in:
2015-09-24 19:12:12 -04:00
parent bc7298417f
commit 66f84ef396
6 changed files with 16 additions and 5 deletions

View File

@@ -222,6 +222,8 @@ void plop_fancy_startup() {
mainPtr.display();
mainPtr.pollEvent(event);
if(event.type == sf::Event::GainedFocus || event.type == sf::Event::MouseMoved)
make_cursor_watch();
}
play_sound(95); // Was originally negative, meaning async
@@ -241,12 +243,15 @@ void plop_fancy_startup() {
rect_draw_some_item(pict_to_draw, from_rect, mainPtr, intro_from);
mainPtr.display();
mainPtr.pollEvent(event);
if(event.type == sf::Event::GainedFocus || event.type == sf::Event::MouseMoved)
make_cursor_watch();
}
} else delay = 60;
delay = time_in_ticks(delay).asMilliseconds();
sf::Clock timer;
if(show_startup_splash) play_sound(-22);
make_cursor_sword();
while(timer.getElapsedTime().asMilliseconds() < delay) {
if(mainPtr.pollEvent(event)) {
if(event.type == sf::Event::MouseButtonPressed || event.type == sf::Event::KeyPressed)

View File

@@ -258,6 +258,9 @@ void Handle_One_Event() {
make_cursor_sword();
break;
case sf::Event::GainedFocus:
Handle_Update();
makeFrontWindow(mainPtr);
case sf::Event::MouseMoved:
if(!gInBackground) {
location where(event.mouseMove.x, event.mouseMove.y);
@@ -270,11 +273,6 @@ void Handle_One_Event() {
handle_scroll(event);
break;
case sf::Event::GainedFocus:
Handle_Update();
makeFrontWindow(mainPtr);
break;
case sf::Event::Closed:
if(overall_mode == MODE_STARTUP) {
if(party_in_memory) {

View File

@@ -287,6 +287,7 @@ void put_party_in_scen(std::string scen_name) {
showError("Could not find scenario!");
return;
}
make_cursor_watch();
if(!load_scenario(path, univ.scenario))
return;

View File

@@ -1198,6 +1198,7 @@ void cDialog::run(std::function<void(cDialog&)> onopen){
break;
default: // To silence warning of unhandled enum values
break;
case sf::Event::GainedFocus:
case sf::Event::MouseMoved:
bool inField = false;
for(auto& ctrl : controls) {

View File

@@ -2406,6 +2406,7 @@ void set_up_start_screen() {
set_lb(NLS - 3,LB_TEXT,LB_NO_ACTION,"with the terms of the license.");
set_lb(NLS - 2,LB_TEXT,LB_NO_ACTION,"Copyright 1997, All rights reserved.");
set_lb(NLS - 1,LB_TEXT,LB_NO_ACTION,version());
set_cursor(wand_curs);
}
void set_up_main_screen() {
@@ -2439,6 +2440,7 @@ void set_up_main_screen() {
set_lb(-1,LB_TEXT,LB_EDIT_TALK,"Edit Town Dialogue");
set_lb(NLS - 2,LB_TEXT,LB_NO_ACTION,"Copyright 1997, All rights reserved.");
set_lb(NLS - 1,LB_TEXT,LB_NO_ACTION,version());
set_cursor(wand_curs);
overall_mode = MODE_MAIN_SCREEN;
right_sbar->show();
pal_sbar->hide();

View File

@@ -379,6 +379,7 @@ void run_startup_g() {
sf::Texture pict_to_draw;
dest_rect = pict_rect;
set_cursor(watch_curs);
dest_rect.offset(-25,-25);
pict_to_draw.loadFromImage(*ResMgr::get<ImageRsrc>("edsplash"));
for(int i = 0; i < 10; i++) {
@@ -386,9 +387,12 @@ void run_startup_g() {
rect_draw_some_item(pict_to_draw, pict_rect, mainPtr, dest_rect, sf::BlendAlpha);
mainPtr.display();
mainPtr.pollEvent(event);
if(event.type == sf::Event::GainedFocus || event.type == sf::Event::MouseMoved)
set_cursor(watch_curs);
}
play_sound(-95);
sf::Clock timer;
set_cursor(wand_curs);
while(timer.getElapsedTime() < time_in_ticks(120)) {
mainPtr.pollEvent(event);
if(event.type == sf::Event::KeyPressed || event.type == sf::Event::MouseButtonPressed)