Commit Graph

219 Commits

Author SHA1 Message Date
27e4497eb3 SDL_Memory.thpp smart pointer wrappers for SDL.
See built-in doxygen documentation in file
2024-01-03 23:54:29 -05:00
3da230c8ea Minimze use of raw pointers and prefer references. Template header extension is now .thpp
Updated SINGLETON_INTERFACE macro so it returns an instance reference instead of a ptr.
Using std::unique_ptr with a deleter function for SDL_Renderer ptr and SDL_Window pointer.
2024-01-03 13:23:28 -05:00
ea4fce1f30 Standardizing and cleaning up test names 2024-01-03 10:53:17 -05:00
485acca355 Unit-Test the SdlEventSource class
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
Close #17
2024-01-03 10:32:30 -05:00
549854cd44 Test SdlEventSource: create privileged viewer class that can see private members
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-31 20:29:16 -05:00
d6113aa74b Add missing <vector> header in IApplication class
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-31 20:09:40 -05:00
0ddb5ae529 Add missing <vector> header in Application.hpp 2023-12-31 20:01:36 -05:00
d3f4973e7a Add missing <string> header for tye-aliases.hpp
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-31 19:58:17 -05:00
2a287c15af Singleton.template.hpp: move <T> specifier to the GetInstance<T>() method.
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-31 19:49:36 -05:00
771b5fa082 Move include/renderers/SdlRenderer.hpp to include/ 2023-12-31 17:47:31 -05:00
db2061d53e Move include/types/aliases.hpp to include/type-aliases.hpp 2023-12-31 17:45:08 -05:00
5f6bc7612b Move any_ptr.hpp out of the types/ folder 2023-12-31 17:41:50 -05:00
3e8c24a813 Add type-checking to any_ptr, while still allowing cross-binary types
Apparently SDL_Surface* declared in libsdl.so or libsdl.dylib appear
as a different type to application-level code using boost::any because
the std::type_index structure within is not created identically!

Despite this, the type_index.name() values still match. This change
adds an additional type check if the initial type_index == type_index
check failed!

The added performance penalty is a
std::hash<std::string>() hit when the first type_index operator==()
check fails.

Close #22
2023-12-31 17:37:21 -05:00
5bc52456cd Change nomenclature: EventEmitter -> EventSource
Close #18
2023-12-31 12:05:25 -05:00
4c2204e099 Re-enable Position-independent code 2023-12-31 12:05:25 -05:00
b23219ffe4 Fix any_ptr copy-constructor that was allocating new memory instead of copying a pointer 2023-12-31 12:05:25 -05:00
d09b2d03c0 Reactivate deliberate failure unit test 2023-12-31 12:05:25 -05:00
b2bb247c06 New template: any_ptr - wrapper around void pointer; add any_ptr_cast.
Template only accepts pointer types. Does no automatic deletion of data.
Only useful for passing incomplete structures around.

Needed for SdlRenderer logic since std::any does not recognize SDL_Texture* from
unit tests being the same as SDL_Texture* from the game engine.

Code and unit-tests is mostly generated by ChatGPT, and should be
considered sus.

Close #20.
2023-12-31 12:05:25 -05:00
e2ce5816ac Move LoopRegulators to where they are used, and out of the class definition
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-30 03:04:13 -05:00
74816e29c3 Create observable EventEmitter class
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
Add SDL_PollEvent calls and implement the Notify() method.
Call the Notify() method in the simulation_loop_thread method, and call PollEvents in the main thread's render loop.
Currently, all events go to every Observer.

Close #13
2023-12-30 02:49:07 -05:00
5b8c5aca05 [tests]: include the test-runner binary when building the 'all' target
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-29 22:35:25 -05:00
a412d14ade [game]: rework the Run() function so that it also contains the Rendering/Event Loop 2023-12-29 22:34:29 -05:00
c555f9e42d Add _Hz literal modifer definition for clarity in LoopRegulator class 2023-12-29 22:33:12 -05:00
c138869684 Improve test case labeling 2023-12-29 22:32:35 -05:00
7794708c8a Move utils/Sdlhelpers.hpp to test-utils/SdlHelpers.hpp
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-29 12:39:52 -05:00
3ab196a4b0 Move tests/common.hpp to tests/test-utils/common.hpp 2023-12-29 12:37:30 -05:00
fce0486088 Add unit test for Observer pattern from other project
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
work #14
2023-12-29 12:35:31 -05:00
f279c078ec Import Observer pattern implementation from another project
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
work #14
2023-12-29 12:34:42 -05:00
5ebb63b3f3 Improve detection of dependency include directories
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
Work #15
2023-12-29 12:31:23 -05:00
9398f93da1 Testing version of the engine now only builds when tests are requested
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-28 20:46:31 -05:00
1bbe384c97 Fix: Somehow SDL2 libraries are not being properly linked??
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-28 19:01:54 -05:00
57b38e42ae Add SDL_test-runner as a build dependency of ctest, even if it doesn't always get ran
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-28 18:58:45 -05:00
9f9af394a7 Large scale effort to wrap SDL_Renderer 2D hardware accelerated API.
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
Gave the class very modest defaults, (1024x768 viewport) and 2D HW accel.

Additional changes:
 - Added an ASSERT macro in Exception.hpp and a free-floatig function to implement it
   it really makes error-handler code more concise.
 - Tweaked Doxygen settings so it documents macros.
 - Documented IRenderer class so far (Close #12)
 - Added another test framework binary for automated tests on GUI systems, to test SdlRenderer
 - Imported SdlTestFixture from another project of mine.
 - Added test image.

Close #8 - Wrap SDL_Rendering API
2023-12-28 18:29:40 -05:00
01f6a7f85f ename error_t to error_flag to preven name clash with STL and internal compiler types 2023-12-28 18:29:40 -05:00
d483935b9e Add misisng header to SDlRender.cpp 2023-12-28 18:29:40 -05:00
7022db36a5 Integrate the LoopRegulator class with the game binary.
Add debugprint() macro and -DDEBUG=1 to build flags.
2023-12-28 18:29:33 -05:00
e9bdae3280 Fix: CI Builds skip certain LoopRegulato tests but now only on Apple MacOS. Fixed a bug in the logic there
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-28 18:27:32 -05:00
f58128243c Integrate the LoopRegulator class with the game binary.
Some checks failed
buildbot/darwin-macos-cmake-builder Build done.
buildbot/linux-podman-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
Add debugprint() macro and -DDEBUG=1 to build flags.
2023-12-27 23:18:02 -05:00
a923283248 Explicitly use steady_clock so that is_steady is always true
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
Work #8 - Create a LoopRegulator class to limit framereate as wlel as
          data model update cycles
2023-12-27 17:38:44 -05:00
c1846fa439 Use platform.hpp header to disable CI tests that fail on macOS
Move platform.hpp to include/sys.

Work #9
2023-12-27 17:38:08 -05:00
eaa525b104 Disable a unit-test that doesn't work on macOS CI build server
Work #9
2023-12-27 17:37:29 -05:00
85d8ff908f Create & Test a Loop regulating class for framerate regulation or physics loop timing
Some checks failed
buildbot/freebsd-jail-cmake-builder Build done.
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
2023-12-26 22:31:21 -05:00
e840ad5f75 Switch to C++17 standards; Apple LLVM does not support all of C++20
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-18 14:42:26 -05:00
61e28b0ca8 Fix Linux/FreeBSD build: properly capitalize filenames
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-18 14:19:15 -05:00
775b1bc9c3 Rename exception.*pp -> Exception.*pp and update CMakeLists.txt and #include calls.
Some checks failed
buildbot/linux-podman-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
Close #7
2023-12-13 23:11:25 -05:00
7d552d7155 Rename elemental::exception -> elemental::Exception for consistency.
Work #7
2023-12-13 23:05:50 -05:00
b5eeba1e71 Complete unit testing coverage for 3 existing classes.
Closes #6
2023-12-13 23:02:24 -05:00
ca8d68605c Add doxygen support, begin top-down design of subsystems 2023-12-13 20:32:35 -05:00
680407ec1f Fix: testing version of the library should be static
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
2023-12-13 19:44:18 -05:00
417ad8db4c Fix linux boost stactrace with better linking options and preprocessor defs
All checks were successful
buildbot/linux-podman-cmake-builder Build done.
buildbot/freebsd-jail-cmake-builder Build done.
buildbot/darwin-macos-cmake-builder Build done.
2023-12-13 19:40:54 -05:00