void draw_rectangle(int x, int y, int w, int h, Uint32 color, surface target) { SDL_Rect top = create_rect(x, y, w, 1); SDL_Rect bot = create_rect(x, y + h - 1, w, 1); SDL_Rect left = create_rect(x, y, 1, h); SDL_Rect right = create_rect(x + w - 1, y, 1, h); sdl::fill_rect(target,&top,color); sdl::fill_rect(target,&bot,color); sdl::fill_rect(target,&left,color); sdl::fill_rect(target,&right,color); }
void mouse_action::set_terrain_mouse_overlay(editor_display& disp, t_translation::t_terrain fg, t_translation::t_terrain bg) { surface image_fg(image::get_image("terrain/" + disp.get_map().get_terrain_info(fg).editor_image() + ".png")); surface image_bg(image::get_image("terrain/" + disp.get_map().get_terrain_info(bg).editor_image() + ".png")); if (image_fg == NULL || image_bg == NULL) { ERR_ED << "Missing terrain icon\n"; disp.set_mouseover_hex_overlay(NULL); return; } // Create a transparent surface of the right size. surface image = create_compatible_surface(image_fg, image_fg->w, image_fg->h); sdl_fill_rect(image,NULL,SDL_MapRGBA(image->format,0,0,0, 0)); // For efficiency the size of the tile is cached. // We assume all tiles are of the same size. // The zoom factor can change, so it's not cached. // NOTE: when zooming and not moving the mouse, there are glitches. // Since the optimal alpha factor is unknown, it has to be calculated // on the fly, and caching the surfaces makes no sense yet. static const Uint8 alpha = 196; static const int size = image_fg->w; static const int half_size = size / 2; static const int quarter_size = size / 4; static const int offset = 2; static const int new_size = half_size - 2; const int zoom = static_cast<int>(size * disp.get_zoom_factor()); // Blit left side image_fg = scale_surface(image_fg, new_size, new_size); SDL_Rect rcDestLeft = create_rect(offset, quarter_size, 0, 0); sdl_blit ( image_fg, NULL, image, &rcDestLeft ); // Blit left side image_bg = scale_surface(image_bg, new_size, new_size); SDL_Rect rcDestRight = create_rect(half_size, quarter_size, 0, 0); sdl_blit ( image_bg, NULL, image, &rcDestRight ); //apply mask so the overlay is contained within the mouseover hex image = mask_surface(image, image::get_hexmask()); // Add the alpha factor and scale the image image = scale_surface(adjust_surface_alpha(image, alpha), zoom, zoom); // Set as mouseover disp.set_mouseover_hex_overlay(image); }
void textbox::draw_contents() { SDL_Rect const &loc = inner_location(); surface surf = video().getSurface(); draw_solid_tinted_rectangle(loc.x,loc.y,loc.w,loc.h,0,0,0, focus(NULL) ? alpha_focus_ : alpha_, surf); SDL_Rect src; if(text_image_ == NULL) { update_text_cache(true); } if(text_image_ != NULL) { src.y = yscroll_; src.w = std::min<size_t>(loc.w,text_image_->w); src.h = std::min<size_t>(loc.h,text_image_->h); src.x = text_pos_; SDL_Rect dest = screen_area(); dest.x = loc.x; dest.y = loc.y; // Fills the selected area if(is_selection()) { const int start = std::min<int>(selstart_,selend_); const int end = std::max<int>(selstart_,selend_); int startx = char_x_[start]; int starty = char_y_[start]; const int endx = char_x_[end]; const int endy = char_y_[end]; while(starty <= endy) { const size_t right = starty == endy ? endx : text_image_->w; if(right <= size_t(startx)) { break; } SDL_Rect rect = create_rect(loc.x + startx , loc.y + starty - src.y , right - startx , line_height_); const clip_rect_setter clipper(surf, &loc); Uint32 color = SDL_MapRGB(surf->format, 0, 0, 160); fill_rect_alpha(rect, color, 140, surf); starty += int(line_height_); startx = 0; } } sdl_blit(text_image_, &src, surf, &dest); } draw_cursor((cursor_pos_ == 0 ? 0 : cursor_pos_ - 1), video()); update_rect(loc); }
static void draw_normal_geom(SkCanvas* canvas, const SkPoint& offset, int geom, bool useAA) { SkPaint p; p.setAntiAlias(useAA); p.setColor(SK_ColorBLACK); switch (geom) { case kRect_Geometry: // fall thru case kRectAndRect_Geometry: canvas->drawRect(create_rect(offset), p); break; case kRRect_Geometry: // fall thru case kRectAndRRect_Geometry: canvas->drawRRect(create_rrect(offset), p); break; case kCircle_Geometry: canvas->drawRRect(create_circle(offset), p); break; case kConvexPath_Geometry: // fall thru case kRectAndConvex_Geometry: canvas->drawPath(create_convex_path(offset), p); break; case kConcavePath_Geometry: // fall thru case kRectAndConcave_Geometry: canvas->drawPath(create_concave_path(offset), p); break; } }
static void run_lobby_loop(display& disp, mp::ui& ui) { disp.video().modeChanged(); bool first = true; font::cache_mode(font::CACHE_LOBBY); while (ui.get_result() == mp::ui::CONTINUE) { if (disp.video().modeChanged() || first) { SDL_Rect lobby_pos = create_rect(0 , 0 , disp.video().getx() , disp.video().gety()); ui.set_location(lobby_pos); first = false; } // process network data first so user actions can override the result // or uptodate data can prevent invalid actions // i.e. press cancel while you receive [start_game] or press start game while someone leaves ui.process_network(); events::pump(); events::raise_process_event(); events::raise_draw_event(); disp.flip(); disp.delay(20); } font::cache_mode(font::CACHE_GAME); }
// --------------------------------------------------------------------------- // // ----------- void bToolShape::end_clic(){ bStdToolGeom::end_clic(); if(!get_use_drag()){ return; } if(!get_active()){ return; } set_use_drag(false); set_use_track(false); CGPoint pa,pb; get_clic(&pa); get_cur(&pb); CGFloat d=CGPointsDist(&pa,&pb); if(d<=sqrt(2)){ return; } clearTempPathContext(true); validTempPathContext(); if(get_mnu_cmd()==kShapeRect){ create_rect(); } else{ create_circle(); } }
void slider::draw_contents() { surface image(state_ != NORMAL ? highlightedImage_ : image_); if (image == NULL) return; SDL_Color line_color = font::NORMAL_COLOR; if (!enabled()) { image = greyscale_image(image); line_color = font::DISABLED_COLOR; } SDL_Rect const &loc = location(); if (image->w >= loc.w) return; surface screen = video().getSurface(); SDL_Rect line_rect = create_rect(loc.x + image->w / 2 , loc.y + loc.h / 2 , loc.w - image->w , 1); sdl_fill_rect(screen, &line_rect, SDL_MapRGB(screen->format, line_color.r, line_color.g, line_color.b)); SDL_Rect const &slider = slider_area(); video().blit_surface(slider.x, slider.y, image); }
void draw_solid_tinted_rectangle(int x, int y, int w, int h, int r, int g, int b, double alpha, surface target) { SDL_Rect rect = create_rect(x, y, w, h); fill_rect_alpha(rect,SDL_MapRGB(target->format,r,g,b),Uint8(alpha*255),target); }
void CVideo::blit_surface(int x, int y, surface surf, SDL_Rect* srcrect, SDL_Rect* clip_rect) { surface target(getSurface()); SDL_Rect dst = create_rect(x, y, 0, 0); const clip_rect_setter clip_setter(target, clip_rect, clip_rect != NULL); sdl_blit(surf,srcrect,target,&dst); }
void test(void){ struct point p1 = create_point(1,3); struct point p2 = create_point(3,6); struct point p3 = create_point(5,0); struct point p4 = create_point(7,1); checkit_int(p1.x,1); checkit_int(p2.y,6); struct rect r1 = create_rect(p1, 3,2); struct rect r2 = create_rect(p2, 4,1); struct rect r3 = create_rect(p3,1,1); struct rect r4 = create_rect(p4,1,1); checkit_int(r1.w, 3); checkit_int(r2.h, 1); checkit_double(distance(p1,p3),5); struct rect r[3] = {r1,r2,r3}; checkit_int(largest_rect(r,3),0); struct point p[2]; closest_corners(r1,r2,p); checkit_int(p[0].x,4); checkit_int(p[0].y,5); checkit_int(p[1].x,3); checkit_int(p[1].y,6); struct point pt[2]; closest_corners(r2,r3,pt); checkit_int(pt[0].x,3); checkit_int(pt[0].y,6); checkit_int(pt[1].x,5); checkit_int(pt[1].y,1); struct point pts[2]; closest_corners(r3,r4,pts); checkit_int(pts[0].x,6); checkit_int(pts[0].y,1); checkit_int(pts[1].x,7); checkit_int(pts[1].y,1); }
internal void make_map() { // Fill map with blocked tiles for (i32 x = 0; x < MAP_WIDTH; x++) { for (i32 y = 0; y < MAP_HEIGHT; y++) { map[x][y].blockMovement = true; map[x][y].blockSight = true; } } // Create two rooms map_rect room1 = create_rect(20, 15, 10, 15); map_rect room2 = create_rect(50, 15, 10, 15); create_room(room1); create_room(room2); }
surface mask_modification::operator()(const surface& src) const { if(src->w == mask_->w && src->h == mask_->h && x_ == 0 && y_ == 0) return mask_surface(src, mask_); SDL_Rect r = create_rect(x_, y_, 0, 0); surface new_mask = create_neutral_surface(src->w, src->h); blit_surface(mask_, NULL, new_mask, &r); return mask_surface(src, new_mask); }
surface blit_function::operator()(const surface& src) const { //blit_surface want neutral surfaces surface nsrc = make_neutral_surface(src); surface nsurf = make_neutral_surface(surf_); SDL_Rect r = create_rect(x_, y_, 0, 0); sdl_blit(nsurf, NULL, nsrc, &r); return nsrc; }
void ttexture::draw(SDL_Renderer& renderer, const int x, const int y) { SDL_Rect dstrect = create_rect(x, y, clip_.w * hscale_, clip_.h * vscale_); SDL_SetTextureAlphaMod(texture_, alpha_); SDL_SetTextureColorMod(texture_, mod_r_, mod_g_, mod_b_); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, smooth_scaling_ ? "linear" : "nearest"); SDL_RenderCopyEx(&renderer, texture_, &clip_, &dstrect, rotation_, NULL, flip_); }
void loadscreen::clear_screen() { int scrx = screen_.getx(); //< Screen width. int scry = screen_.gety(); //< Screen height. SDL_Rect area = create_rect(0, 0, scrx, scry); // Screen area. surface disp(screen_.getSurface()); // Screen surface. // Make everything black. sdl_fill_rect(disp,&area,SDL_MapRGB(disp->format,0,0,0)); screen_.flip(); }
SDL_Rect slider::slider_area() const { static const SDL_Rect default_value = {0,0,0,0}; SDL_Rect const &loc = location(); if (image_.null() || image_->w >= loc.w) return default_value; int xpos = loc.x + (value_ - min_) * static_cast<int>(loc.w - image_->w) / (max_ - min_); return create_rect(xpos, loc.y, image_->w, image_->h); }
SDL_Rect scrollbar::grip_area() const { SDL_Rect const &loc = groove_area(); if (full_height_ == grip_height_) return loc; int h = static_cast<int>(loc.h) * grip_height_ / full_height_; if (h < minimum_grip_height_) h = minimum_grip_height_; int y = loc.y + (static_cast<int>(loc.h) - h) * grip_position_ / (full_height_ - grip_height_); return create_rect(loc.x, y, loc.w, h); }
void textbox::draw_cursor(int pos, CVideo &video) const { if(show_cursor_ && editable_) { SDL_Rect rect = create_rect(location().x + pos , location().y , 1 , location().h); surface frame_buffer = video.getSurface(); sdl_fill_rect(frame_buffer,&rect,SDL_MapRGB(frame_buffer->format,255,255,255)); } }
void ttexture::initialise_from_surface(SDL_Renderer& renderer, const int access) { if(access == SDL_TEXTUREACCESS_STATIC) { texture_ = SDL_CreateTextureFromSurface(&renderer, source_surface_); if(texture_ == NULL) { throw texception("Failed to create SDL_Texture object.", true); } clip_ = create_rect(0, 0, source_surface_->w, source_surface_->h); SDL_FreeSurface(source_surface_); source_surface_ = NULL; } else if(access == SDL_TEXTUREACCESS_STREAMING) { texture_ = SDL_CreateTexture(&renderer, source_surface_->format->format, SDL_TEXTUREACCESS_STREAMING, source_surface_->w, source_surface_->h); if(texture_ == NULL) { throw texception("Failed to create SDL_Texture object.", true); } clip_ = create_rect(0, 0, source_surface_->w, source_surface_->h); const int update = SDL_UpdateTexture(texture_, NULL, source_surface_->pixels, source_surface_->pitch); if(update != 0) { throw texception("Failed to update the SDL_Texture object during " "its construction.", true); } } else { throw texception("Unknown texture access mode.", false); } SDL_SetTextureBlendMode(texture_, SDL_BLENDMODE_BLEND); }
void floating_textbox::update_location(game_display& gui) { if (box_ == NULL) return; const SDL_Rect& area = gui.map_outside_area(); const int border_size = 10; const int ypos = area.y+area.h-30 - (check_ != NULL ? check_->height() + border_size : 0); if (label_ != 0) font::remove_floating_label(label_); font::floating_label flabel(label_string_); flabel.set_color(font::YELLOW_COLOR); flabel.set_position(area.x + border_size, ypos); flabel.set_alignment(font::LEFT_ALIGN); flabel.set_clip_rect(area); label_ = font::add_floating_label(flabel); if (label_ == 0) return; const SDL_Rect& label_area = font::get_floating_label_rect(label_); const int textbox_width = area.w - label_area.w - border_size*3; if(textbox_width <= 0) { font::remove_floating_label(label_); return; } if(box_ != NULL) { box_->set_volatile(true); const SDL_Rect rect = create_rect( area.x + label_area.w + border_size * 2 , ypos , textbox_width , box_->height()); box_->set_location(rect); } if(check_ != NULL) { check_->set_volatile(true); check_->set_location(box_->location().x,box_->location().y + box_->location().h + border_size); } }
void drawClippedGeom(SkCanvas* canvas, const SkPoint& offset, bool useAA) { int count = canvas->save(); switch (fGeom) { case kRect_Geometry: canvas->clipRect(create_rect(offset), SkRegion::kReplace_Op, useAA); break; case kRRect_Geometry: canvas->clipRRect(create_rrect(offset), SkRegion::kReplace_Op, useAA); break; case kCircle_Geometry: canvas->clipRRect(create_circle(offset), SkRegion::kReplace_Op, useAA); break; case kConvexPath_Geometry: canvas->clipPath(create_convex_path(offset), SkRegion::kReplace_Op, useAA); break; case kConcavePath_Geometry: canvas->clipPath(create_concave_path(offset), SkRegion::kReplace_Op, useAA); break; case kRectAndRect_Geometry: { SkRect r = create_rect(offset); r.offset(fSign * kXlate, fSign * kXlate); canvas->clipRect(r, SkRegion::kReplace_Op, true); // AA here forces shader clips canvas->clipRect(create_rect(offset), SkRegion::kIntersect_Op, useAA); } break; case kRectAndRRect_Geometry: { SkRect r = create_rect(offset); r.offset(fSign * kXlate, fSign * kXlate); canvas->clipRect(r, SkRegion::kReplace_Op, true); // AA here forces shader clips canvas->clipRRect(create_rrect(offset), SkRegion::kIntersect_Op, useAA); } break; case kRectAndConvex_Geometry: { SkRect r = create_rect(offset); r.offset(fSign * kXlate, fSign * kXlate); canvas->clipRect(r, SkRegion::kReplace_Op, true); // AA here forces shader clips canvas->clipPath(create_convex_path(offset), SkRegion::kIntersect_Op, useAA); } break; case kRectAndConcave_Geometry: { SkRect r = create_rect(offset); r.offset(fSign * kXlate, fSign * kXlate); canvas->clipRect(r, SkRegion::kReplace_Op, true); // AA here forces shader clips canvas->clipPath(create_concave_path(offset), SkRegion::kIntersect_Op, useAA); } break; } SkISize size = canvas->getDeviceSize(); SkRect bigR = SkRect::MakeWH(SkIntToScalar(size.width()), SkIntToScalar(size.height())); SkPaint p; p.setColor(SK_ColorRED); canvas->drawRect(bigR, p); canvas->restoreToCount(count); }
void undraw(surface screen) { if(use_color_cursors() == false) { return; } if(cursor_buf == NULL) { return; } SDL_Rect area = create_rect(cursor_x - shift_x[current_cursor] , cursor_y - shift_y[current_cursor] , cursor_buf->w , cursor_buf->h); sdl_blit(cursor_buf,NULL,screen,&area); update_rect(area); }
BOOST_FOREACH(mouse_action_map::value_type a, mouse_actions_) { if (a.second->toolbar_button() != NULL) { SDL_Rect r = a.second->toolbar_button()->location(gui_.screen_area()); SDL_Rect outline = create_rect(r.x - 2, r.y - 2, r.h + 4, r.w + 4); //TODO comment or remove //outline = intersect_rects(r, gui().screen_area()); surface screen = gui_.video().getSurface(); Uint32 color; if (a.second == mouse_action_) { color = SDL_MapRGB(screen->format, 0xFF, 0x00, 0x00); } else { color = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00); } draw_rectangle(outline.x, outline.y, outline.w, outline.h, color, screen); update_rect(outline); } }
surface blit_modification::operator()(const surface& src) const { if(x_ >= src->w) { std::stringstream sstr; sstr << "~BLIT(): x-coordinate '" << x_ << "' larger than destination image's width '" << src->w << "' no blitting performed.\n"; throw texception(sstr); } if(y_ >= src->h) { std::stringstream sstr; sstr << "~BLIT(): y-coordinate '" << y_ << "' larger than destination image's height '" << src->h << "' no blitting performed.\n"; throw texception(sstr); } if(surf_->w + x_ > src->w) { std::stringstream sstr; sstr << "~BLIT(): offset and width '" << x_ + surf_->w << "' larger than destination image's width '" << src->w << "' no blitting performed.\n"; throw texception(sstr); } if(surf_->h + y_ > src->h) { std::stringstream sstr; sstr << "~BLIT(): offset and height '" << y_ + surf_->h << "' larger than destination image's height '" << src->h << "' no blitting performed.\n"; throw texception(sstr); } //blit_surface want neutral surfaces surface nsrc = make_neutral_surface(src); surface nsurf = make_neutral_surface(surf_); SDL_Rect r = create_rect(x_, y_, 0, 0); blit_surface(nsurf, NULL, nsrc, &r); return nsrc; }
static void show_tooltip(const tooltip& tip) { if(video_ == NULL) { return; } clear_tooltip(); const SDL_Color bgcolor = {0,0,0,160}; #if defined(_KINGDOM_EXE) || !defined(_WIN32) SDL_Rect area = screen_area(); #else SDL_Rect area = create_rect(0, 0, 800, 600); #endif unsigned int border = 10; font::floating_label flabel(tip.message); flabel.set_font_size(font_size); flabel.set_color(font::NORMAL_COLOR); flabel.set_clip_rect(area); flabel.set_width(text_width); flabel.set_bg_color(bgcolor); flabel.set_border_size(border); tooltip_handle = font::add_floating_label(flabel); SDL_Rect rect = font::get_floating_label_rect(tooltip_handle); //see if there is enough room to fit it above the tip area if(tip.rect.y > rect.h) { rect.y = tip.rect.y - rect.h; } else { rect.y = tip.rect.y + tip.rect.h; } rect.x = tip.rect.x; if(rect.x < 0) { rect.x = 0; } else if(rect.x + rect.w > area.w) { rect.x = area.w - rect.w; } font::move_floating_label(tooltip_handle,rect.x,rect.y); }
// @draw_area_unit[OUT]: units_from_rect fill valid units to it. // return value // size of filled units // remark: // 1)unit overlapped multi-grid, return center loc only size_t base_map::units_from_rect(base_unit** draw_area_unit, const rect_of_hexes& draw_area_rect) { size_t draw_area_unit_size = 0; int draw_area_min_x = std::max(0, draw_area_rect.left); int draw_area_max_x = std::min(gmap_.w() - 1, draw_area_rect.right); int draw_area_min_y[2], draw_area_max_y[2]; draw_area_min_y[0] = std::max(0, draw_area_rect.top[0]); draw_area_min_y[1] = std::max(0, draw_area_rect.top[1]); draw_area_max_y[0] = std::min(gmap_.h() - 1, draw_area_rect.bottom[0]); draw_area_max_y[1] = std::min(gmap_.h() - 1, draw_area_rect.bottom[1]); if (consistent_) { std::set<const base_unit*> calculated; for (int x = draw_area_min_x; x <= draw_area_max_x; x ++) { for (int y = draw_area_min_y[x & 1]; y <= draw_area_max_y[x & 1]; y ++) { base_unit* u = coor_map_[index(x, y)].base; if (u && !calculated.count(u)) { calculated.insert(u); draw_area_unit[draw_area_unit_size ++] = u; } u = coor_map_[index(x, y)].overlay; if (u && !calculated.count(u)) { calculated.insert(u); draw_area_unit[draw_area_unit_size ++] = u; } } } } else { display& disp = controller_.get_display(); int zoom = disp.hex_size(); SDL_Rect rect = create_rect(draw_area_min_x * zoom, draw_area_min_y[0] * zoom, (draw_area_max_x - draw_area_min_x + 1) * zoom, (draw_area_max_y[0] - draw_area_min_y[0] + 1) * zoom); for (int i = 0; i < map_vsize_; i ++) { base_unit* u = map_[i]; if (rects_overlap(u->get_rect(), rect)) { draw_area_unit[draw_area_unit_size ++] = u; } } } return draw_area_unit_size; }
void mouse_action_starting_position::set_mouse_overlay(editor_display& disp) { surface image60 = image::get_image("icons/action/editor-tool-starting-position_60.png"); //TODO avoid hardcoded hex field size surface image = create_neutral_surface(72,72); SDL_Rect r = create_rect(6, 6, 0, 0); blit_surface(image60, NULL, image, &r); Uint8 alpha = 196; int size = image->w; int zoom = static_cast<int>(size * disp.get_zoom_factor()); // Add the alpha factor and scale the image image = scale_surface(adjust_surface_alpha(image, alpha), zoom, zoom); disp.set_mouseover_hex_overlay(image); }
void cutter::add_sub_image(const surface &surf, surface_map &map, const config* config) { const std::string name = (*config)["name"]; if(name.empty()) throw exploder_failure("Un-named sub-image"); if(masks_.find(name) == masks_.end()) throw exploder_failure("Unable to find mask corresponding to " + name); const cutter::mask& mask = masks_[name]; std::vector<std::string> pos = utils::split((*config)["pos"]); if(pos.size() != 2) throw exploder_failure("Invalid position " + (*config)["pos"].str()); int x = atoi(pos[0].c_str()); int y = atoi(pos[1].c_str()); const SDL_Rect cut = create_rect(x - mask.shift.x , y - mask.shift.y , mask.image->w , mask.image->h); typedef std::pair<std::string, positioned_surface> sme; positioned_surface ps; ps.image = surface(::cut_surface(surf, cut)); if(ps.image == NULL) throw exploder_failure("Unable to cut surface!"); ps.name = name; ps.mask = mask; ps.pos.x = x - mask.shift.x; ps.pos.y = y - mask.shift.y; map.insert(sme(name, ps)); if(verbose_) { std::cerr << "Extracting sub-image " << name << ", position (" << x << ", " << y << ")\n"; } }
void textbox::append_text(const std::string& text, bool auto_scroll, const SDL_Color& color) { if(text_image_.get() == NULL) { set_text(text, color); return; } //disallow adding multi-line text to a single-line text box if(wrap_ == false && std::find_if(text.begin(),text.end(),utils::isnewline) != text.end()) { return; } const bool is_at_bottom = get_position() == get_max_position(); const wide_string& wtext = utils::string_to_wstring(text); const surface new_text = add_text_line(wtext, color); surface new_surface = create_compatible_surface(text_image_,std::max<size_t>(text_image_->w,new_text->w),text_image_->h+new_text->h); SDL_SetAlpha(new_text.get(),0,0); SDL_SetAlpha(text_image_.get(),0,0); sdl_blit(text_image_,NULL,new_surface,NULL); SDL_Rect target = create_rect(0 , text_image_->h , new_text->w , new_text->h); sdl_blit(new_text,NULL,new_surface,&target); text_image_.assign(new_surface); text_.resize(text_.size() + wtext.size()); std::copy(wtext.begin(),wtext.end(),text_.end()-wtext.size()); set_dirty(true); update_text_cache(false); if(auto_scroll && is_at_bottom) scroll_to_bottom(); handle_text_changed(text_); }
void effect::unrender() { if (!surf_ || !buffer_) { return; } surface screen = disp->get_screen_surface(); SDL_Rect clip_rect = disp->map_outside_area(); const clip_rect_setter clip_setter(screen, &clip_rect); // Due to scrolling, the location of the rendered halo // might have changed; recalculate const map_location zero_loc(0,0); const int screenx = disp->get_location_x(zero_loc); const int screeny = disp->get_location_y(zero_loc); const int xpos = x_ + screenx - surf_->w/2; const int ypos = y_ + screeny - surf_->h/2; SDL_Rect rect = create_rect(xpos, ypos, surf_->w, surf_->h); sdl_blit(buffer_,NULL,screen,&rect); }