From c4d90647dbdb60e0af04cbbe67427f12b302d413 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Fri, 28 Feb 2025 12:25:02 -0700 Subject: [PATCH 1/5] Rename project to `demoGraphics` It's more of an interactive demo project, rather than an automated test project. --- .circleci/config.yml | 2 +- .github/workflows/build.yml | 2 +- NAS2D.sln | 2 +- .../SdlVersionInfo.cpp | 0 .../SdlVersionInfo.h | 0 .../TestGraphics.cpp | 0 .../TestGraphics.h | 0 {test-graphics => demoGraphics}/data/Gear.png | Bin .../data/Test_DirectX.png | Bin .../data/Test_OpenGL.png | Bin .../demoGraphics.vcxproj | 0 .../demoGraphics.vcxproj.filters | 0 {test-graphics => demoGraphics}/main.cpp | 0 makefile | 20 +++++++++--------- 14 files changed, 13 insertions(+), 13 deletions(-) rename {test-graphics => demoGraphics}/SdlVersionInfo.cpp (100%) rename {test-graphics => demoGraphics}/SdlVersionInfo.h (100%) rename {test-graphics => demoGraphics}/TestGraphics.cpp (100%) rename {test-graphics => demoGraphics}/TestGraphics.h (100%) rename {test-graphics => demoGraphics}/data/Gear.png (100%) rename {test-graphics => demoGraphics}/data/Test_DirectX.png (100%) rename {test-graphics => demoGraphics}/data/Test_OpenGL.png (100%) rename test-graphics/test-graphics.vcxproj => demoGraphics/demoGraphics.vcxproj (100%) rename test-graphics/test-graphics.vcxproj.filters => demoGraphics/demoGraphics.vcxproj.filters (100%) rename {test-graphics => demoGraphics}/main.cpp (100%) diff --git a/.circleci/config.yml b/.circleci/config.yml index c53d775c2..8f1f3b8ce 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ commands: - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" test - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" check - - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" test-graphics + - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" demoGraphics - run: make package - store_artifacts: path: .build/package/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7242d2241..a0762aba1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -125,5 +125,5 @@ jobs: - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" test - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" check - - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" test-graphics + - run: make --keep-going --jobs 16 CXXFLAGS_EXTRA="-Werror" demoGraphics - run: make package diff --git a/NAS2D.sln b/NAS2D.sln index 1117d26f3..44485f220 100644 --- a/NAS2D.sln +++ b/NAS2D.sln @@ -7,7 +7,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NAS2D", "NAS2D\NAS2D.vcxpro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{78F02848-BACB-4AD3-985E-0EB0D5B3DD53}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-graphics", "test-graphics\test-graphics.vcxproj", "{BC10CE9A-9BDA-4922-8C1F-F91C1E389483}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demoGraphics", "demoGraphics\demoGraphics.vcxproj", "{BC10CE9A-9BDA-4922-8C1F-F91C1E389483}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/test-graphics/SdlVersionInfo.cpp b/demoGraphics/SdlVersionInfo.cpp similarity index 100% rename from test-graphics/SdlVersionInfo.cpp rename to demoGraphics/SdlVersionInfo.cpp diff --git a/test-graphics/SdlVersionInfo.h b/demoGraphics/SdlVersionInfo.h similarity index 100% rename from test-graphics/SdlVersionInfo.h rename to demoGraphics/SdlVersionInfo.h diff --git a/test-graphics/TestGraphics.cpp b/demoGraphics/TestGraphics.cpp similarity index 100% rename from test-graphics/TestGraphics.cpp rename to demoGraphics/TestGraphics.cpp diff --git a/test-graphics/TestGraphics.h b/demoGraphics/TestGraphics.h similarity index 100% rename from test-graphics/TestGraphics.h rename to demoGraphics/TestGraphics.h diff --git a/test-graphics/data/Gear.png b/demoGraphics/data/Gear.png similarity index 100% rename from test-graphics/data/Gear.png rename to demoGraphics/data/Gear.png diff --git a/test-graphics/data/Test_DirectX.png b/demoGraphics/data/Test_DirectX.png similarity index 100% rename from test-graphics/data/Test_DirectX.png rename to demoGraphics/data/Test_DirectX.png diff --git a/test-graphics/data/Test_OpenGL.png b/demoGraphics/data/Test_OpenGL.png similarity index 100% rename from test-graphics/data/Test_OpenGL.png rename to demoGraphics/data/Test_OpenGL.png diff --git a/test-graphics/test-graphics.vcxproj b/demoGraphics/demoGraphics.vcxproj similarity index 100% rename from test-graphics/test-graphics.vcxproj rename to demoGraphics/demoGraphics.vcxproj diff --git a/test-graphics/test-graphics.vcxproj.filters b/demoGraphics/demoGraphics.vcxproj.filters similarity index 100% rename from test-graphics/test-graphics.vcxproj.filters rename to demoGraphics/demoGraphics.vcxproj.filters diff --git a/test-graphics/main.cpp b/demoGraphics/main.cpp similarity index 100% rename from test-graphics/main.cpp rename to demoGraphics/main.cpp diff --git a/makefile b/makefile index 114d61dbc..38b80f5f8 100644 --- a/makefile +++ b/makefile @@ -33,7 +33,7 @@ BUILDDIRPREFIX := $(ROOTBUILDDIR)/$(CONFIG)_Linux_ .DEFAULT_GOAL := nas2d .PHONY: all -all: nas2d test test-graphics +all: nas2d test demoGraphics ## NAS2D project ## @@ -101,19 +101,19 @@ check: | test cd test && $(RunPrefix) ../$(TESTOUTPUT) $(GTEST_OPTIONS) -## Graphics test project ## +## Graphics demo project ## -TESTGRAPHICSDIR := test-graphics -TESTGRAPHICSINTDIR := $(BUILDDIRPREFIX)testGraphics/intermediate -TESTGRAPHICSOUTPUT := $(BUILDDIRPREFIX)testGraphics/testGraphics$(ExeSuffix) +TESTGRAPHICSDIR := demoGraphics +TESTGRAPHICSINTDIR := $(BUILDDIRPREFIX)demoGraphics/intermediate +TESTGRAPHICSOUTPUT := $(BUILDDIRPREFIX)demoGraphics/demoGraphics$(ExeSuffix) TESTGRAPHICSSRCS := $(shell find $(TESTGRAPHICSDIR) -name '*.cpp') TESTGRAPHICSOBJS := $(patsubst $(TESTGRAPHICSDIR)/%.cpp,$(TESTGRAPHICSINTDIR)/%.o,$(TESTGRAPHICSSRCS)) TESTGRAPHICSPROJECT_FLAGS = $(TESTCPPFLAGS) $(CXXFLAGS) TESTGRAPHICSPROJECT_LINKFLAGS = $(TESTLDFLAGS) $(LDLIBS) -.PHONY: test-graphics -test-graphics: $(TESTGRAPHICSOUTPUT) +.PHONY: demoGraphics +demoGraphics: $(TESTGRAPHICSOUTPUT) $(TESTGRAPHICSOUTPUT): PROJECT_LINKFLAGS = $(TESTGRAPHICSPROJECT_LINKFLAGS) $(TESTGRAPHICSOUTPUT): $(TESTGRAPHICSOBJS) $(OUTPUT) @@ -124,9 +124,9 @@ $(TESTGRAPHICSOBJS): $(TESTGRAPHICSINTDIR)/%.o : $(TESTGRAPHICSDIR)/%.cpp $(TEST -include $(patsubst %.o,%.dep,$(TESTGRAPHICSOBJS)) -.PHONY: run-test-graphics -run-test-graphics: | test-graphics - cd test-graphics/ && $(RunPrefix) ../$(TESTGRAPHICSOUTPUT) ; cd .. +.PHONY: run-demoGraphics +run-demoGraphics: | demoGraphics + cd demoGraphics/ && $(RunPrefix) ../$(TESTGRAPHICSOUTPUT) ; cd .. ## Compile rules ## From b5bf73985212b0c7127c13d9d1d27154bf1690a2 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Fri, 28 Feb 2025 12:25:31 -0700 Subject: [PATCH 2/5] Rename `makefile` variables for consistency --- makefile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/makefile b/makefile index 38b80f5f8..40cd377ab 100644 --- a/makefile +++ b/makefile @@ -103,30 +103,30 @@ check: | test ## Graphics demo project ## -TESTGRAPHICSDIR := demoGraphics -TESTGRAPHICSINTDIR := $(BUILDDIRPREFIX)demoGraphics/intermediate -TESTGRAPHICSOUTPUT := $(BUILDDIRPREFIX)demoGraphics/demoGraphics$(ExeSuffix) -TESTGRAPHICSSRCS := $(shell find $(TESTGRAPHICSDIR) -name '*.cpp') -TESTGRAPHICSOBJS := $(patsubst $(TESTGRAPHICSDIR)/%.cpp,$(TESTGRAPHICSINTDIR)/%.o,$(TESTGRAPHICSSRCS)) +DEMOGRAPHICSDIR := demoGraphics +DEMOGRAPHICSINTDIR := $(BUILDDIRPREFIX)demoGraphics/intermediate +DEMOGRAPHICSOUTPUT := $(BUILDDIRPREFIX)demoGraphics/demoGraphics$(ExeSuffix) +DEMOGRAPHICSSRCS := $(shell find $(DEMOGRAPHICSDIR) -name '*.cpp') +DEMOGRAPHICSOBJS := $(patsubst $(DEMOGRAPHICSDIR)/%.cpp,$(DEMOGRAPHICSINTDIR)/%.o,$(DEMOGRAPHICSSRCS)) -TESTGRAPHICSPROJECT_FLAGS = $(TESTCPPFLAGS) $(CXXFLAGS) -TESTGRAPHICSPROJECT_LINKFLAGS = $(TESTLDFLAGS) $(LDLIBS) +DEMOGRAPHICSPROJECT_FLAGS = $(TESTCPPFLAGS) $(CXXFLAGS) +DEMOGRAPHICSPROJECT_LINKFLAGS = $(TESTLDFLAGS) $(LDLIBS) .PHONY: demoGraphics -demoGraphics: $(TESTGRAPHICSOUTPUT) +demoGraphics: $(DEMOGRAPHICSOUTPUT) -$(TESTGRAPHICSOUTPUT): PROJECT_LINKFLAGS = $(TESTGRAPHICSPROJECT_LINKFLAGS) -$(TESTGRAPHICSOUTPUT): $(TESTGRAPHICSOBJS) $(OUTPUT) +$(DEMOGRAPHICSOUTPUT): PROJECT_LINKFLAGS = $(DEMOGRAPHICSPROJECT_LINKFLAGS) +$(DEMOGRAPHICSOUTPUT): $(DEMOGRAPHICSOBJS) $(OUTPUT) -$(TESTGRAPHICSOBJS): PROJECT_FLAGS = $(TESTGRAPHICSPROJECT_FLAGS) -$(TESTGRAPHICSOBJS): $(TESTGRAPHICSINTDIR)/%.o : $(TESTGRAPHICSDIR)/%.cpp $(TESTGRAPHICSINTDIR)/%.dep +$(DEMOGRAPHICSOBJS): PROJECT_FLAGS = $(DEMOGRAPHICSPROJECT_FLAGS) +$(DEMOGRAPHICSOBJS): $(DEMOGRAPHICSINTDIR)/%.o : $(DEMOGRAPHICSDIR)/%.cpp $(DEMOGRAPHICSINTDIR)/%.dep --include $(patsubst %.o,%.dep,$(TESTGRAPHICSOBJS)) +-include $(patsubst %.o,%.dep,$(DEMOGRAPHICSOBJS)) .PHONY: run-demoGraphics run-demoGraphics: | demoGraphics - cd demoGraphics/ && $(RunPrefix) ../$(TESTGRAPHICSOUTPUT) ; cd .. + cd demoGraphics/ && $(RunPrefix) ../$(DEMOGRAPHICSOUTPUT) ; cd .. ## Compile rules ## From 10f7527aaa6bfdcb79d6a269ad4c027e68eb6588 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Fri, 28 Feb 2025 12:26:17 -0700 Subject: [PATCH 3/5] Remove unnecessary include for `` --- demoGraphics/TestGraphics.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/demoGraphics/TestGraphics.cpp b/demoGraphics/TestGraphics.cpp index 94cb35ffd..a6c95aa94 100644 --- a/demoGraphics/TestGraphics.cpp +++ b/demoGraphics/TestGraphics.cpp @@ -8,7 +8,6 @@ #include #include "NAS2D/Math/Angle.h" -#include #include From 868eace77b2bd468f5dd12c37139605f1ea170d6 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Fri, 28 Feb 2025 12:39:32 -0700 Subject: [PATCH 4/5] Rename class to `DemoGraphics` --- .../{TestGraphics.cpp => DemoGraphics.cpp} | 30 +++++++++---------- .../{TestGraphics.h => DemoGraphics.h} | 6 ++-- demoGraphics/demoGraphics.vcxproj | 4 +-- demoGraphics/demoGraphics.vcxproj.filters | 4 +-- demoGraphics/main.cpp | 4 +-- 5 files changed, 24 insertions(+), 24 deletions(-) rename demoGraphics/{TestGraphics.cpp => DemoGraphics.cpp} (83%) rename demoGraphics/{TestGraphics.h => DemoGraphics.h} (87%) diff --git a/demoGraphics/TestGraphics.cpp b/demoGraphics/DemoGraphics.cpp similarity index 83% rename from demoGraphics/TestGraphics.cpp rename to demoGraphics/DemoGraphics.cpp index a6c95aa94..5f8791a24 100644 --- a/demoGraphics/TestGraphics.cpp +++ b/demoGraphics/DemoGraphics.cpp @@ -1,4 +1,4 @@ -#include "TestGraphics.h" +#include "DemoGraphics.h" #include #include @@ -41,28 +41,28 @@ namespace } -TestGraphics::TestGraphics() : +DemoGraphics::DemoGraphics() : mTimer{}, mGear{"Gear.png"}, mDxImage{"Test_DirectX.png"}, mOglImage{"Test_OpenGL.png"} {} -TestGraphics::~TestGraphics() +DemoGraphics::~DemoGraphics() { auto& eventHandler = NAS2D::Utility::get(); - eventHandler.mouseMotion().disconnect({this, &TestGraphics::onMouseMove}); - eventHandler.mouseButtonDown().disconnect({this, &TestGraphics::onMouseDown}); - eventHandler.keyDown().disconnect({this, &TestGraphics::onKeyDown}); + eventHandler.mouseMotion().disconnect({this, &DemoGraphics::onMouseMove}); + eventHandler.mouseButtonDown().disconnect({this, &DemoGraphics::onMouseDown}); + eventHandler.keyDown().disconnect({this, &DemoGraphics::onKeyDown}); } -void TestGraphics::initialize() +void DemoGraphics::initialize() { auto& eventHandler = NAS2D::Utility::get(); - eventHandler.mouseMotion().connect({this, &TestGraphics::onMouseMove}); - eventHandler.mouseButtonDown().connect({this, &TestGraphics::onMouseDown}); - eventHandler.keyDown().connect({this, &TestGraphics::onKeyDown}); + eventHandler.mouseMotion().connect({this, &DemoGraphics::onMouseMove}); + eventHandler.mouseButtonDown().connect({this, &DemoGraphics::onMouseDown}); + eventHandler.keyDown().connect({this, &DemoGraphics::onKeyDown}); auto& renderer = NAS2D::Utility::get(); renderer.showSystemPointer(true); @@ -71,7 +71,7 @@ void TestGraphics::initialize() renderer.size(minSize); } -NAS2D::State* TestGraphics::update() +NAS2D::State* DemoGraphics::update() { NAS2D::Renderer& r = NAS2D::Utility::get(); @@ -125,7 +125,7 @@ NAS2D::State* TestGraphics::update() return this; } -void TestGraphics::onKeyDown(NAS2D::KeyCode key, NAS2D::KeyModifier /*mod*/, bool /*repeat*/) +void DemoGraphics::onKeyDown(NAS2D::KeyCode key, NAS2D::KeyModifier /*mod*/, bool /*repeat*/) { switch (key) { @@ -149,11 +149,11 @@ void TestGraphics::onKeyDown(NAS2D::KeyCode key, NAS2D::KeyModifier /*mod*/, boo } } -void TestGraphics::onMouseMove(NAS2D::Point /*position*/, NAS2D::Vector /*change*/) +void DemoGraphics::onMouseMove(NAS2D::Point /*position*/, NAS2D::Vector /*change*/) {} -void TestGraphics::onMouseDown(NAS2D::MouseButton /*button*/, NAS2D::Point /*position*/) +void DemoGraphics::onMouseDown(NAS2D::MouseButton /*button*/, NAS2D::Point /*position*/) {} -void TestGraphics::onWindowResized(int /*w*/, int /*h*/) +void DemoGraphics::onWindowResized(int /*w*/, int /*h*/) {} diff --git a/demoGraphics/TestGraphics.h b/demoGraphics/DemoGraphics.h similarity index 87% rename from demoGraphics/TestGraphics.h rename to demoGraphics/DemoGraphics.h index aba8d7d72..25983d500 100644 --- a/demoGraphics/TestGraphics.h +++ b/demoGraphics/DemoGraphics.h @@ -6,11 +6,11 @@ #include "NAS2D/Resource/Image.h" -class TestGraphics : public NAS2D::State +class DemoGraphics : public NAS2D::State { public: - TestGraphics(); - ~TestGraphics() override; + DemoGraphics(); + ~DemoGraphics() override; protected: void initialize() override; diff --git a/demoGraphics/demoGraphics.vcxproj b/demoGraphics/demoGraphics.vcxproj index ad479c26a..82a9ec423 100644 --- a/demoGraphics/demoGraphics.vcxproj +++ b/demoGraphics/demoGraphics.vcxproj @@ -172,11 +172,11 @@ - + - + diff --git a/demoGraphics/demoGraphics.vcxproj.filters b/demoGraphics/demoGraphics.vcxproj.filters index 0797c7a25..3970cb97a 100644 --- a/demoGraphics/demoGraphics.vcxproj.filters +++ b/demoGraphics/demoGraphics.vcxproj.filters @@ -3,10 +3,10 @@ - + - + \ No newline at end of file diff --git a/demoGraphics/main.cpp b/demoGraphics/main.cpp index 224a7a73e..c88341018 100644 --- a/demoGraphics/main.cpp +++ b/demoGraphics/main.cpp @@ -9,7 +9,7 @@ // ================================================================================== #include "SdlVersionInfo.h" -#include "TestGraphics.h" +#include "DemoGraphics.h" #include #include @@ -27,7 +27,7 @@ int main() try { NAS2D::Game game("NAS2D Graphics Test", "NAS2D_GraphicsTest", "LairWorks"); - game.go(new TestGraphics()); + game.go(new DemoGraphics()); } catch(std::exception& e) { From 5328c900c410da3d5b1681699b7c372c30b41f33 Mon Sep 17 00:00:00 2001 From: Daniel Stevens Date: Fri, 28 Feb 2025 12:41:37 -0700 Subject: [PATCH 5/5] Update `RootNamespace` tag --- demoGraphics/demoGraphics.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demoGraphics/demoGraphics.vcxproj b/demoGraphics/demoGraphics.vcxproj index 82a9ec423..e6be917a1 100644 --- a/demoGraphics/demoGraphics.vcxproj +++ b/demoGraphics/demoGraphics.vcxproj @@ -21,7 +21,7 @@ 16.0 {BC10CE9A-9BDA-4922-8C1F-F91C1E389483} - testgraphics + demographics 10.0