display[mac]: add more setActive(false)

This commit is contained in:
Laurent Alonso(fr)
2020-05-24 12:02:10 +02:00
committed by Celtic Minstrel
parent 38260ec8c2
commit 2738a6ca3a
5 changed files with 25 additions and 15 deletions

View File

@@ -57,7 +57,7 @@ bool cButton::isScrollable(){
void cButton::draw(){
rectangle from_rect, to_rect;
inWindow->setActive();
inWindow->setActive(false);
if(visible){
TextStyle style;
@@ -92,6 +92,7 @@ void cButton::draw(){
// frame default button, to provide a visual cue that it's the default
if(key.spec && key.k == key_enter) drawFrame(2,frameStyle);
}
inWindow->setActive();
}
bool cButton::manageFormat(eFormat prop, bool set, boost::any* val) {
@@ -324,8 +325,7 @@ bool cLed::manageFormat(eFormat prop, bool set, boost::any* val) {
void cLed::draw(){
rectangle from_rect, to_rect;
inWindow->setActive();
inWindow->setActive(false);
if(visible){
TextStyle style;
style.pointSize = textSize;
@@ -341,6 +341,7 @@ void cLed::draw(){
to_rect.left = frame.left + 18; // Possibly could be 20
win_draw_string(*inWindow,to_rect,lbl,wrapLabel ? eTextMode::WRAP : eTextMode::LEFT_TOP,style);
}
inWindow->setActive();
}
cControl::storage_t cLed::store() {

View File

@@ -621,7 +621,7 @@ void draw_text_bar() {
}
void put_text_bar(std::string str) {
text_bar_gworld.setActive();
text_bar_gworld.setActive(false);
auto& bar_gw = *ResMgr::graphics.get("textbar");
rect_draw_some_item(bar_gw, rectangle(bar_gw), text_bar_gworld, rectangle(bar_gw));
TextStyle style;
@@ -658,12 +658,14 @@ void put_text_bar(std::string str) {
}
}
text_bar_gworld.setActive();
text_bar_gworld.display();
}
void refresh_text_bar() {
mainPtr.setActive();
mainPtr.setActive(false);
rect_draw_some_item(text_bar_gworld.getTexture(), rectangle(text_bar_gworld), mainPtr, win_to_rects[WINRECT_STATUS]);
mainPtr.setActive();
}
// this is used for determinign whether to round off walkway corners
@@ -1565,7 +1567,7 @@ void draw_targeting_line(location where_curs) {
if((can_see_light(from_loc,which_space,sight_obscurity) < 5)
&& (dist(from_loc,which_space) <= current_spell_range)) {
mainPtr.setActive();
mainPtr.setActive(false);
clip_rect(mainPtr, on_screen_terrain_area);
draw_line(mainPtr, where_curs, location(xBound, yBound), 2, {128,128,128}, sf::BlendAdd);
redraw_rect.left = min(where_curs.x,xBound) - 4;
@@ -1606,6 +1608,7 @@ void draw_targeting_line(location where_curs) {
}
redraw_rect2.inset(-5,-5);
mainPtr.setActive();
undo_clip(mainPtr);
}
}

View File

@@ -162,8 +162,9 @@ void apply_light_mask(bool onWindow) {
return;
if(onWindow) {
mainPtr.setActive();
mainPtr.setActive(false);
fill_region(mainPtr, dark_mask_region, sf::Color::Black);
mainPtr.setActive();
return;
}
@@ -353,7 +354,7 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) {
to_rect.offset(current_terrain_ul);
rect_draw_some_item(terrain_screen_gworld.getTexture(),oldBounds,mainPtr,to_rect);
mainPtr.setActive();
mainPtr.setActive(false);
// init missile paths
@@ -435,6 +436,7 @@ void do_missile_anim(short num_steps,location missile_origin,short sound_num) {
rect_draw_some_item(*from_gw,from_rect, mainPtr,temp_rect,sf::BlendAlpha);
}
}
mainPtr.setActive();
mainPtr.display();
sf::sleep(sf::milliseconds(2 + 5 * get_int_pref("GameSpeed")));
}
@@ -518,7 +520,7 @@ void do_explosion_anim(short /*sound_num*/,short special_draw, short snd) {
style.font = FONT_BOLD;
style.pointSize = 10;
style.lineHeight = 10;
mainPtr.setActive();
mainPtr.setActive(false);
// init missile paths
screen_ul.x = center.x - 4; screen_ul.y = center.y - 4;
@@ -583,6 +585,7 @@ void do_explosion_anim(short /*sound_num*/,short special_draw, short snd) {
}
}
//if(((PSD[SDF_GAME_SPEED] == 1) && (t % 3 == 0)) || ((PSD[SDF_GAME_SPEED] == 2) && (t % 2 == 0)))
mainPtr.setActive();
mainPtr.display();
sf::sleep(time_in_ticks(2 * (1 + get_int_pref("GameSpeed"))));
}
@@ -637,12 +640,11 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
return;
}
talk_gworld.setActive();
TextStyle style;
style.font = FONT_DUNGEON;
style.pointSize = 18;
talk_gworld.setActive();
talk_gworld.setActive(false);
if(pressed) {
clip_rect(talk_gworld, clip_area_rect);
}
@@ -784,6 +786,7 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
win_draw_string(talk_gworld,bottom_help_rects[3],"'I' button brings up description.",eTextMode::WRAP,style);
undo_clip(talk_gworld);
talk_gworld.setActive();
talk_gworld.display();
refresh_shopping();
@@ -910,14 +913,14 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
rectangle dest_rect,help_from = {46,60,59,76};
sf::Text str_to_draw;
talk_gworld.setActive();
talk_gworld.setActive(false);
TextStyle style;
style.font = FONT_DUNGEON;
style.pointSize = 18;
if(c_rect.right > 0) {
mainPtr.setActive();
mainPtr.setActive(false);
c_rect.offset(talk_area_rect.topLeft());
clip_rect(mainPtr, c_rect);
}
@@ -1015,6 +1018,7 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
}
}
talk_gworld.setActive();
rectangle oldRect(talk_gworld);
undo_clip(talk_gworld);
talk_gworld.display();

View File

@@ -214,7 +214,7 @@ void put_item_screen(eItemWinMode screen_num) {
rectangle erase_rect = {17,2,122,255},dest_rect;
rectangle upper_frame_rect = {3,3,15,268};
item_stats_gworld.setActive();
item_stats_gworld.setActive(false);
// First clean up gworld with pretty patterns
sf::Texture& orig = *ResMgr::graphics.get("inventory");
@@ -360,6 +360,7 @@ void put_item_screen(eItemWinMode screen_num) {
undo_clip(item_stats_gworld);
place_item_bottom_buttons();
item_stats_gworld.setActive();
item_stats_gworld.display();
}

View File

@@ -1389,7 +1389,7 @@ void draw_map(bool need_refresh) {
canMap = false;
}
else if(need_refresh) {
map_gworld.setActive();
map_gworld.setActive(false);
fill_rect(map_gworld, map_world_rect, sf::Color::Black);
@@ -1472,6 +1472,7 @@ void draw_map(bool need_refresh) {
}
}
map_gworld.setActive();
map_gworld.display();
}