2012-04-30 09:27:12 +10:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
2012-05-14 07:43:50 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on original Tony Tough source code
|
|
|
|
*
|
|
|
|
* Copyright (c) 1997-2003 Nayma Software
|
|
|
|
*/
|
2012-04-30 09:27:12 +10:00
|
|
|
|
|
|
|
#ifndef TONY_INPUT_H
|
|
|
|
#define TONY_INPUT_H
|
|
|
|
|
2012-05-06 16:39:42 +10:00
|
|
|
#include "common/events.h"
|
2012-04-30 09:27:12 +10:00
|
|
|
#include "tony/utils.h"
|
|
|
|
|
|
|
|
namespace Tony {
|
|
|
|
|
|
|
|
class RMInput {
|
|
|
|
private:
|
2012-05-06 16:39:42 +10:00
|
|
|
Common::Event _event;
|
2012-04-30 09:27:12 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
// Mouse related fields
|
|
|
|
RMPoint _mousePos;
|
2012-05-06 16:39:42 +10:00
|
|
|
bool _clampMouse;
|
|
|
|
bool _leftButton, _rightButton;
|
|
|
|
bool _leftClickMouse, _leftReleaseMouse, _rightClickMouse, _rightReleaseMouse;
|
2012-04-30 09:27:12 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
// Keyboard related fields
|
|
|
|
bool _keyDown[350];
|
2012-04-30 09:27:12 +10:00
|
|
|
private:
|
2012-06-12 00:07:50 +02:00
|
|
|
// Deinitialize DirectInput
|
2012-04-30 09:27:12 +10:00
|
|
|
void DIClose(void);
|
2012-05-14 21:29:27 +02:00
|
|
|
|
2012-04-30 09:27:12 +10:00
|
|
|
public:
|
|
|
|
RMInput();
|
|
|
|
~RMInput();
|
|
|
|
|
|
|
|
// Class initialisation
|
2012-06-05 00:02:15 +02:00
|
|
|
void init(/*uint32 hInst*/);
|
2012-04-30 09:27:12 +10:00
|
|
|
|
|
|
|
// Closes the class
|
2012-06-05 00:02:15 +02:00
|
|
|
void close(void);
|
2012-04-30 09:27:12 +10:00
|
|
|
|
|
|
|
// Polling (must be performed once per frame)
|
2012-06-05 00:02:15 +02:00
|
|
|
void poll(void);
|
2012-04-30 09:27:12 +10:00
|
|
|
|
|
|
|
// Reading of the mouse
|
2012-06-05 00:02:15 +02:00
|
|
|
RMPoint mousePos() {
|
2012-05-14 21:29:27 +02:00
|
|
|
return _mousePos;
|
|
|
|
}
|
2012-04-30 09:27:12 +10:00
|
|
|
|
|
|
|
// Current status of the mouse buttons
|
2012-06-05 00:02:15 +02:00
|
|
|
bool mouseLeft();
|
|
|
|
bool mouseRight();
|
2012-04-30 09:27:12 +10:00
|
|
|
|
|
|
|
// Events of mouse clicks
|
2012-06-05 00:02:15 +02:00
|
|
|
bool mouseLeftClicked() {
|
2012-05-14 21:29:27 +02:00
|
|
|
return _leftClickMouse;
|
|
|
|
}
|
2012-06-05 00:02:15 +02:00
|
|
|
bool mouseRightClicked() {
|
2012-05-14 21:29:27 +02:00
|
|
|
return _rightClickMouse;
|
|
|
|
}
|
2012-06-05 00:02:15 +02:00
|
|
|
bool mouseBothClicked() {
|
2012-05-14 21:29:27 +02:00
|
|
|
return _leftClickMouse && _rightClickMouse;
|
|
|
|
}
|
2012-06-05 00:02:15 +02:00
|
|
|
bool mouseLeftReleased() {
|
2012-05-14 21:29:27 +02:00
|
|
|
return _leftReleaseMouse;
|
|
|
|
}
|
2012-06-05 00:02:15 +02:00
|
|
|
bool mouseRightReleased() {
|
2012-05-14 21:29:27 +02:00
|
|
|
return _rightReleaseMouse;
|
|
|
|
}
|
2012-06-05 00:02:15 +02:00
|
|
|
bool mouseBothReleased() {
|
2012-05-14 21:29:27 +02:00
|
|
|
return _leftReleaseMouse && _rightReleaseMouse;
|
|
|
|
}
|
2012-04-30 09:27:12 +10:00
|
|
|
|
2012-05-12 20:49:36 +10:00
|
|
|
// Returns true if the given key is pressed
|
2012-06-05 00:02:15 +02:00
|
|
|
bool getAsyncKeyState(Common::KeyCode kc);
|
2012-04-30 09:27:12 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Tony
|
|
|
|
|
|
|
|
#endif
|