1 
2 /* Battle Tanks Game
3  * Copyright (C) 2006-2009 Battle Tanks team
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  */
19 
20 /*
21  * Additional rights can be granted beyond the GNU General Public License
22  * on the terms provided in the Exception. If you modify this file,
23  * you may extend this exception to your version of the file,
24  * but you are not obligated to do so. If you do not wish to provide this
25  * exception without modification, you must delete this exception statement
26  * from your version and license this file solely under the GPL without exception.
27 */
28 #include "control.h"
29 #include "sound/mixer.h"
30 
Control()31 Control::Control() : _base_x(0), _base_y(0), _changed(false), _mouse_in(false), _hidden(false), _modal(false) {}
32 
tick(const float dt)33 void Control::tick(const float dt) {}
34 
activate(const bool active)35 void Control::activate(const bool active) {
36 }
37 
hide(const bool hide)38 void Control::hide(const bool hide) {
39 	_hidden = hide;
40 }
41 
onKey(const SDL_keysym sym)42 bool Control::onKey(const SDL_keysym sym) {
43 	return false;
44 }
45 
onMouse(const int button,const bool pressed,const int x,const int y)46 bool Control::onMouse(const int button, const bool pressed, const int x, const int y) {
47 	return false;
48 }
49 
onMouseMotion(const int state,const int x,const int y,const int xrel,const int yrel)50 bool Control::onMouseMotion(const int state, const int x, const int y, const int xrel, const int yrel) {
51 	return false;
52 }
53 
on_mouse_enter(bool enter)54 void Control::on_mouse_enter(bool enter) {
55 	//LOG_DEBUG(("%s", enter?"enter":"leave"));
56 }
57 
invalidate(const bool play_sound)58 void Control::invalidate(const bool play_sound) {
59 	if (play_sound && !_changed)
60 		Mixer->playSample(NULL, "menu/change.ogg", false);
61 	_changed = true;
62 }
63 
get_base(int & x,int & y) const64 void Control::get_base(int &x, int &y) const {
65 	x = _base_x; y = _base_y;
66 }
67 
set_base(const int x,const int y)68 void Control::set_base(const int x, const int y) {
69 	_base_x = x; _base_y = y;
70 }
71 
~Control()72 Control::~Control() {}
73