dolphin/Source/Core/DolphinWX/TASInputDlg.h

126 lines
3.8 KiB
C
Raw Normal View History

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
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>
#include "Common/CommonTypes.h"
2014-09-15 03:42:32 +00:00
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "InputCommon/GCPadStatus.h"
2014-02-22 22:36:30 +00:00
class wxCheckBox;
class wxSlider;
class wxStaticBitmap;
class wxTextCtrl;
class wxWindow;
class TASInputDlg : public wxDialog
{
public:
TASInputDlg(wxWindow* parent,
wxWindowID id = wxID_ANY,
2014-09-15 03:42:32 +00:00
const wxString& title = _("TAS Input"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE | wxSTAY_ON_TOP);
void OnCloseWindow(wxCloseEvent& event);
void UpdateFromSliders(wxCommandEvent& event);
void UpdateFromText(wxCommandEvent& event);
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);
void ResetValues();
2014-09-15 03:42:32 +00:00
void GetValues(GCPadStatus* PadStatus);
2014-10-31 08:34:30 +00:00
void GetValues(u8* data, WiimoteEmu::ReportFeatures rptf, int ext, const wiimote_key key);
2012-05-26 06:09:50 +00:00
void SetTurbo(wxMouseEvent& event);
void SetTurboFalse(wxMouseEvent& event);
2014-10-31 08:34:30 +00:00
void SetTurboState(wxCheckBox* CheckBox, bool* turbo_on);
2012-05-26 06:09:50 +00:00
void ButtonTurbo();
void GetKeyBoardInput(GCPadStatus* PadStatus);
2014-10-31 08:34:30 +00:00
void GetKeyBoardInput(u8* data, WiimoteEmu::ReportFeatures rptf, int ext, const wiimote_key key);
bool TextBoxHasFocus();
void SetLandRTriggers();
bool TASHasFocus();
2014-09-15 03:42:32 +00:00
void CreateGCLayout();
2014-10-31 08:34:30 +00:00
void CreateWiiLayout(int num);
2012-01-22 00:39:17 +00:00
wxBitmap CreateStickBitmap(int x, int y);
void SetWiiButtons(u16* butt);
2014-09-15 03:42:32 +00:00
void GetIRData(u8* const data, u8 mode, bool use_accel);
2012-01-22 00:39:17 +00:00
private:
const int ID_C_STICK = 1001;
const int ID_MAIN_STICK = 1002;
int m_eleID = 1003;
2014-09-15 03:42:32 +00:00
struct Control
{
wxTextCtrl* text;
wxSlider* slider;
2014-09-15 03:42:32 +00:00
int value = -1;
int text_id;
int slider_id;
2014-09-15 03:42:32 +00:00
u32 range;
u32 default_value = 128;
bool set_by_keyboard = false;
2014-10-31 08:34:30 +00:00
bool reverse = false;
2014-09-15 03:42:32 +00:00
};
2014-09-15 03:42:32 +00:00
struct Button
{
wxCheckBox* checkbox;
bool set_by_keyboard = false;
bool turbo_on = false;
int id;
};
2014-09-15 03:42:32 +00:00
struct Stick
{
wxStaticBitmap* bitmap;
Control x_cont;
Control y_cont;
2014-09-15 03:42:32 +00:00
};
void SetStickValue(bool* ActivatedByKeyboard, int* AmountPressed, wxTextCtrl* Textbox, int CurrentValue, int center = 128);
void SetButtonValue(Button* button, bool CurrentState);
2014-10-31 08:34:30 +00:00
void SetSliderValue(Control* control, int CurrentValue, int default_value = 128);
void CreateBaseLayout();
Stick CreateStick(int id_stick, int xRange, int yRange, u32 defaultX, u32 defaultY, bool reverseX, bool reverseY);
wxStaticBoxSizer* CreateStickLayout(Stick* tempStick, const wxString& title);
2014-10-31 08:34:30 +00:00
wxStaticBoxSizer* CreateAccelLayout(Control* x, Control* y, Control* z, const wxString& title);
2014-09-15 03:42:32 +00:00
Button CreateButton(const std::string& name);
2014-10-31 08:34:30 +00:00
Control CreateControl(long style, int width, int height, bool reverse = false, u32 range = 255, u32 default_value = 128);
2014-09-15 03:42:32 +00:00
2014-10-31 08:34:30 +00:00
Control m_l_cont, m_r_cont, m_x_cont, m_y_cont, m_z_cont, m_nx_cont, m_ny_cont, m_nz_cont;
Button m_a, m_b, m_x, m_y, m_z, m_l, m_r, m_c;
Button m_start, m_plus, m_minus, m_one, m_two, m_home;
Button m_dpad_up, m_dpad_down, m_dpad_left, m_dpad_right;
Stick m_main_stick, m_c_stick;
2014-09-15 03:42:32 +00:00
Button* m_buttons[14];
Control* m_controls[10];
static const int m_gc_pad_buttons_bitmask[12];
static const int m_wii_buttons_bitmask[13];
2014-10-31 08:34:30 +00:00
u8 m_ext = 0;
wxBoxSizer* m_main_szr;
wxBoxSizer* m_wiimote_szr;
wxBoxSizer* m_ext_szr;
wxStaticBoxSizer* m_main_stick_szr;
wxStaticBoxSizer* m_c_stick_szr;
2014-09-15 03:42:32 +00:00
bool m_has_layout = false;
2014-09-15 03:42:32 +00:00
wxGridSizer* const m_buttons_dpad = new wxGridSizer(3);
};