Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ examples/xdg-shell.o
# stb image headerss
stb_image_write.h
stb_image.h
/dev/msvc/olcPGE3_wxWidgets/olcPGE3_wxWidgets/x64/Debug
/dev/msvc/olcPGE3_wxWidgets/x64/Debug
10 changes: 10 additions & 0 deletions dev/msvc/olcPGE3.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "olcPGE3", "olcPGE3.vcxproj"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "olcPGE3_BuildSH", "olcPGE3_BuildSH\olcPGE3_BuildSH.vcxproj", "{227300C2-9BC8-4E66-95FC-334A009D449B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "olcPGE3_wxWidgets", "olcPGE3_wxWidgets\olcPGE3_wxWidgets.vcxproj", "{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -31,6 +33,14 @@ Global
{227300C2-9BC8-4E66-95FC-334A009D449B}.Release|x64.Build.0 = Release|x64
{227300C2-9BC8-4E66-95FC-334A009D449B}.Release|x86.ActiveCfg = Release|Win32
{227300C2-9BC8-4E66-95FC-334A009D449B}.Release|x86.Build.0 = Release|Win32
{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}.Debug|x64.ActiveCfg = Debug|x64
{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}.Debug|x64.Build.0 = Debug|x64
{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}.Debug|x86.ActiveCfg = Debug|Win32
{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}.Debug|x86.Build.0 = Debug|Win32
{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}.Release|x64.ActiveCfg = Release|x64
{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}.Release|x64.Build.0 = Release|x64
{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}.Release|x86.ActiveCfg = Release|Win32
{B87BDA1C-BB21-486C-BEB1-7C33AF2442C0}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
13 changes: 13 additions & 0 deletions dev/msvc/olcPGE3.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\src\host_win_winapi.h" />
<ClInclude Include="..\src\host_wxwidgets.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\src\hw_input.h" />
<ClInclude Include="..\src\hw_keyboard.h" />
<ClInclude Include="..\src\hw_mouse.h" />
Expand All @@ -258,6 +262,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\src\imload_stb_image.h" />
<ClInclude Include="..\src\imload_wingdi.h" />
<ClInclude Include="..\src\matrix3d.h" />
<ClInclude Include="..\src\matrix4d.h" />
Expand Down Expand Up @@ -315,6 +320,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\host_win_winapi.cpp" />
<ClCompile Include="..\src\host_wxwidgets.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\hw_keyboard.cpp" />
<ClCompile Include="..\src\hw_mouse.cpp" />
<ClCompile Include="..\src\hw_touch.cpp" />
Expand Down Expand Up @@ -356,8 +365,12 @@
<Text Include="..\..\CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\extensions\miniaudio\README.md" />
<None Include="..\..\extensions\README.md" />
<None Include="..\..\extensions\splashscreen\README.md" />
<None Include="..\..\LICENCE.md" />
<None Include="..\..\README.md" />
<None Include="..\..\utilities\README.md" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
45 changes: 39 additions & 6 deletions dev/msvc/olcPGE3.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
<Filter Include="Extras">
<UniqueIdentifier>{76f094ac-5176-4402-9395-6187374c5d64}</UniqueIdentifier>
</Filter>
<Filter Include="Hosts\wxWidgets Specific">
<UniqueIdentifier>{eb0bb606-e8b0-419b-b621-b61633c50add}</UniqueIdentifier>
</Filter>
<Filter Include="Extensions">
<UniqueIdentifier>{12be6a62-5486-49fa-be63-b305888e2aca}</UniqueIdentifier>
</Filter>
<Filter Include="Extensions\MiniAudio">
<UniqueIdentifier>{6b6f0117-0e7e-4dc8-ad83-96525e679ff3}</UniqueIdentifier>
</Filter>
<Filter Include="Extensions\SplashScreen">
<UniqueIdentifier>{799e6b1b-18e3-48e9-9181-a7e139ebd5da}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\pixel.h">
Expand Down Expand Up @@ -144,9 +156,6 @@
<ClInclude Include="..\src\matrix4d.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\host_iface.h">
<Filter>Hosts</Filter>
</ClInclude>
<ClInclude Include="..\src\gpu_iface.h">
<Filter>GPUs</Filter>
</ClInclude>
Expand All @@ -171,15 +180,24 @@
<ClInclude Include="..\src\hw_touch.h">
<Filter>Hardware</Filter>
</ClInclude>
<ClInclude Include="..\src\imload_iface.h">
<Filter>Hosts</Filter>
</ClInclude>
<ClInclude Include="..\src\extension.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\utilities\olcUTIL3_QuadTree.h">
<Filter>Utilities</Filter>
</ClInclude>
<ClInclude Include="..\src\imload_iface.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\host_iface.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\imload_stb_image.h">
<Filter>Hosts</Filter>
</ClInclude>
<ClInclude Include="..\src\host_wxwidgets.h">
<Filter>Hosts\wxWidgets Specific</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\core.cpp">
Expand Down Expand Up @@ -257,6 +275,9 @@
<ClCompile Include="..\src\hw_touch.cpp">
<Filter>Hardware</Filter>
</ClCompile>
<ClCompile Include="..\src\host_wxwidgets.cpp">
<Filter>Hosts\wxWidgets Specific</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\README.md">
Expand All @@ -265,6 +286,18 @@
<None Include="..\..\LICENCE.md">
<Filter>Extras</Filter>
</None>
<None Include="..\..\extensions\README.md">
<Filter>Extensions</Filter>
</None>
<None Include="..\..\extensions\miniaudio\README.md">
<Filter>Extensions\MiniAudio</Filter>
</None>
<None Include="..\..\extensions\splashscreen\README.md">
<Filter>Extensions\SplashScreen</Filter>
</None>
<None Include="..\..\utilities\README.md">
<Filter>Utilities</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include="..\..\CMakeLists.txt">
Expand Down
19 changes: 19 additions & 0 deletions dev/msvc/olcPGE3_wxWidgets/cApp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "cApp.h"
#include "cMain.h"



wxIMPLEMENT_APP(cApp);

bool cApp::OnInit()
{
if (!wxApp::OnInit())
return false;

cMain* pMain = new cMain();
pMain->Show(true);
SetTopWindow(pMain);

return true;
}

12 changes: 12 additions & 0 deletions dev/msvc/olcPGE3_wxWidgets/cApp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include <wx/wx.h>

class cApp : public wxApp
{
public:
virtual bool OnInit() override;
};

wxDECLARE_APP(cApp);

127 changes: 127 additions & 0 deletions dev/msvc/olcPGE3_wxWidgets/cMain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#include "cMain.h"


ExamplePanel1::ExamplePanel1(wxWindow* pParent) : olc::wx::PGE3Panel(pParent)
{
vLineStart = { 0,0 };
vLineStop = { 256, 240 };
}

void ExamplePanel1::OnRender()
{
draw.Line(vLineStart, olc::Colour::BLUE, vLineStop, olc::Colour::RED);
draw.StringProp({ 10, 2 }, "olc::PixelGameEngine\nin\nwxWidgets!", olc::Colour::WHITE);
}

void ExamplePanel1::OnMouseLeftDown(const olc::vf2d& vWorldPos, const bool bShift, const bool bControl)
{
vLineStart = vWorldPos;
Refresh();
}

void ExamplePanel1::OnMouseRightDown(const olc::vf2d& vWorldPos, const bool bShift, const bool bControl)
{
vLineStop = vWorldPos;
Refresh();
}






ExamplePanel2::ExamplePanel2(wxWindow* pParent) : olc::wx::PGE3Panel(pParent)
{

}

ExamplePanel2::ExamplePanel2(wxWindow* pParent, const olc::vi2d& vFixedSize) : olc::wx::PGE3Panel(pParent, vFixedSize)
{

}

void ExamplePanel2::OnCreate()
{

vPos = { 100,100 };
vVel = olc::vf2d(100.0f, 1.0f).cart();
}

void ExamplePanel2::OnRender()
{
draw.Clear(olc::Colour::VERY_DARK_BLUE);
draw.FilledCircle(vPos.round(), 10, olc::Colour::WHITE);
}

void ExamplePanel2::OnMouseMiddleDown(const olc::vf2d& vWorldPos, const bool bShift, const bool bControl)
{
vPos = vWorldPos;
}

void ExamplePanel2::OnUpdate(const float fElapsedTime)
{
vPos += vVel * fElapsedTime;

if (vPos.x - 10 <= 0)
{
vPos.x = 10;
vVel.x *= -1;
}
if (vPos.y - 10 <= 0)
{
vPos.y = 10;
vVel.y *= -1;
}
if (vPos.x + 10 >= draw.GetTargetSize().x)
{
vPos.x = draw.GetTargetSize().x - 10;
vVel.x *= -1;
}

if (vPos.y + 10 >= draw.GetTargetSize().y)
{
vPos.y = draw.GetTargetSize().y - 10;
vVel.y *= -1;
}
}



cMain::cMain()
: wxFrame(nullptr, wxID_ANY, "olcPGE3 wxWidgets", wxDefaultPosition, wxSize(800, 600), wxDEFAULT_FRAME_STYLE)
{

wxPanel* pRoot = new wxPanel(this);
wxBoxSizer* pSizer = new wxBoxSizer(wxHORIZONTAL);

m_pPanel1 = new ExamplePanel1(pRoot);
pSizer->Add(m_pPanel1, 1, wxEXPAND | wxALL, 8);

m_pPanel2 = new ExamplePanel2(pRoot);
m_pPanel2->OnCreate();
pSizer->Add(m_pPanel2, 1, wxEXPAND | wxALL, 8);

m_pPanel3 = new ExamplePanel2(pRoot, { 128,128 });
m_pPanel3->OnCreate();
pSizer->Add(m_pPanel3, 1, wxEXPAND | wxALL, 8);

pRoot->SetSizer(pSizer);

m_timer.Bind(wxEVT_TIMER, &cMain::OnTick, this);
m_timer.Start(1000 / 60);
}

void cMain::OnTick(wxTimerEvent& event)
{
olc_IgnoreUnused(event);
//m_pPanel1->OnUpdate(1.0f / 60.0f);
//m_pPanel1->Refresh(false);

m_pPanel2->OnUpdate(1.0f / 60.0f);
m_pPanel2->Refresh(false);

m_pPanel3->OnUpdate(1.0f / 60.0f);
m_pPanel3->Refresh(false);
}


57 changes: 57 additions & 0 deletions dev/msvc/olcPGE3_wxWidgets/cMain.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

#define OLC_USE_WXWIDGETS
#include "..\..\..\olcPixelGameEngine3.h"

class ExamplePanel1 : public olc::wx::PGE3Panel
{
public:
ExamplePanel1(wxWindow* pParent);

protected:
void OnRender() override;

void OnMouseLeftDown(const olc::vf2d& vWorldPos, const bool bShift, const bool bControl) override;
void OnMouseRightDown(const olc::vf2d& vWorldPos, const bool bShift, const bool bControl) override;

private:
olc::vf2d vLineStart;
olc::vf2d vLineStop;
};


class ExamplePanel2 : public olc::wx::PGE3Panel
{
public:
ExamplePanel2(wxWindow* pParent);
ExamplePanel2(wxWindow* pParent, const olc::vi2d& vFixedSize);

public:
void OnUpdate(const float fElapsedTime) override;
void OnCreate() override;
protected:
void OnRender() override;
void OnMouseMiddleDown(const olc::vf2d& vWorldPos, const bool bShift, const bool bControl) override;


private:
olc::vf2d vPos;
olc::vf2d vVel;
};

class cMain : public wxFrame
{
public:
cMain();

private:
void OnTick(wxTimerEvent& event);


private:
ExamplePanel1* m_pPanel1 = nullptr;
ExamplePanel2* m_pPanel2 = nullptr;
ExamplePanel2* m_pPanel3 = nullptr;
wxTimer m_timer;
};

4 changes: 4 additions & 0 deletions dev/msvc/olcPGE3_wxWidgets/make_pge3.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo on
cd ..\..\src
..\..\..\olcGimmeHead\msvc\x64\debug\gimme-head.exe sh_template.h ..\..\olcPixelGameEngine3.h
rem copy ..\msvc\olcPGE3_BuildSH\olcPixelGameEngine3.h ..\..\olcPixelGameEngine3.h
Loading
Loading