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