Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 3, 2014
2 parents f364f21 + bc21430 commit 315152d
Show file tree
Hide file tree
Showing 61 changed files with 313 additions and 233 deletions.
10 changes: 5 additions & 5 deletions src/CMakeLists.txt
Expand Up @@ -363,6 +363,7 @@ set(wesnoth-sdl_SRC
sdl/rect.cpp
sdl/texture.cpp
sdl/window.cpp
sdl/utils.cpp
)

add_library(wesnoth-sdl
Expand Down Expand Up @@ -948,7 +949,6 @@ set(libwesnoth-game_STAT_SRC
race.cpp
random.cpp
reports.cpp
sdl_utils.cpp
show_dialog.cpp
simple_rng.cpp
sound.cpp
Expand Down Expand Up @@ -1127,7 +1127,7 @@ set(exploder_SRC
tools/exploder_cutter.cpp
tools/exploder_composer.cpp
tools/dummy_video.cpp
sdl_utils.cpp
sdl/utils.cpp
tracer.cpp
loadscreen_empty.cpp
)
Expand All @@ -1143,7 +1143,7 @@ set(cutter_SRC
tools/exploder_utils.cpp
tools/exploder_cutter.cpp
tools/dummy_video.cpp
sdl_utils.cpp
sdl/utils.cpp
tracer.cpp
loadscreen_empty.cpp
)
Expand Down Expand Up @@ -1194,7 +1194,7 @@ set(wesmage_SRC
wesmage/options.cpp
tools/dummy_video.cpp
tools/exploder_utils.cpp
sdl_utils.cpp
sdl/utils.cpp
tracer.cpp
loadscreen_empty.cpp
)
Expand Down Expand Up @@ -1330,7 +1330,7 @@ if(ENABLE_TESTS)
tests/create_images.cpp
tools/dummy_video.cpp
tools/exploder_utils.cpp
sdl_utils.cpp
sdl/utils.cpp
tracer.cpp
loadscreen_empty.cpp
)
Expand Down
6 changes: 3 additions & 3 deletions src/SConscript
Expand Up @@ -151,7 +151,7 @@ libcampaignd_sources = Split("""
libcampaignd = env.Library("campaignd", libcampaignd_sources, OBJPREFIX = "campaignd_")

libwesnoth_sdl_sources = Split("""
sdl_utils.cpp
sdl/utils.cpp
sdl/alpha.cpp
sdl/exception.cpp
sdl/rect.cpp
Expand Down Expand Up @@ -639,7 +639,7 @@ wesmage_sources = Split("""
wesmage/options.cpp
tools/dummy_video.cpp
tools/exploder_utils.cpp
sdl_utils.cpp
sdl/utils.cpp
sdl/alpha.cpp
sdl/window.cpp
tracer.cpp
Expand Down Expand Up @@ -686,7 +686,7 @@ create_images_sources = Split("""
tests/create_images.cpp
tools/dummy_video.cpp
tools/exploder_utils.cpp
sdl_utils.cpp
sdl/utils.cpp
sdl/alpha.cpp
sdl/window.cpp
tracer.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/ai/testing/ca_global_fallback.cpp
Expand Up @@ -27,7 +27,7 @@
#include "../../map_label.hpp"
#include "../../replay.hpp"
#include "../../resources.hpp"
#include "../../sdl_utils.hpp"
#include "../../sdl/utils.hpp"
#include "../../team.hpp"
#include "../../terrain_filter.hpp"
#include "../../tod_manager.hpp"
Expand Down
12 changes: 6 additions & 6 deletions src/construct_dialog.cpp
Expand Up @@ -66,9 +66,9 @@ dialog_textbox::~dialog_textbox()
dialog::dimension_measurements::dimension_measurements() :
x(-1),
y(-1),
interior(empty_rect),
message(empty_rect),
textbox(empty_rect),
interior(sdl::empty_rect),
message(sdl::empty_rect),
textbox(sdl::empty_rect),
menu_width(0),
panes(),
label_x(-1),
Expand Down Expand Up @@ -288,7 +288,7 @@ int dialog::show()
}

LOG_DP << "showing dialog '" << title_ << "' '" << message_->get_text() << "'\n";
if(dim_.interior == empty_rect) { layout(); }
if(dim_.interior == sdl::empty_rect) { layout(); }

//create the event context, remember to instruct any passed-in widgets to join it
const events::event_context dialog_events_context;
Expand Down Expand Up @@ -771,7 +771,7 @@ int dialog::process(dialog_process_info &info)

//left-clicking outside of a drop-down or context-menu should close it
if (info.new_left_button && !info.left_button) {
if (standard_buttons_.empty() && !point_in_rect(mousex,mousey, menu_->location())) {
if (standard_buttons_.empty() && !sdl::point_in_rect(mousex,mousey, menu_->location())) {
if (use_menu)
sound::play_UI_sound(game_config::sounds::button_press);
return CLOSE_DIALOG;
Expand All @@ -783,7 +783,7 @@ int dialog::process(dialog_process_info &info)
// but that may be changed to allow right-click selection instead.
if (info.new_right_button && !info.right_button) {
if( standard_buttons_.empty()
|| (!point_in_rect(mousex,mousey,get_frame().get_layout().exterior)
|| (!sdl::point_in_rect(mousex,mousey,get_frame().get_layout().exterior)
&& type_ != YES_NO && !(type_ == OK_ONLY && has_input))) {
sound::play_UI_sound(game_config::sounds::button_press);
return CLOSE_DIALOG;
Expand Down
4 changes: 2 additions & 2 deletions src/controller_base.cpp
Expand Up @@ -155,7 +155,7 @@ bool controller_base::handle_scroll(CKey& key, int mousex, int mousey, int mouse
int scroll_threshold = (preferences::mouse_scroll_enabled())
? preferences::mouse_scroll_threshold() : 0;
BOOST_FOREACH(const theme::menu& m, get_display().get_theme().menus()) {
if (point_in_rect(mousex, mousey, m.get_location())) {
if (sdl::point_in_rect(mousex, mousey, m.get_location())) {
scroll_threshold = 0;
}
}
Expand Down Expand Up @@ -184,7 +184,7 @@ bool controller_base::handle_scroll(CKey& key, int mousex, int mousey, int mouse

if (get_mouse_handler_base().scroll_started()) {
const SDL_Rect& rect = get_display().map_outside_area();
if (point_in_rect(mousex, mousey,rect) &&
if (sdl::point_in_rect(mousex, mousey,rect) &&
get_mouse_handler_base().scroll_started()) {
// Scroll speed is proportional from the distance from the first
// middle click and scrolling speed preference.
Expand Down
24 changes: 12 additions & 12 deletions src/display.cpp
Expand Up @@ -152,7 +152,7 @@ display::display(unit_map* units, CVideo& video, const gamemap* map, const std::
zoom_(DefaultZoom),
builder_(new terrain_builder(level, map, theme_.border().tile_image)),
minimap_(NULL),
minimap_location_(empty_rect),
minimap_location_(sdl::empty_rect),
redrawMinimap_(false),
redraw_background_(true),
invalidateAll_(true),
Expand Down Expand Up @@ -650,7 +650,7 @@ bool display::outside_area(const SDL_Rect& area, const int x, const int y) const
const map_location display::hex_clicked_on(int xclick, int yclick) const
{
const SDL_Rect& rect = map_area();
if(point_in_rect(xclick,yclick,rect) == false) {
if(sdl::point_in_rect(xclick,yclick,rect) == false) {
return map_location();
}

Expand Down Expand Up @@ -798,7 +798,7 @@ map_location display::minimap_location_on(int x, int y)
//TODO: don't return location for this,
// instead directly scroll to the clicked pixel position

if (!point_in_rect(x, y, minimap_area())) {
if (!sdl::point_in_rect(x, y, minimap_area())) {
return map_location();
}

Expand Down Expand Up @@ -930,7 +930,7 @@ void display::create_buttons()
if (!i->tooltip().empty()){
s.set_tooltip_string(i->tooltip());
}
if(rects_overlap(s.location(),map_outside_area())) {
if(sdl::rects_overlap(s.location(),map_outside_area())) {
s.set_volatile(true);
}

Expand Down Expand Up @@ -960,7 +960,7 @@ void display::create_buttons()
if (!i->tooltip().empty()){
b.set_tooltip_string(i->tooltip());
}
if(rects_overlap(b.location(),map_outside_area())) {
if(sdl::rects_overlap(b.location(),map_outside_area())) {
b.set_volatile(true);
}

Expand All @@ -982,7 +982,7 @@ void display::create_buttons()
if (!i->tooltip(0).empty()){
b.set_tooltip_string(i->tooltip(0));
}
if(rects_overlap(b.location(),map_outside_area())) {
if(sdl::rects_overlap(b.location(),map_outside_area())) {
b.set_volatile(true);
}

Expand Down Expand Up @@ -1345,7 +1345,7 @@ void display::flip()
SDL_Rect r = map_outside_area(); // Use frameBuffer to also test the UI
const Uint32 color = SDL_MapRGBA(video().getSurface()->format,0,0,0,255);
// Adjust the alpha if you want to balance cpu-cost / smooth sunset
fill_rect_alpha(r, color, 1, frameBuffer);
sdl::fill_rect_alpha(r, color, 1, frameBuffer);
update_rect(r);
}

Expand Down Expand Up @@ -1555,7 +1555,7 @@ void display::render_image(int x, int y, const display::tdrawing_layer drawing_l

SDL_Rect image_rect = sdl::create_rect(x, y, image->w, image->h);
SDL_Rect clip_rect = map_area();
if (!rects_overlap(image_rect, clip_rect))
if (!sdl::rects_overlap(image_rect, clip_rect))
return;

surface surf(image);
Expand Down Expand Up @@ -1898,7 +1898,7 @@ void display::draw_minimap()
int view_h = static_cast<int>(map_out_rect.h * yscaling);

const Uint32 box_color = SDL_MapRGB(minimap_->format,0xFF,0xFF,0xFF);
draw_rectangle(minimap_location_.x + view_x - 1,
sdl::draw_rectangle(minimap_location_.x + view_x - 1,
minimap_location_.y + view_y - 1,
view_w + 2, view_h + 2,
box_color, screen);
Expand Down Expand Up @@ -1984,7 +1984,7 @@ bool display::scroll(int xmove, int ymove, bool force)
SDL_Rect dstrect = map_area();
dstrect.x += dx;
dstrect.y += dy;
dstrect = intersect_rects(dstrect, map_area());
dstrect = sdl::intersect_rects(dstrect, map_area());

SDL_Rect srcrect = dstrect;
srcrect.x -= dx;
Expand Down Expand Up @@ -2541,7 +2541,7 @@ void display::draw_invalidated() {

const bool on_map = get_map().on_board(loc);
SDL_Rect hex_rect = sdl::create_rect(xpos, ypos, zoom_, zoom_);
if(!rects_overlap(hex_rect,clip_rect)) {
if(!sdl::rects_overlap(hex_rect,clip_rect)) {
continue;
}
draw_hex(loc);
Expand Down Expand Up @@ -3008,7 +3008,7 @@ bool display::propagate_invalidation(const std::set<map_location>& locs)

bool display::invalidate_visible_locations_in_rect(const SDL_Rect& rect)
{
return invalidate_locations_in_rect(intersect_rects(map_area(),rect));
return invalidate_locations_in_rect(sdl::intersect_rects(map_area(),rect));
}

bool display::invalidate_locations_in_rect(const SDL_Rect& rect)
Expand Down
2 changes: 1 addition & 1 deletion src/editor/palette/palette_manager.cpp
Expand Up @@ -155,7 +155,7 @@ void palette_manager::handle_event(const SDL_Event& event) {

if (event.type == SDL_MOUSEMOTION) {
// If the mouse is inside the palette, give it focus.
if (point_in_rect(event.button.x, event.button.y, location())) {
if (sdl::point_in_rect(event.button.x, event.button.y, location())) {
if (!focus(&event)) set_focus(true);
}
// If the mouse is outside, remove focus.
Expand Down
2 changes: 1 addition & 1 deletion src/editor/palette/tristate_button.cpp
Expand Up @@ -272,7 +272,7 @@ void tristate_button::draw_contents() {

//TODO move to widget
bool tristate_button::hit(int x, int y) const {
return point_in_rect(x, y, location());
return sdl::point_in_rect(x, y, location());
}

void tristate_button::mouse_motion(SDL_MouseMotionEvent const &event) {
Expand Down
2 changes: 1 addition & 1 deletion src/font.cpp
Expand Up @@ -1135,7 +1135,7 @@ SDL_Rect get_floating_label_rect(int handle)
}
}

return empty_rect;
return sdl::empty_rect;
}

floating_label_context::floating_label_context()
Expand Down
2 changes: 1 addition & 1 deletion src/font.hpp
Expand Up @@ -16,7 +16,7 @@

#include "exceptions.hpp"

#include "sdl_utils.hpp"
#include "sdl/utils.hpp"

#include <SDL_ttf.h>

Expand Down
2 changes: 1 addition & 1 deletion src/gui/auxiliary/canvas.hpp
Expand Up @@ -22,7 +22,7 @@
#define GUI_AUXILIARY_CANVAS_HPP_INCLUDED

#include "formula_callable.hpp"
#include "sdl_utils.hpp"
#include "sdl/utils.hpp"

class config;
class variant;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/lobby/lobby_data.hpp
Expand Up @@ -15,7 +15,7 @@
#ifndef INC_LOBBY_DATA
#define INC_LOBBY_DATA

#include "sdl_utils.hpp"
#include "sdl/utils.hpp"

#include <set>
#include <deque>
Expand Down
3 changes: 2 additions & 1 deletion src/gui/widgets/scrollbar_container.cpp
Expand Up @@ -23,6 +23,7 @@
#include "gui/widgets/spacer.hpp"
#include "gui/widgets/window.hpp"
#include "utils/foreach.tpp"
#include "sdl/rect.hpp"

#include <boost/bind.hpp>

Expand Down Expand Up @@ -416,7 +417,7 @@ void tscrollbar_container::set_visible_rectangle(const SDL_Rect& rectangle)

// Now get the visible part of the content.
content_visible_area_
= intersect_rects(rectangle, content_->get_rectangle());
= sdl::intersect_rects(rectangle, content_->get_rectangle());

content_grid_->set_visible_rectangle(content_visible_area_);
}
Expand Down
9 changes: 5 additions & 4 deletions src/gui/widgets/widget.cpp
Expand Up @@ -18,6 +18,7 @@
#include "gui/widgets/window.hpp"
#include "gui/auxiliary/event/message.hpp"
#include "gui/auxiliary/log.hpp"
#include "sdl/rect.hpp"

namespace gui2
{
Expand Down Expand Up @@ -451,11 +452,11 @@ SDL_Rect twidget::get_dirty_rectangle() const

void twidget::set_visible_rectangle(const SDL_Rect& rectangle)
{
clipping_rectangle_ = intersect_rects(rectangle, get_rectangle());
clipping_rectangle_ = sdl::intersect_rects(rectangle, get_rectangle());

if(clipping_rectangle_ == get_rectangle()) {
redraw_action_ = tredraw_action::full;
} else if(clipping_rectangle_ == empty_rect) {
} else if(clipping_rectangle_ == sdl::empty_rect) {
redraw_action_ = tredraw_action::none;
} else {
redraw_action_ = tredraw_action::partly;
Expand Down Expand Up @@ -531,7 +532,7 @@ void twidget::draw_debug_border(surface& frame_buffer)
/* DO NOTHING */
break;
case 1:
draw_rectangle(
sdl::draw_rectangle(
r.x, r.y, r.w, r.h, debug_border_colour_, frame_buffer);
break;

Expand All @@ -557,7 +558,7 @@ twidget::draw_debug_border(surface& frame_buffer, int x_offset, int y_offset)
break;

case 1:
draw_rectangle(
sdl::draw_rectangle(
r.x, r.y, r.w, r.h, debug_border_colour_, frame_buffer);
break;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/widget.hpp
Expand Up @@ -19,7 +19,7 @@
#include "gui/lib/types/point.hpp"
#include "gui/widgets/event_executor.hpp"

#include "sdl_utils.hpp"
#include "sdl/utils.hpp"

#include <boost/noncopyable.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/window.cpp
Expand Up @@ -762,7 +762,7 @@ void twindow::draw()
const Uint32 color
= SDL_MapRGBA(frame_buffer->format, 0, 0, 0, 255);

fill_rect_alpha(r, color, 1, frame_buffer);
sdl::fill_rect_alpha(r, color, 1, frame_buffer);
update_rect(r);
}
}
Expand Down

0 comments on commit 315152d

Please sign in to comment.