/*
** input.h
**
** This file is part of mkxp.
**
** Copyright (C) 2013 Jonas Kulla <Nyocurio@gmail.com>
**
** mkxp 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.
**
** mkxp 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 mkxp.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <vector>

#ifndef INPUT_H
#define INPUT_H

struct InputPrivate;
struct RGSSThreadData;
struct SourceDesc;

class Input{
public:
	enum ButtonCode{
		None = 0,

		Down = 2, Left = 4, Right = 6, Up = 8,

		Action = 11,
		Cancel = 12,
		Menu = 13,
		Items = 14,
		Run = 15,
		Deactivate = 16,

		L = 17, R = 18,

		F5 = 25, F6 = 26, F7 = 27, F8 = 28, F9 = 29,

		/* Non-standard extensions */
		MouseLeft = 38, MouseMiddle = 39, MouseRight = 40,

		DebugAction = 41
	};

	void update();

	bool isPressed(int button);
	bool isTriggered(int button);
	bool isRepeated(int button);

	int dir4Value();
	int dir8Value();

	/* Non-standard extensions */
	int mouseX();
	int mouseY();

	void setBinding(std::vector<SourceDesc> descs, Input::ButtonCode target);

	// more non-standard extensions
	float wheelX();
	float wheelY();
	bool wheelFlipped();

	bool hasQuit();

private:
	Input(const RGSSThreadData &rtData);
	~Input();

	friend struct SharedStatePrivate;

	InputPrivate *p;
};

#endif // INPUT_H
