diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..5019ab7 --- /dev/null +++ b/.clang-format @@ -0,0 +1,5 @@ +BreakBeforeBraces: Attach +IndentWidth: 4 +PointerAlignment: Left +AllowShortFunctionsOnASingleLine: Inline +AccessModifierOffset: -4 \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..fe4c888 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${default}" + ], + "defines": [], + "compilerPath": "/usr/bin/clang", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "linux-clang-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index d259df9..d2b3b7f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -75,6 +75,10 @@ "thread": "cpp", "typeinfo": "cpp", "variant": "cpp", - "*.xpm": "cpp" - } + "*.xpm": "cpp", + "cfenv": "cpp", + "charconv": "cpp", + "shared_mutex": "cpp" + }, + "C_Cpp.default.cppStandard": "c++20" } diff --git a/AboutDlg.cpp b/AboutDlg.cpp index 8edd169..ec8d251 100644 --- a/AboutDlg.cpp +++ b/AboutDlg.cpp @@ -1,5 +1,4 @@ #include "AboutDlg.h" -AboutDlg::AboutDlg(wxWindow *parent, wxWindowID id) : wxDialog::wxDialog(parent, id, _("О программе")) -{ -} +AboutDlg::AboutDlg(wxWindow* parent, wxWindowID id) + : wxDialog::wxDialog(parent, id, _("О программе")) {} diff --git a/AboutDlg.h b/AboutDlg.h index 030b5ff..ebf2f25 100644 --- a/AboutDlg.h +++ b/AboutDlg.h @@ -3,10 +3,9 @@ #include "wxw.h" -class AboutDlg : public wxDialog -{ +class AboutDlg : public wxDialog { public: - AboutDlg(wxWindow *parent, wxWindowID id); + AboutDlg(wxWindow* parent, wxWindowID id); }; #endif diff --git a/App.cpp b/App.cpp index a1e2c38..63c079e 100644 --- a/App.cpp +++ b/App.cpp @@ -3,13 +3,12 @@ wxIMPLEMENT_APP(MyApp); -bool MyApp::OnInit() -{ +bool MyApp::OnInit() { wxImage::AddHandler(new wxPNGHandler()); - MainFrame *frame = new MainFrame(); + MainFrame* frame = new MainFrame(); frame->Show(true); SetTopWindow(frame); - + return true; } diff --git a/App.h b/App.h index fdd2a56..656fcfe 100644 --- a/App.h +++ b/App.h @@ -3,8 +3,7 @@ #include "wxw.h" -class MyApp : public wxApp -{ +class MyApp : public wxApp { public: virtual bool OnInit() override; }; diff --git a/HelpDlg.cpp b/HelpDlg.cpp index afe4d20..4a2ab1a 100644 --- a/HelpDlg.cpp +++ b/HelpDlg.cpp @@ -1,5 +1,5 @@ #include "HelpDlg.h" -HelpDlg::HelpDlg(wxWindow *parent, wxWindowID id) : wxDialog::wxDialog(parent, id, _("Инструкция по использованию программы")) -{ -} +HelpDlg::HelpDlg(wxWindow* parent, wxWindowID id) + : wxDialog::wxDialog(parent, id, + _("Инструкция по использованию программы")) {} diff --git a/HelpDlg.h b/HelpDlg.h index a1849cc..3fd6bac 100644 --- a/HelpDlg.h +++ b/HelpDlg.h @@ -3,10 +3,9 @@ #include "wxw.h" -class HelpDlg : public wxDialog -{ +class HelpDlg : public wxDialog { public: - HelpDlg(wxWindow *parent, wxWindowID id); + HelpDlg(wxWindow* parent, wxWindowID id); }; #endif diff --git a/MainFrame.h b/MainFrame.h index c536238..4b7e055 100644 --- a/MainFrame.h +++ b/MainFrame.h @@ -5,12 +5,10 @@ #include "GamePanel.h" -#include #include +#include -/// @uml{style[#line.dotted:blue]} -class MainFrame : public wxFrame -{ +class MainFrame : public wxFrame { public: MainFrame(); @@ -18,18 +16,18 @@ private: void initMenu(); void bindMenu(); - GamePanel *panel; + GamePanel* panel; bool openLayout(); const wxString dataDirPath; wxString layoutPath; - bool solveable = false; // determites wether to generate solveable or completely random map + bool solveable = false; // determites wether to generate solveable or + // completely random map }; -enum -{ +enum { IDM_Open = wxID_OPEN, IDM_Exit = wxID_EXIT, IDM_Help = wxID_HELP, diff --git a/RulesDlg.cpp b/RulesDlg.cpp index e340878..b1f74e3 100644 --- a/RulesDlg.cpp +++ b/RulesDlg.cpp @@ -1,5 +1,4 @@ #include "RulesDlg.h" -RulesDlg::RulesDlg(wxWindow *parent, wxWindowID id) : wxDialog::wxDialog(parent, id, _("Правила игры")) -{ -} +RulesDlg::RulesDlg(wxWindow* parent, wxWindowID id) + : wxDialog::wxDialog(parent, id, _("Правила игры")) {} diff --git a/RulesDlg.h b/RulesDlg.h index d643580..a53ceaf 100644 --- a/RulesDlg.h +++ b/RulesDlg.h @@ -3,10 +3,9 @@ #include "wxw.h" -class RulesDlg : public wxDialog -{ +class RulesDlg : public wxDialog { public: - RulesDlg(wxWindow *parent, wxWindowID id); + RulesDlg(wxWindow* parent, wxWindowID id); }; #endif diff --git a/XmlLayout.cpp b/XmlLayout.cpp index 283bc99..96c2f72 100644 --- a/XmlLayout.cpp +++ b/XmlLayout.cpp @@ -1,6 +1,6 @@ #include "XmlLayout.h" -XmlLayout::XmlLayout() : path("") { } +XmlLayout::XmlLayout() : path("") {} bool XmlLayout::openFile(const wxString& openPath) { if (openPath.IsSameAs(path)) @@ -16,9 +16,9 @@ bool XmlLayout::openFile(const wxString& openPath) { } Dimensions XmlLayout::getDimensions() { - return { wxAtoi(layoutDoc.GetRoot()->GetAttribute("layers")), + return {wxAtoi(layoutDoc.GetRoot()->GetAttribute("layers")), wxAtoi(layoutDoc.GetRoot()->GetAttribute("ux")) + 2, - wxAtoi(layoutDoc.GetRoot()->GetAttribute("uy")) + 2 }; + wxAtoi(layoutDoc.GetRoot()->GetAttribute("uy")) + 2}; } void XmlLayout::readLayout(TLVec& table) { diff --git a/wxw.h b/wxw.h index 549eb97..0fc15a3 100644 --- a/wxw.h +++ b/wxw.h @@ -12,20 +12,4 @@ #endif #define _(s) wxString::FromUTF8(s) -// class wxTrackable {}; -// class wxObject {}; -// class wxEventHandler : wxObject, wxTrackable {}; -// class wxEventFilter {}; -// class wxAppConsole : wxEventHandler, wxEventFilter {}; -// class wxApp : wxAppConsole {}; - -// class wxWindow : wxEventHandler {}; -// class wxNotOwnedWindow : wxWindow {}; -// class wxTopLevelWindow : wxNotOwnedWindow {}; -// class wxFrame : wxTopLevelWindow {}; - -// class wxCommandEvent {}; - -// #define DECLARE_EVENT_TABLE() void none(); - #endif