2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/dcmemory.h>
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/gdicmn.h>
|
2014-09-15 03:42:32 +00:00
|
|
|
#include <wx/sizer.h>
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/toplevel.h>
|
|
|
|
#include <wx/translation.h>
|
|
|
|
#include <wx/windowid.h>
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-09-15 03:42:32 +00:00
|
|
|
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "InputCommon/GCPadStatus.h"
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
class wxCheckBox;
|
|
|
|
class wxSlider;
|
|
|
|
class wxStaticBitmap;
|
|
|
|
class wxTextCtrl;
|
|
|
|
class wxWindow;
|
|
|
|
|
2011-06-27 19:44:27 +00:00
|
|
|
class TASInputDlg : public wxDialog
|
|
|
|
{
|
|
|
|
public:
|
2014-08-13 21:42:11 +00:00
|
|
|
TASInputDlg(wxWindow* parent,
|
2014-09-15 03:42:32 +00:00
|
|
|
wxWindowID id = 1,
|
|
|
|
const wxString& title = _("TAS Input"),
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP);
|
2011-06-27 19:44:27 +00:00
|
|
|
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
|
|
|
void UpdateFromSliders(wxCommandEvent& event);
|
|
|
|
void UpdateFromText(wxCommandEvent& event);
|
2013-06-25 15:04:28 +00:00
|
|
|
void OnMouseDownL(wxMouseEvent& event);
|
2012-01-22 00:39:17 +00:00
|
|
|
void OnMouseUpR(wxMouseEvent& event);
|
2014-09-15 03:42:32 +00:00
|
|
|
void OnRightClickSlider(wxMouseEvent& event);
|
2011-06-27 19:44:27 +00:00
|
|
|
void ResetValues();
|
2014-09-15 03:42:32 +00:00
|
|
|
void GetValues(GCPadStatus* PadStatus);
|
|
|
|
void GetValues(u8* data, WiimoteEmu::ReportFeatures rptf);
|
2012-05-26 06:09:50 +00:00
|
|
|
void SetTurbo(wxMouseEvent& event);
|
|
|
|
void SetTurboFalse(wxMouseEvent& event);
|
2014-09-15 03:42:32 +00:00
|
|
|
void SetTurboState(wxCheckBox* CheckBox, bool* TurboOn);
|
2012-05-26 06:09:50 +00:00
|
|
|
void ButtonTurbo();
|
2014-07-11 02:02:32 +00:00
|
|
|
void GetKeyBoardInput(GCPadStatus* PadStatus);
|
2014-09-15 03:42:32 +00:00
|
|
|
void GetKeyBoardInput(u8* data, WiimoteEmu::ReportFeatures rptf);
|
2012-12-23 19:01:44 +00:00
|
|
|
bool TextBoxHasFocus();
|
2013-07-23 23:24:05 +00:00
|
|
|
void SetLandRTriggers();
|
2013-08-29 05:33:24 +00:00
|
|
|
bool TASHasFocus();
|
2014-09-15 03:42:32 +00:00
|
|
|
void CreateGCLayout();
|
|
|
|
void CreateWiiLayout();
|
2012-01-22 00:39:17 +00:00
|
|
|
wxBitmap CreateStickBitmap(int x, int y);
|
2014-09-15 03:42:32 +00:00
|
|
|
void SetWiiButtons(wm_core* butt);
|
|
|
|
void GetIRData(u8* const data, u8 mode, bool use_accel);
|
2012-01-22 00:39:17 +00:00
|
|
|
|
2011-06-27 19:44:27 +00:00
|
|
|
private:
|
2014-09-15 03:42:32 +00:00
|
|
|
const int ID_C_STICK = 1001;
|
|
|
|
const int ID_MAIN_STICK = 1002;
|
|
|
|
int eleID = 1003;
|
|
|
|
|
|
|
|
struct Control
|
|
|
|
{
|
|
|
|
wxTextCtrl* Text;
|
|
|
|
wxSlider* Slider;
|
|
|
|
int value = -1;
|
|
|
|
int Text_ID;
|
|
|
|
int Slider_ID;
|
|
|
|
u32 range;
|
|
|
|
u32 defaultValue = 128;
|
|
|
|
bool SetByKeyboard = false;
|
|
|
|
};
|
2011-06-27 19:44:27 +00:00
|
|
|
|
2014-09-15 03:42:32 +00:00
|
|
|
struct Button
|
2011-06-27 19:44:27 +00:00
|
|
|
{
|
2014-09-15 03:42:32 +00:00
|
|
|
wxCheckBox* Checkbox;
|
|
|
|
bool SetByKeyboard = false;
|
|
|
|
bool TurboOn = false;
|
|
|
|
int ID;
|
2011-06-27 19:44:27 +00:00
|
|
|
};
|
|
|
|
|
2014-09-15 03:42:32 +00:00
|
|
|
struct Stick
|
|
|
|
{
|
|
|
|
wxStaticBitmap* bitmap;
|
|
|
|
Control xCont;
|
|
|
|
Control yCont;
|
|
|
|
};
|
|
|
|
|
|
|
|
void SetStickValue(bool* ActivatedByKeyboard, int* AmountPressed, wxTextCtrl* Textbox, int CurrentValue, int center = 128);
|
|
|
|
void SetButtonValue(Button* button, bool CurrentState);
|
|
|
|
void SetSliderValue(Control* control, int CurrentValue, int defaultValue = 128);
|
|
|
|
Stick CreateStick(int id_stick);
|
|
|
|
wxStaticBoxSizer* CreateStickLayout(Stick* tempStick, std::string title);
|
|
|
|
Button CreateButton(const std::string& name);
|
|
|
|
Control CreateControl(long style, int width, int height, u32 range = 255);
|
|
|
|
|
|
|
|
Control lCont, rCont, xCont, yCont, zCont;
|
|
|
|
Button A, B, X, Y, Z, L, R, C, START, PLUS, MINUS, ONE, TWO, HOME, dpad_up, dpad_down, dpad_left, dpad_right;
|
|
|
|
Stick MainStick, CStick;
|
|
|
|
|
|
|
|
Button* Buttons[14];
|
|
|
|
Control* Controls[10];
|
|
|
|
static const int GCPadButtonsBitmask[12];
|
|
|
|
static const int WiiButtonsBitmask[13];
|
|
|
|
|
|
|
|
bool hasLayout = false;
|
|
|
|
bool isWii = false;
|
|
|
|
|
|
|
|
wxGridSizer* const buttons_dpad = new wxGridSizer(3);
|
2013-04-08 05:16:50 +00:00
|
|
|
|
2011-06-27 19:44:27 +00:00
|
|
|
DECLARE_EVENT_TABLE();
|
|
|
|
};
|