BruteDialog.hpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * This file is part of XDRE.
  3. *
  4. * XDRE is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * XDRE is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with XDRE. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. * Этот файл — часть XDRE.
  18. *
  19. * XDRE — свободная программа: вы можете перераспространять её и/или
  20. * изменять её на условиях Стандартной общественной лицензии GNU в том виде,
  21. * в каком она была опубликована Фондом свободного программного обеспечения;
  22. * либо версии 2 лицензии, либо (по вашему выбору) любой более поздней
  23. * версии.
  24. *
  25. * XDRE распространяется в надежде, что она будет полезной,
  26. * но БЕЗО ВСЯКИХ ГАРАНТИЙ; даже без неявной гарантии ТОВАРНОГО ВИДА
  27. * или ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробнее см. в Стандартной
  28. * общественной лицензии GNU.
  29. *
  30. * Вы должны были получить копию Стандартной общественной лицензии GNU
  31. * вместе с этой программой. Если это не так, см.
  32. * <http://www.gnu.org/licenses/>.
  33. *
  34. * Description: brute force dialog declarations.
  35. */
  36. #ifndef __BRUTEDIALOG_HPP
  37. #define __BRUTEDIALOG_HPP
  38. #include <wx/stattext.h>
  39. #include <wx/radiobox.h>
  40. #include <wx/textctrl.h>
  41. #include <wx/checkbox.h>
  42. #include <wx/listbox.h>
  43. #include <wx/statbox.h>
  44. #include <wx/panel.h>
  45. #include <wx/choice.h>
  46. #include <wx/button.h>
  47. #include <wx/dialog.h>
  48. #include <wx/thread.h>
  49. #include "xdre.hpp"
  50. wxDECLARE_EVENT(EVT_BRUTE_DONE, wxThreadEvent);
  51. class BruteDialog: public wxDialog, public wxThreadHelper {
  52. public:
  53. BruteDialog(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
  54. virtual ~BruteDialog();
  55. wxPanel* p;
  56. wxStaticText *StaticText1, *StaticText2, *StaticText3, *StaticText4, *workingText;
  57. wxCheckBox *rngCheckBox, *damageCheckBox, *xPosCheckBox, *yPosCheckBox, *zPosCheckBox, *xMomCheckBox, *yMomCheckBox, *speedCheckBox, *useCheckBox;
  58. wxChoice *rngChoice, *damageChoice, *xPosChoice, *yPosChoice, *zPosChoice, *xMomChoice, *yMomChoice, *speedChoice;
  59. wxTextCtrl *rngInput, *damageInput, *xPosInput, *yPosInput, *zPosInput, *xMomInput, *yMomInput, *speedInput, *runCmdInput, *strafeCmdInput, *turnCmdInput, *bruteTicInput, *checkTicInput;
  60. wxButton *start, *cancel, *addButton, *removeButton, *turnAngleButton;
  61. wxRadioBox *fireRadioBox, *useRadioBox;
  62. wxStaticBox *StaticBox1, *StaticBox2;
  63. wxListBox* bruteTicsBox;
  64. void OnBruteDone(wxThreadEvent& event);
  65. protected:
  66. static const long ID_BRUTETICSBOX, ID_BRUTETICINPUT, ID_STRAFECMDINPUT, ID_RUNCMDINPUT, ID_TURNCMDINPUT, ID_TURNANGLEBUTTON, ID_FIRERADIOBOX, ID_USERADIOBOX, ID_CANCEL, ID_START,
  67. ID_ADDBUTTON, ID_REMOVEBUTTON;
  68. virtual wxThread::ExitCode Entry();
  69. private:
  70. struct ListItem {
  71. wxString ticStr {"0"};
  72. wxString runStr {"0"};
  73. wxString strafeStr {"0"};
  74. wxString turnStr {"0"};
  75. int fire {0};
  76. int use {0};
  77. int turnOrAngle {0};
  78. };
  79. std::vector<ListItem> items;
  80. std::vector<BruteTic> bruteTics;
  81. BruteCheck bruteCheck;
  82. bool abortBrute {false};
  83. bool bruteSuccess {false};
  84. wxString turnAngleTexts[2] {"Turn cmds", "Angles"};
  85. // "," separates numbers, ":" separates start and end of range
  86. std::vector<signed char> ParseCmds(wxString str, bool parseAsUnsigned = false);
  87. std::vector<BruteTic> CreateBruteTics();
  88. BruteCheck CreateBruteCheck();
  89. void ShowData(int n);
  90. void EnableStuff();
  91. void DisableStuff();
  92. void OnClose(wxCloseEvent& event);
  93. void OnCancelClick(wxCommandEvent& event);
  94. void OnTurnAngleButtonClick(wxCommandEvent& event);
  95. void OnAddButtonClick(wxCommandEvent& event);
  96. void OnRemoveButtonClick(wxCommandEvent& event);
  97. void OnBruteTicsBoxSelect(wxCommandEvent& event);
  98. void OnBruteTicInputText(wxCommandEvent& event);
  99. void OnRunCmdInputText(wxCommandEvent& event);
  100. void OnStrafeCmdInputText(wxCommandEvent& event);
  101. void OnTurnCmdInputText(wxCommandEvent& event);
  102. void OnFireRadioBoxSelect(wxCommandEvent& event);
  103. void OnUseRadioBoxSelect(wxCommandEvent& event);
  104. void OnStartClick(wxCommandEvent& event);
  105. DECLARE_EVENT_TABLE()
  106. };
  107. #endif //__BRUTEDIALOG_HPP