diff options
-rw-r--r-- | .codelite/.tern-port | 2 | ||||
-rw-r--r-- | .codelite/PSP.session | 16 | ||||
-rw-r--r-- | .codelite/PSP.tags | bin | 80476160 -> 80476160 bytes | |||
-rw-r--r-- | .codelite/compilation.db | bin | 24576 -> 24576 bytes | |||
-rw-r--r-- | .codelite/compile_commands.json | 16 | ||||
-rw-r--r-- | .codelite/refactoring.db | bin | 505856 -> 505856 bytes | |||
-rw-r--r-- | Project/Bus.cpp | 29 | ||||
-rw-r--r-- | Project/Line.cpp | 1 | ||||
-rw-r--r-- | Project/Project.mk | 7 | ||||
-rw-r--r-- | Project/Release/Bus.cpp.o | bin | 26831 -> 27137 bytes | |||
-rw-r--r-- | Project/Release/PSP-UFU.exe | bin | 3286235 -> 3286539 bytes | |||
-rw-r--r-- | Project/Release/Workspace.cpp.o | bin | 113659 -> 113675 bytes | |||
-rw-r--r-- | Project/Workspace.cpp | 6 |
13 files changed, 44 insertions, 33 deletions
diff --git a/.codelite/.tern-port b/.codelite/.tern-port index ee24d02..357baad 100644 --- a/.codelite/.tern-port +++ b/.codelite/.tern-port @@ -1 +1 @@ -49426
\ No newline at end of file +54323
\ No newline at end of file diff --git a/.codelite/PSP.session b/.codelite/PSP.session index 813d84b..34afdab 100644 --- a/.codelite/PSP.session +++ b/.codelite/PSP.session @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <Session Name="C:\Users\Thales\Documents\GitHub\PSP\PSP.workspace"> - <int Value="7" Name="m_selectedTab"/> + <int Value="2" Name="m_selectedTab"/> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\PSP.workspace" Name="m_workspaceName"/> <TabInfoArray Name="TabInfoArray"> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Workspace.cpp" Name="FileName"/> - <int Value="364" Name="FirstVisibleLine"/> - <int Value="400" Name="CurrentLine"/> + <int Value="513" Name="FirstVisibleLine"/> + <int Value="494" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> @@ -19,8 +19,8 @@ </TabInfo> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Bus.cpp" Name="FileName"/> - <int Value="132" Name="FirstVisibleLine"/> - <int Value="156" Name="CurrentLine"/> + <int Value="60" Name="FirstVisibleLine"/> + <int Value="87" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> @@ -54,14 +54,14 @@ </TabInfo> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\Line.cpp" Name="FileName"/> - <int Value="154" Name="FirstVisibleLine"/> - <int Value="167" Name="CurrentLine"/> + <int Value="304" Name="FirstVisibleLine"/> + <int Value="334" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> </TabInfo> <TabInfo> <wxString Value="C:\Users\Thales\Documents\GitHub\PSP\Project\MainFrame.cpp" Name="FileName"/> - <int Value="170" Name="FirstVisibleLine"/> + <int Value="161" Name="FirstVisibleLine"/> <int Value="0" Name="CurrentLine"/> <wxArrayString Name="Bookmarks"/> <IntVector Name="CollapsedFolds"/> diff --git a/.codelite/PSP.tags b/.codelite/PSP.tags Binary files differindex c7fb837..2ee8699 100644 --- a/.codelite/PSP.tags +++ b/.codelite/PSP.tags diff --git a/.codelite/compilation.db b/.codelite/compilation.db Binary files differindex f81d5fe..7d1ba60 100644 --- a/.codelite/compilation.db +++ b/.codelite/compilation.db diff --git a/.codelite/compile_commands.json b/.codelite/compile_commands.json index c182189..c4e61b3 100644 --- a/.codelite/compile_commands.json +++ b/.codelite/compile_commands.json @@ -1,17 +1,9 @@ [{ "directory": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project", - "command": "C:/TDM-GCC-64/bin/g++.exe -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -I. -I. -MG -MP -MT./Release/Workspace.cpp.o -MF./Release/Workspace.cpp.o.d -MM Workspace.cpp", - "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\Workspace.cpp" + "command": "C:/TDM-GCC-64/bin/g++.exe -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -I. -I. -MG -MP -MT./Release/Bus.cpp.o -MF./Release/Bus.cpp.o.d -MM Bus.cpp", + "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\Bus.cpp" }, { "directory": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project", - "command": "C:/TDM-GCC-64/bin/g++.exe -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -I. -I. -MG -MP -MT./Release/Line.cpp.o -MF./Release/Line.cpp.o.d -MM Line.cpp", - "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\Line.cpp" - }, { - "directory": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project", - "command": "C:/TDM-GCC-64/bin/g++.exe -c C:/Users/Thales/Documents/GitHub/PSP/Project/Line.cpp -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -o ./Release/Line.cpp.o -I. -I.", - "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\Line.cpp" - }, { - "directory": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project", - "command": "C:/TDM-GCC-64/bin/g++.exe -c C:/Users/Thales/Documents/GitHub/PSP/Project/Workspace.cpp -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -o ./Release/Workspace.cpp.o -I. -I.", - "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\Workspace.cpp" + "command": "C:/TDM-GCC-64/bin/g++.exe -c C:/Users/Thales/Documents/GitHub/PSP/Project/Bus.cpp -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:/wxWidgets-3.1.0/lib/gcc_dll/mswu -IC:/wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -std=c++11 -DNDEBUG -DUNICODE -o ./Release/Bus.cpp.o -I. -I.", + "file": "C:\\Users\\Thales\\Documents\\GitHub\\PSP\\Project\\Bus.cpp" }]
\ No newline at end of file diff --git a/.codelite/refactoring.db b/.codelite/refactoring.db Binary files differindex 380862b..8999262 100644 --- a/.codelite/refactoring.db +++ b/.codelite/refactoring.db diff --git a/Project/Bus.cpp b/Project/Bus.cpp index a578e1b..96bff55 100644 --- a/Project/Bus.cpp +++ b/Project/Bus.cpp @@ -9,7 +9,6 @@ Bus::Bus(wxPoint2DDouble position) : Element() } Bus::~Bus() {} - void Bus::Draw(wxPoint2DDouble translation, double scale) const { // Draw selection (layer 1) @@ -75,7 +74,27 @@ bool Bus::Contains(wxPoint2DDouble position) const return m_rect.Contains(ptR); } -bool Bus::Intersects(wxRect2DDouble rect) const { return rect.Intersects(m_rect); } +bool Bus::Intersects(wxRect2DDouble rect) const +{ + wxPoint2DDouble m_rectCorners[2] = {m_rect.GetLeftTop(), m_rect.GetRightBottom()}; + + wxPoint2DDouble rectCorners[2] = {rect.GetLeftTop(), rect.GetRightBottom()}; + + // Rotate the rect corners + for(int i = 0; i < 2; i++) { + rectCorners[i] = RotateAtPosition(rectCorners[i], -m_angle); + } + //[Ref] http://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other + //[Ref2] http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604 + // if (RectA.X1 < RectB.X2 && RectA.X2 > RectB.X1 && RectA.Y1 < RectB.Y2 && RectA.Y2 > RectB.Y1) + + if(m_rectCorners[0].m_x < rectCorners[1].m_x && m_rectCorners[1].m_x > rectCorners[0].m_x && + m_rectCorners[0].m_y < rectCorners[1].m_y && m_rectCorners[1].m_y > rectCorners[0].m_y) + return true; + + return false; + // return rect.Intersects(m_rect); +} bool Bus::PickboxContains(wxPoint2DDouble position) { m_activePickboxID = ID_PB_NONE; @@ -153,7 +172,7 @@ void Bus::Rotate() bool Bus::GetContextMenu(wxMenu& menu) { - menu.Append(ID_EDIT_BUS, _("Edit bus")); - menu.Append(ID_ROTATE, _("Rotate")); - return true; + menu.Append(ID_EDIT_BUS, _("Edit bus")); + menu.Append(ID_ROTATE, _("Rotate")); + return true; } diff --git a/Project/Line.cpp b/Project/Line.cpp index 7f4605f..8b17ade 100644 --- a/Project/Line.cpp +++ b/Project/Line.cpp @@ -164,7 +164,6 @@ void Line::StartMove(wxPoint2DDouble position) void Line::MoveNode(Element* parent, wxPoint2DDouble position) { if(parent) { - //wxMessageBox("OK"); // First bus. if(parent == m_parentList[0]) { m_pointList[0] = m_movePts[0] + position - m_moveStartPt; diff --git a/Project/Project.mk b/Project/Project.mk index 09ecb89..2a6d78f 100644 --- a/Project/Project.mk +++ b/Project/Project.mk @@ -13,8 +13,8 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Thales -Date :=21/08/2016 -CodeLitePath :="C:/Program Files (x86)/CodeLite" +Date :=23/08/2016 +CodeLitePath :="C:/Program Files/CodeLite" LinkerName :=C:/TDM-GCC-64/bin/g++.exe SharedObjectLinkerName :=C:/TDM-GCC-64/bin/g++.exe -shared -fPIC ObjectSuffix :=.o @@ -61,8 +61,7 @@ AS := C:/TDM-GCC-64/bin/as.exe ## ## User defined environment variables ## -CodeLiteDir:=C:\Program Files (x86)\CodeLite -UNIT_TEST_PP_SRC_DIR:=C:\UnitTest++-1.3 +CodeLiteDir:=C:\Program Files\CodeLite WXWIN:=C:\wxWidgets-3.1.0 WXCFG:=gcc_dll\mswu Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/win_resources.rc$(ObjectSuffix) $(IntermediateDirectory)/Element.cpp$(ObjectSuffix) $(IntermediateDirectory)/Bus.cpp$(ObjectSuffix) $(IntermediateDirectory)/Line.cpp$(ObjectSuffix) $(IntermediateDirectory)/ArtMetro.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrame.cpp$(ObjectSuffix) $(IntermediateDirectory)/Workspace.cpp$(ObjectSuffix) $(IntermediateDirectory)/MainFrameBitmaps.cpp$(ObjectSuffix) $(IntermediateDirectory)/WorkspaceBitmaps.cpp$(ObjectSuffix) \ diff --git a/Project/Release/Bus.cpp.o b/Project/Release/Bus.cpp.o Binary files differindex 886f064..ca53709 100644 --- a/Project/Release/Bus.cpp.o +++ b/Project/Release/Bus.cpp.o diff --git a/Project/Release/PSP-UFU.exe b/Project/Release/PSP-UFU.exe Binary files differindex c436fd9..9af8de7 100644 --- a/Project/Release/PSP-UFU.exe +++ b/Project/Release/PSP-UFU.exe diff --git a/Project/Release/Workspace.cpp.o b/Project/Release/Workspace.cpp.o Binary files differindex 3c52ac0..99752d1 100644 --- a/Project/Release/Workspace.cpp.o +++ b/Project/Release/Workspace.cpp.o diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp index d4b6fa6..68e8464 100644 --- a/Project/Workspace.cpp +++ b/Project/Workspace.cpp @@ -492,8 +492,10 @@ void Workspace::OnKeyDown(wxKeyEvent& event) // Parent's element rotating... for(int i = 0; i < (int)element->GetParentList().size(); i++) { Element* parent = element->GetParentList()[i]; - if(parent->IsSelected()) { - element->RotateNode(parent); + if(parent) { // Check if parent is not null + if(parent->IsSelected()) { + element->RotateNode(parent); + } } } if(element->IsSelected()) { |