OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Action.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_ACTION_H
20 #define OPENXCOM_ACTION_H
21 
22 #include <SDL.h>
23 
24 namespace OpenXcom
25 {
26 
27 class InteractiveSurface;
28 
34 class Action
35 {
36 private:
37  SDL_Event *_ev;
38  double _scaleX, _scaleY;
39  int _topBlackBand, _leftBlackBand, _mouseX, _mouseY, _surfaceX, _surfaceY;
40  InteractiveSurface *_sender;
41 public:
43  Action(SDL_Event *ev, double scaleX, double scaleY, int topBlackBand, int leftBlackBand);
45  ~Action();
47  double getXScale() const;
49  double getYScale() const;
51  void setMouseAction(int mouseX, int mouseY, int surfaceX, int surfaceY);
53  bool isMouseAction() const;
55  int getTopBlackBand() const;
57  int getLeftBlackBand() const;
59  int getXMouse() const;
61  int getYMouse() const;
63  double getAbsoluteXMouse() const;
65  double getAbsoluteYMouse() const;
67  double getRelativeXMouse() const;
69  double getRelativeYMouse() const;
73  void setSender(InteractiveSurface *sender);
75  SDL_Event *getDetails() const;
76 };
77 
78 }
79 
80 #endif
int getTopBlackBand() const
Gets the top black band height.
Definition: Action.cpp:87
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
Surface that the user can interact with.
Definition: InteractiveSurface.h:39
~Action()
Cleans up the action.
Definition: Action.cpp:37
SDL_Event * getDetails() const
Gets the details of the action.
Definition: Action.cpp:200
void setSender(InteractiveSurface *sender)
Sets the sender of the action.
Definition: Action.cpp:191
Action(SDL_Event *ev, double scaleX, double scaleY, int topBlackBand, int leftBlackBand)
Creates an action with given event data.
Definition: Action.cpp:33
double getAbsoluteXMouse() const
Gets the mouse's absolute X position.
Definition: Action.cpp:130
double getRelativeXMouse() const
Gets the mouse's relative X position.
Definition: Action.cpp:156
int getYMouse() const
Gets the mouse's Y position.
Definition: Action.cpp:119
InteractiveSurface * getSender() const
Gets the sender of the action.
Definition: Action.cpp:181
double getAbsoluteYMouse() const
Gets the mouse's absolute Y position.
Definition: Action.cpp:143
int getLeftBlackBand() const
Gets the left black band width.
Definition: Action.cpp:97
double getXScale() const
Gets the screen's X scale.
Definition: Action.cpp:46
double getRelativeYMouse() const
Gets the mouse's relative Y position.
Definition: Action.cpp:169
bool isMouseAction() const
Gets if the action is a mouse action.
Definition: Action.cpp:77
void setMouseAction(int mouseX, int mouseY, int surfaceX, int surfaceY)
Sets the action as a mouse action.
Definition: Action.cpp:69
int getXMouse() const
Gets the mouse's X position.
Definition: Action.cpp:108
double getYScale() const
Gets the screen's Y scale.
Definition: Action.cpp:56