2015-10-17 16:57:28 +00:00
|
|
|
/* opPanel.cpp
|
2015-10-27 19:07:41 +00:00
|
|
|
* PCSX2 Dev Team
|
2015-10-17 16:57:28 +00:00
|
|
|
* Copyright (C) 2015
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "opPanel.h"
|
|
|
|
#include "ImgHeader/dualshock2.h"
|
|
|
|
#include "ImgHeader/cross.h"
|
|
|
|
#include "ImgHeader/circle.h"
|
|
|
|
#include "ImgHeader/square.h"
|
|
|
|
#include "ImgHeader/triangle.h"
|
|
|
|
#include "ImgHeader/dp_left.h"
|
|
|
|
#include "ImgHeader/dp_right.h"
|
|
|
|
#include "ImgHeader/dp_up.h"
|
|
|
|
#include "ImgHeader/dp_bottom.h"
|
|
|
|
#include "ImgHeader/l1.h"
|
|
|
|
#include "ImgHeader/r1.h"
|
|
|
|
#include "ImgHeader/l2.h"
|
|
|
|
#include "ImgHeader/l3.h"
|
|
|
|
#include "ImgHeader/r2.h"
|
|
|
|
#include "ImgHeader/r3.h"
|
|
|
|
#include "ImgHeader/start.h"
|
|
|
|
#include "ImgHeader/select.h"
|
|
|
|
#include "ImgHeader/analog.h"
|
|
|
|
#include "ImgHeader/joystick_cursor.h"
|
2015-10-27 19:07:41 +00:00
|
|
|
#include "ImgHeader/arrow_up.h"
|
|
|
|
#include "ImgHeader/arrow_right.h"
|
|
|
|
#include "ImgHeader/arrow_bottom.h"
|
|
|
|
#include "ImgHeader/arrow_left.h"
|
2015-10-17 16:57:28 +00:00
|
|
|
|
|
|
|
opPanel::opPanel(wxWindow *parent,
|
2016-09-04 12:10:02 +00:00
|
|
|
wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint &pos = wxDefaultPosition,
|
|
|
|
const wxSize &size = wxDefaultSize)
|
|
|
|
: wxPanel(parent, id, pos, size)
|
2015-10-17 16:57:28 +00:00
|
|
|
{
|
2015-10-27 19:07:41 +00:00
|
|
|
m_picture[img_background] = EmbeddedImage<res_dualshock2>().Get();
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2015-10-27 19:07:41 +00:00
|
|
|
m_picture[img_start] = EmbeddedImage<res_start>().Get();
|
|
|
|
m_picture[img_select] = EmbeddedImage<res_select>().Get();
|
|
|
|
m_picture[img_analog] = EmbeddedImage<res_analog>().Get();
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2015-10-27 19:07:41 +00:00
|
|
|
m_picture[img_dp_left] = EmbeddedImage<res_dp_left>().Get();
|
|
|
|
m_picture[img_dp_right] = EmbeddedImage<res_dp_right>().Get();
|
|
|
|
m_picture[img_dp_up] = EmbeddedImage<res_dp_up>().Get();
|
|
|
|
m_picture[img_dp_bottom] = EmbeddedImage<res_dp_bottom>().Get();
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2015-10-27 19:07:41 +00:00
|
|
|
m_picture[img_square] = EmbeddedImage<res_square>().Get();
|
|
|
|
m_picture[img_circle] = EmbeddedImage<res_circle>().Get();
|
|
|
|
m_picture[img_cross] = EmbeddedImage<res_cross>().Get();
|
|
|
|
m_picture[img_triangle] = EmbeddedImage<res_triangle>().Get();
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2015-10-27 19:07:41 +00:00
|
|
|
m_picture[img_l1] = EmbeddedImage<res_l1>().Get();
|
|
|
|
m_picture[img_l3] = EmbeddedImage<res_l3>().Get();
|
|
|
|
m_picture[img_l2] = EmbeddedImage<res_l2>().Get();
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2015-10-27 19:07:41 +00:00
|
|
|
m_picture[img_r1] = EmbeddedImage<res_r1>().Get();
|
|
|
|
m_picture[img_r3] = EmbeddedImage<res_r3>().Get();
|
|
|
|
m_picture[img_r2] = EmbeddedImage<res_r2>().Get();
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2015-10-27 19:07:41 +00:00
|
|
|
m_picture[img_left_cursor] = EmbeddedImage<res_joystick_cursor>().Get();
|
|
|
|
m_picture[img_right_cursor] = EmbeddedImage<res_joystick_cursor>().Get();
|
|
|
|
|
|
|
|
m_picture[img_l_arrow_up] = EmbeddedImage<res_arrow_up>().Get();
|
|
|
|
m_picture[img_l_arrow_right] = EmbeddedImage<res_arrow_right>().Get();
|
|
|
|
m_picture[img_l_arrow_bottom] = EmbeddedImage<res_arrow_bottom>().Get();
|
|
|
|
m_picture[img_l_arrow_left] = EmbeddedImage<res_arrow_left>().Get();
|
|
|
|
|
|
|
|
m_picture[img_r_arrow_up] = EmbeddedImage<res_arrow_up>().Get();
|
|
|
|
m_picture[img_r_arrow_right] = EmbeddedImage<res_arrow_right>().Get();
|
|
|
|
m_picture[img_r_arrow_bottom] = EmbeddedImage<res_arrow_bottom>().Get();
|
|
|
|
m_picture[img_r_arrow_left] = EmbeddedImage<res_arrow_left>().Get();
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2016-09-04 12:10:02 +00:00
|
|
|
for (int i = 0; i < NB_IMG; ++i) {
|
2015-10-27 19:07:41 +00:00
|
|
|
m_show_image[i] = false;
|
|
|
|
HideImg(i);
|
2015-10-17 16:57:28 +00:00
|
|
|
}
|
2015-10-27 19:07:41 +00:00
|
|
|
ShowImg(img_background);
|
|
|
|
m_show_image[img_background] = true;
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2015-10-27 19:07:41 +00:00
|
|
|
m_left_cursor_x = 0;
|
|
|
|
m_left_cursor_y = 0;
|
|
|
|
m_right_cursor_x = 0;
|
|
|
|
m_right_cursor_y = 0;
|
2015-10-17 16:57:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void opPanel::HideImg(int id)
|
|
|
|
{
|
2016-09-04 12:10:02 +00:00
|
|
|
if (id < NB_IMG) {
|
2015-10-27 19:07:41 +00:00
|
|
|
m_show_image[id] = false;
|
|
|
|
Refresh();
|
|
|
|
}
|
2015-10-17 16:57:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void opPanel::ShowImg(int id)
|
|
|
|
{
|
2016-09-04 12:10:02 +00:00
|
|
|
if (id < NB_IMG) {
|
2015-10-27 19:07:41 +00:00
|
|
|
m_show_image[id] = true;
|
|
|
|
Refresh();
|
|
|
|
}
|
2015-10-17 16:57:28 +00:00
|
|
|
}
|
|
|
|
|
2016-09-04 12:10:02 +00:00
|
|
|
void opPanel::MoveJoystick(int axe, int value)
|
2015-10-17 16:57:28 +00:00
|
|
|
{
|
2016-09-04 12:10:02 +00:00
|
|
|
if (axe == 0) {
|
|
|
|
m_left_cursor_x = value * 30 / 40000;
|
|
|
|
} else if (axe == 1) {
|
|
|
|
m_left_cursor_y = value * 30 / 40000;
|
|
|
|
} else if (axe == 2) {
|
|
|
|
m_right_cursor_x = value * 30 / 40000;
|
|
|
|
} else {
|
|
|
|
m_right_cursor_y = value * 30 / 40000;
|
2015-10-17 16:57:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-12 03:43:47 +00:00
|
|
|
wxBEGIN_EVENT_TABLE(opPanel, wxPanel)
|
2016-09-04 12:10:02 +00:00
|
|
|
EVT_PAINT(opPanel::OnPaint)
|
2019-05-12 03:43:47 +00:00
|
|
|
wxEND_EVENT_TABLE()
|
2015-10-17 16:57:28 +00:00
|
|
|
|
2016-09-04 12:10:02 +00:00
|
|
|
void opPanel::OnPaint(wxPaintEvent &event)
|
2015-10-17 16:57:28 +00:00
|
|
|
{
|
|
|
|
wxPaintDC dc(this);
|
|
|
|
|
|
|
|
wxMemoryDC temp_background, temp_start, temp_select, temp_analog, temp_dp_left,
|
2016-09-04 12:10:02 +00:00
|
|
|
temp_dp_right, temp_dp_up, temp_dp_bottom, temp_l1, temp_r1, temp_L3, temp_l2_2,
|
|
|
|
temp_R3, temp_r2_2, temp_square, temp_circle, temp_cross, temp_triangle,
|
|
|
|
temp_left_cursor, temp_right_cursor, temp_l_arrow_up, temp_l_arrow_right,
|
|
|
|
temp_l_arrow_bottom, temp_l_arrow_left, temp_r_arrow_up, temp_r_arrow_right,
|
|
|
|
temp_r_arrow_bottom, temp_r_arrow_left;
|
2015-10-27 19:07:41 +00:00
|
|
|
|
|
|
|
temp_background.SelectObject(m_picture[img_background]);
|
|
|
|
temp_start.SelectObject(m_picture[img_start]);
|
|
|
|
temp_select.SelectObject(m_picture[img_select]);
|
|
|
|
temp_analog.SelectObject(m_picture[img_analog]);
|
|
|
|
temp_dp_left.SelectObject(m_picture[img_dp_left]);
|
|
|
|
|
|
|
|
temp_dp_right.SelectObject(m_picture[img_dp_right]);
|
|
|
|
temp_dp_up.SelectObject(m_picture[img_dp_up]);
|
|
|
|
temp_dp_bottom.SelectObject(m_picture[img_dp_bottom]);
|
|
|
|
temp_l1.SelectObject(m_picture[img_l1]);
|
|
|
|
temp_r1.SelectObject(m_picture[img_r1]);
|
|
|
|
temp_L3.SelectObject(m_picture[img_l3]);
|
|
|
|
temp_l2_2.SelectObject(m_picture[img_l2]);
|
|
|
|
|
|
|
|
temp_R3.SelectObject(m_picture[img_r3]);
|
|
|
|
temp_r2_2.SelectObject(m_picture[img_r2]);
|
|
|
|
temp_square.SelectObject(m_picture[img_square]);
|
|
|
|
temp_circle.SelectObject(m_picture[img_circle]);
|
|
|
|
temp_cross.SelectObject(m_picture[img_cross]);
|
|
|
|
temp_triangle.SelectObject(m_picture[img_triangle]);
|
|
|
|
|
|
|
|
temp_left_cursor.SelectObject(m_picture[img_left_cursor]);
|
|
|
|
temp_right_cursor.SelectObject(m_picture[img_right_cursor]);
|
|
|
|
|
|
|
|
temp_l_arrow_up.SelectObject(m_picture[img_l_arrow_up]);
|
|
|
|
temp_l_arrow_right.SelectObject(m_picture[img_l_arrow_right]);
|
|
|
|
temp_l_arrow_bottom.SelectObject(m_picture[img_l_arrow_bottom]);
|
|
|
|
temp_l_arrow_left.SelectObject(m_picture[img_l_arrow_left]);
|
|
|
|
|
|
|
|
temp_r_arrow_up.SelectObject(m_picture[img_r_arrow_up]);
|
|
|
|
temp_r_arrow_right.SelectObject(m_picture[img_r_arrow_right]);
|
|
|
|
temp_r_arrow_bottom.SelectObject(m_picture[img_r_arrow_bottom]);
|
|
|
|
temp_r_arrow_left.SelectObject(m_picture[img_r_arrow_left]);
|
|
|
|
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_background])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(0, 0), temp_background.GetSize(), &temp_background, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_start])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(526, 296), temp_start.GetSize(), &temp_start, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_select])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(450, 297), temp_select.GetSize(), &temp_select, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_analog])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(489, 358), temp_analog.GetSize(), &temp_analog, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_dp_left])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(334, 292), temp_dp_left.GetSize(), &temp_dp_left, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_dp_right])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(378, 292), temp_dp_right.GetSize(), &temp_dp_right, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_dp_up])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(358, 269), temp_dp_up.GetSize(), &temp_dp_up, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_dp_bottom])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(358, 312), temp_dp_bottom.GetSize(), &temp_dp_bottom, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_l1])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(343, 186), temp_l1.GetSize(), &temp_l1, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_r1])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(593, 186), temp_r1.GetSize(), &temp_r1, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_l3])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(409, 344), temp_L3.GetSize(), &temp_L3, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_l2])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(346, 158), temp_l2_2.GetSize(), &temp_l2_2, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_r3])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(525, 344), temp_R3.GetSize(), &temp_R3, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_r2])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(582, 158), temp_r2_2.GetSize(), &temp_r2_2, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_square])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(573, 287), temp_square.GetSize(), &temp_square, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_circle])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(647, 287), temp_circle.GetSize(), &temp_circle, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_cross])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(610, 324), temp_cross.GetSize(), &temp_cross, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_triangle])
|
2015-10-17 16:57:28 +00:00
|
|
|
dc.Blit(wxPoint(610, 250), temp_triangle.GetSize(), &temp_triangle, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_left_cursor])
|
|
|
|
dc.Blit(wxPoint(439 + m_left_cursor_x, 374 + m_left_cursor_y), temp_left_cursor.GetSize(), &temp_left_cursor, wxPoint(0, 0), wxCOPY, true);
|
|
|
|
if (m_show_image[img_right_cursor])
|
|
|
|
dc.Blit(wxPoint(555 + m_right_cursor_x, 374 + m_right_cursor_y), temp_right_cursor.GetSize(), &temp_right_cursor, wxPoint(0, 0), wxCOPY, true);
|
2015-10-27 19:07:41 +00:00
|
|
|
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_l_arrow_up])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(433, 357), temp_l_arrow_up.GetSize(), &temp_l_arrow_up, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_l_arrow_right])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(423, 368), temp_l_arrow_right.GetSize(), &temp_l_arrow_right, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_l_arrow_bottom])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(433, 357), temp_l_arrow_bottom.GetSize(), &temp_l_arrow_bottom, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_l_arrow_left])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(423, 368), temp_l_arrow_left.GetSize(), &temp_l_arrow_left, wxPoint(0, 0), wxCOPY, true);
|
|
|
|
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_r_arrow_up])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(548, 357), temp_r_arrow_up.GetSize(), &temp_r_arrow_up, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_r_arrow_right])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(539, 368), temp_r_arrow_right.GetSize(), &temp_r_arrow_right, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_r_arrow_bottom])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(548, 357), temp_r_arrow_bottom.GetSize(), &temp_r_arrow_bottom, wxPoint(0, 0), wxCOPY, true);
|
2016-09-04 12:10:02 +00:00
|
|
|
if (m_show_image[img_r_arrow_left])
|
2015-10-27 19:07:41 +00:00
|
|
|
dc.Blit(wxPoint(539, 368), temp_r_arrow_left.GetSize(), &temp_r_arrow_left, wxPoint(0, 0), wxCOPY, true);
|
2015-10-17 16:57:28 +00:00
|
|
|
}
|