Classes | |
struct | texception |
class | twindow |
The wrapper class for the SDL_Window class. More... | |
Functions | |
static std::string | create_error (const std::string &operation, const bool use_sdl_error) |
SDL_Rect | create_rect (const int x, const int y, const int w, const int h) |
Creates an empty SDL_Rect. More... | |
bool | point_in_rect (int x, int y, const SDL_Rect &rect) |
Tests whether a point is inside a rectangle. More... | |
bool | rects_overlap (const SDL_Rect &rect1, const SDL_Rect &rect2) |
Tests whether two rectangles overlap. More... | |
SDL_Rect | intersect_rects (SDL_Rect const &rect1, SDL_Rect const &rect2) |
Calculates the intersection of two rectangles. More... | |
SDL_Rect | union_rects (const SDL_Rect &rect1, const SDL_Rect &rect2) |
Calculates the union of two rectangles. More... | |
void | fill_rect_alpha (SDL_Rect &rect, Uint32 color, Uint8 alpha, surface target) |
Fills a specified area of a surface with a given color and opacity. More... | |
void | draw_rectangle (int x, int y, int w, int h, Uint32 color, surface tg) |
Draw a colored rectangle on a surface. More... | |
void | draw_solid_tinted_rectangle (int x, int y, int w, int h, int r, int g, int b, double alpha, surface target) |
Fills a specified rectangle area of a surface with a given color and opacity. More... | |
void | fill_rect (surface &dst, SDL_Rect *dst_rect, const Uint32 color) |
Fill a rectangle on a given surface. More... | |
Variables | |
const SDL_Rect | empty_rect = { 0, 0, 0, 0 } |
|
static |
Definition at line 23 of file exception.cpp.
Creates an empty SDL_Rect.
Since SDL_Rect doesn't have a constructor it's not possible to create it as a temporary for a function parameter. This functions overcomes this limit.
Definition at line 28 of file rect.cpp.
References h.
Referenced by cutter::add_sub_image(), gui::textbox::append_text(), CVideo::blit_surface(), blit_surface(), blur_surface(), BOOST_AUTO_TEST_CASE(), unit_drawer::calculate_energy_bar(), gui2::create_rect(), font::floating_label::create_surface(), events::console_handler::do_layers(), font::floating_label::draw(), gui2::twindow::draw(), draw_background(), unit_drawer::draw_bar(), gui::progress_bar::draw_contents(), gui::textbox::draw_contents(), gui::slider::draw_contents(), mp::wait::leader_preview_pane::draw_contents(), gui::tristate_button::draw_contents(), dialogs::unit_preview_pane::draw_contents(), gui::textbox::draw_cursor(), display::draw_hex(), display::draw_invalidated(), display::draw_minimap_units(), draw_rectangle(), gui::menu::draw_row(), draw_solid_tinted_rectangle(), font::draw_text_line(), display::drawing_buffer_commit(), font::get_floating_label_rect(), battle_prediction_pane::get_hp_distrib_surface(), mp::gamebrowser::get_item_rect(), gui::menu::get_item_rect_internal(), unit_frame::get_overlaped_hex(), image::getMinimap(), gui::scrollbar::grip_area(), mp::create::layout_children(), image::load_image_sub_file(), image::blit_modification::operator()(), image::mask_modification::operator()(), storyscreen::part_ui::prepare_background(), unit_drawer::redraw_unit(), display::refresh_report(), halo::halo_impl::effect::render(), display::render_image(), storyscreen::part_ui::render_story_box(), font::render_text(), storyscreen::part_ui::render_title_box(), mp::run_lobby_loop(), screen_area(), display::screen_area(), gui::widget::set_height(), gui::widget::set_location(), gui::widget::set_measurements(), editor::mouse_action_map_label::set_mouse_overlay(), editor::mouse_action_village::set_mouse_overlay(), editor::mouse_action_paste::set_mouse_overlay(), editor::mouse_action_starting_position::set_mouse_overlay(), editor::mouse_action::set_terrain_mouse_overlay(), gui::widget::set_width(), about::show_about(), hotkey::show_binding_dialog(), gui::slider::slider_area(), mp::ui::ui(), font::floating_label::undraw(), halo::halo_impl::effect::unrender(), gui::floating_textbox::update_location(), update_rect(), and default_map_generator::user_config().
Draw a colored rectangle on a surface.
x | The x coordinate of the rectangle. |
y | The y coordinate of the rectangle. |
w | The width of the rectangle. |
h | The height of the rectangle. |
color | The color of the rectangle. |
tg | The surface to operate on. |
Definition at line 103 of file rect.cpp.
References create_rect(), fill_rect(), and right.
Referenced by location_palette_item::draw_contents(), help::help_text_area::draw_contents(), gui2::twidget::draw_debug_border(), and display::draw_minimap().
void sdl::draw_solid_tinted_rectangle | ( | int | x, |
int | y, | ||
int | w, | ||
int | h, | ||
int | r, | ||
int | g, | ||
int | b, | ||
double | alpha, | ||
surface | target | ||
) |
Fills a specified rectangle area of a surface with a given color and opacity.
Shortcut for fill_rect_alpha().
x | The x coordinate of the rectangle. |
y | The y coordinate of the rectangle. |
w | The width of the rectangle. |
h | The height of the rectangle. |
r | The red value of the color to be used. |
g | The green value of the color to be used. |
b | The blue value of the color to be used. |
alpha | Opacity for filling. |
target | The surface to operate on. |
Definition at line 117 of file rect.cpp.
References create_rect(), and fill_rect_alpha().
Referenced by location_palette_item::draw_contents(), gui::textbox::draw_contents(), gui::menu::draw_row(), gui::menu::style::draw_row_bg(), playsingle_controller::play_scenario(), storyscreen::part_ui::render_background(), storyscreen::part_ui::render_story_box(), and storyscreen::part_ui::render_title_box().
Fill a rectangle on a given surface.
Alias for SDL_FillRect.
dst | The surface to operate on. |
dst_rect | The rectangle to fill. |
color | Color of the rectangle. |
Definition at line 143 of file rect.hpp.
Referenced by display::clear_screen(), font::floating_label::create_surface(), unit_drawer::draw_bar(), draw_centered_on_background(), gui::progress_bar::draw_contents(), gui::slider::draw_contents(), gui::textbox::draw_cursor(), gui2::twidget::draw_debug_border(), display::draw_hex(), mp::create::draw_level_image(), display::draw_minimap_units(), draw_rectangle(), gui::menu::draw_row(), gui::menu::style::draw_row_bg(), enter_lobby_mode(), fill_rect_alpha(), battle_prediction_pane::get_hp_distrib_surface(), image::getMinimap(), storyscreen::part_ui::render_story_box(), storyscreen::part_ui::render_title_box(), and the_end().
Fills a specified area of a surface with a given color and opacity.
rect | The area that should be filled. |
color | The color to fill with. |
alpha | Opacity. |
target | The surface to operate on. |
Definition at line 83 of file rect.cpp.
References create_compatible_surface(), fill_rect(), sdl_blit(), SDL_SetAlpha(), and SDL_SRCALPHA.
Referenced by gui2::twindow::draw(), gui::textbox::draw_contents(), draw_solid_tinted_rectangle(), and display::flip().
SDL_Rect sdl::intersect_rects | ( | SDL_Rect const & | rect1, |
SDL_Rect const & | rect2 | ||
) |
Calculates the intersection of two rectangles.
rect1 | One rectangle. |
rect2 | Another rectangle |
Definition at line 58 of file rect.cpp.
References empty_rect, and h.
Referenced by events::console_handler::do_layers(), display::invalidate_visible_locations_in_rect(), surface_restorer::restore(), display::scroll(), gui2::tscrollbar_container::set_visible_rectangle(), and gui2::twidget::set_visible_rectangle().
Tests whether a point is inside a rectangle.
x | The x coordinate of the point. |
y | The y coordinate of the point. |
rect | The rectangle. |
Definition at line 47 of file rect.cpp.
Referenced by tooltips::click(), gui::scrollarea::handle_event(), gui::slider::handle_event(), editor::palette_manager::handle_event(), gui::scrollbar::handle_event(), gui::textbox::handle_event(), mp::gamebrowser::handle_event(), controller_base::handle_scroll(), display::hex_clicked_on(), gui::tristate_button::hit(), gui::button::hit(), location_palette_item::hit(), display::minimap_location_on(), gui::slider::mouse_down(), gui::slider::mouse_motion(), gui::slider::mouse_wheel(), events::mouse_handler_base::mouse_wheel(), help::help_text_area::item_at::operator()(), gui::dialog::process(), help::help_browser::process_event(), gui::widget::process_help_string(), gui::widget::process_tooltip_string(), and events::mouse_handler::right_click_show_menu().
bool sdl::rects_overlap | ( | const SDL_Rect & | rect1, |
const SDL_Rect & | rect2 | ||
) |
Tests whether two rectangles overlap.
rect1 | One rectangle. |
rect2 | Another rectangle. |
Definition at line 52 of file rect.cpp.
Referenced by tooltips::add_tooltip(), tooltips::clear_tooltips(), display::draw_invalidated(), gui::widget::hidden(), unit_drawer::redraw_unit(), halo::halo_impl::effect::render(), and display::render_image().
SDL_Rect sdl::union_rects | ( | const SDL_Rect & | rect1, |
const SDL_Rect & | rect2 | ||
) |
Calculates the union of two rectangles.
Note: "union" here doesn't mean the union of the sets of points of the two polygons, but rather the minimal rectangle that supersets both rectangles.
rect1 | One rectangle. |
rect2 | Another rectangle. |
const SDL_Rect sdl::empty_rect = { 0, 0, 0, 0 } |
Definition at line 26 of file rect.cpp.
Referenced by font::get_floating_label_rect(), gui::menu::get_item_rect_internal(), intersect_rects(), gui2::twidget::set_visible_rectangle(), and gui::dialog::show().