本文整理汇总了C++中window::set_is_dirty方法的典型用法代码示例。如果您正苦于以下问题:C++ window::set_is_dirty方法的具体用法?C++ window::set_is_dirty怎么用?C++ window::set_is_dirty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类window
的用法示例。
在下文中一共展示了window::set_is_dirty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_tip
void title_screen::update_tip(window& win, const bool previous)
{
multi_page& tips = find_widget<multi_page>(&win, "tips", false);
if(tips.get_page_count() == 0) {
return;
}
int page = tips.get_selected_page();
if(previous) {
if(page <= 0) {
page = tips.get_page_count();
}
--page;
} else {
++page;
if(static_cast<unsigned>(page) >= tips.get_page_count()) {
page = 0;
}
}
tips.select_page(page);
/**
* @todo Look for a proper fix.
*
* This dirtying is required to avoid the blurring to be rendered wrong.
* Not entirely sure why, but since we plan to move to SDL2 that change
* will probably fix this issue automatically.
*/
win.set_is_dirty(true);
}
示例2: update_tod_display
void custom_tod::update_tod_display(window& window)
{
display* disp = display::get_singleton();
assert(disp && "Display pointer is null!");
// Prevent a floating slice of window appearing alone over the
// theme UI sidebar after redrawing tiles and before we have a
// chance to redraw the rest of this window.
window.undraw();
// NOTE: We only really want to re-render the gamemap tiles here.
// Redrawing everything is a significantly more expensive task.
// At this time, tiles are the only elements on which ToD tint is
// meant to have a visible effect. This is very strongly tied to
// the image caching mechanism.
//
// If this ceases to be the case in the future, you'll need to call
// redraw_everything() instead.
disp->update_tod(&get_selected_tod());
// invalidate all tiles so they are redrawn with the new ToD tint next
disp->invalidate_all();
// redraw tiles
disp->draw(false);
// NOTE: revert to invalidate_layout if necessary to display the ToD mask image.
window.set_is_dirty(true);
}
示例3: draw_callback
void outro::draw_callback(window& window)
{
if(SDL_GetTicks() < next_draw_) {
return;
}
/* If we've faded fully in...
*
* NOTE: we want fading to take around half a second. Given this function runs about every 3 frames, we
* limit ourselves to a reasonable 10 fade steps with an alpha difference (rounded up) of 25.5 each cycle.
* The actual calculation for alpha is done in the window definition in WFL.
*/
if(fading_in_ && fade_step_ > 10) {
// Schedule the fadeout after the provided delay.
if(timer_id_ == 0) {
timer_id_ = add_timer(duration_, [this](size_t) { fading_in_ = false; });
}
return;
}
// If we've faded fully out...
if(!fading_in_ && fade_step_ < 0) {
window.close();
return;
}
canvas& window_canvas = window.get_canvas(0);
window_canvas.set_variable("fade_step", wfl::variant(fade_step_));
window_canvas.set_is_dirty(true);
window.set_is_dirty(true);
if(fading_in_) {
fade_step_ ++;
} else {
fade_step_ --;
}
set_next_draw();
}