├── .circleci └── config.yml ├── .clang-format ├── .dockerignore ├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── LICENSE ├── README.md ├── appveyor.yml ├── cmake-init-logo.png ├── cmake-init-logo.svg ├── cmake ├── CheckTemplate.cmake ├── ClangTidy.cmake ├── CompileOptions.cmake ├── ComponentInstall.cmake ├── Coverage.cmake ├── Cppcheck.cmake ├── Custom.cmake ├── FindASSIMP.cmake ├── FindEGL.cmake ├── FindFFMPEG.cmake ├── FindGLESv2.cmake ├── FindGLEW.cmake ├── FindHIDAPI.cmake ├── FindSDL2.cmake ├── FindSDL2_image.cmake ├── FindSDL2_ttf.cmake ├── Findclang_tidy.cmake ├── Findcppcheck.cmake ├── Findgcov.cmake ├── Findlcov.cmake ├── Findnodejs.cmake ├── Gcov.cmake ├── GenerateTemplateExportHeader.cmake ├── GetGitRevisionDescription.cmake ├── GetGitRevisionDescription.cmake.in ├── HealthCheck.cmake ├── README.md └── RuntimeDependencies.cmake ├── configure ├── deploy ├── CMakeLists.txt ├── README.md ├── packages │ └── pack-mdcii.cmake └── ubuntu-ppa │ ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── rules │ └── source │ │ └── format │ └── recipe.txt ├── docker ├── Dockerfile ├── Readme.md └── entrypoint.sh ├── docs ├── CMakeLists.txt ├── README.md ├── api-docs │ ├── CMakeLists.txt │ └── doxyfile.in ├── doc │ ├── README.md │ ├── bitflags.md │ ├── bshdump.md │ ├── bshpacker.md │ ├── grafikreihenfolge.md │ ├── mdcii-sdltest.md │ ├── produktion.md │ ├── unbekannt.md │ └── warencodes.md └── manual │ ├── CMakeLists.txt │ └── cmake-init.tex ├── mdcii-config.cmake └── source ├── CMakeLists.txt ├── lib ├── CMakeLists.txt ├── proto-cod │ ├── CMakeLists.txt │ └── cod.proto ├── proto-gamelist │ ├── CMakeLists.txt │ └── gamelist.proto └── proto-textcod │ ├── CMakeLists.txt │ └── textcod.proto ├── mdcii ├── CMakeLists.txt ├── bshdump │ ├── CMakeLists.txt │ └── src │ │ └── bshdump.cpp ├── bshpacker │ ├── CMakeLists.txt │ └── src │ │ └── bshpacker.cpp ├── cod_parser │ ├── CMakeLists.txt │ ├── src │ │ └── cod_parser.cpp │ ├── test.cod │ ├── test.txt │ ├── test2.cod │ ├── test2.txt │ ├── test3.cod │ ├── test3.txt │ ├── test4.txt │ ├── test_array.cod │ └── test_array.txt ├── codcat │ ├── CMakeLists.txt │ └── src │ │ └── codcat.cpp ├── gam_parser │ ├── CMakeLists.txt │ └── src │ │ └── gam_parser.cpp ├── inselbmp │ ├── CMakeLists.txt │ └── src │ │ └── inselbmp.cpp ├── islandbmp │ ├── CMakeLists.txt │ └── src │ │ └── islandbmp.cpp ├── mdcii-sdltest │ ├── CMakeLists.txt │ └── src │ │ └── sdltest.cpp ├── mdcii │ ├── CMakeLists.txt │ ├── include │ │ └── mdcii │ │ │ ├── animation.hpp │ │ │ ├── block.hpp │ │ │ ├── bsh │ │ │ ├── bshreader.hpp │ │ │ ├── bshtexture.hpp │ │ │ ├── bshwriter.hpp │ │ │ ├── genericbshreader.hpp │ │ │ ├── zeireader.hpp │ │ │ └── zeitexture.hpp │ │ │ ├── cache │ │ │ └── cacheprotobuf.hpp │ │ │ ├── camera │ │ │ ├── bshresources.hpp │ │ │ └── camera.hpp │ │ │ ├── cod │ │ │ ├── basegad_dat.hpp │ │ │ ├── buildings.hpp │ │ │ ├── cod_parser.hpp │ │ │ ├── codhelpers.hpp │ │ │ ├── host_gad.hpp │ │ │ ├── mission_gad.hpp │ │ │ └── text_cod.hpp │ │ │ ├── common │ │ │ └── stringhelpers.hpp │ │ │ ├── files │ │ │ ├── files.hpp │ │ │ └── filestocheck.hpp │ │ │ ├── framebuffer │ │ │ ├── framebuffer.hpp │ │ │ ├── framebuffer_pal8.hpp │ │ │ ├── framebuffer_rgb24.hpp │ │ │ ├── framebuffer_trans_pal8.hpp │ │ │ └── palette.hpp │ │ │ ├── gam │ │ │ ├── chunk.hpp │ │ │ ├── city.hpp │ │ │ ├── deer.hpp │ │ │ ├── doc │ │ │ │ └── scene.md │ │ │ ├── gam_parser.hpp │ │ │ ├── island.hpp │ │ │ ├── island3.hpp │ │ │ ├── island4.hpp │ │ │ ├── island5.hpp │ │ │ ├── islandhouse.hpp │ │ │ ├── marketplace.hpp │ │ │ ├── military.hpp │ │ │ ├── missions.hpp │ │ │ ├── productionlist.hpp │ │ │ ├── rawgrowth.hpp │ │ │ ├── scene.hpp │ │ │ ├── settlers.hpp │ │ │ ├── shipyard.hpp │ │ │ ├── template.hpp │ │ │ └── warehouse.hpp │ │ │ ├── insel.hpp │ │ │ ├── karte.hpp │ │ │ ├── mdcii.hpp │ │ │ ├── menu │ │ │ ├── fps.hpp │ │ │ ├── gamewindow.hpp │ │ │ ├── mainmenu.hpp │ │ │ ├── scale.hpp │ │ │ ├── singleplayerwindow.hpp │ │ │ └── startgamewindow.hpp │ │ │ ├── renderer │ │ │ └── renderer.hpp │ │ │ ├── savegames │ │ │ ├── savegames.hpp │ │ │ └── scenarios.hpp │ │ │ ├── sdl2shared │ │ │ └── sdl2shared.hpp │ │ │ ├── spielbildschirm.hpp │ │ │ ├── strukturen.hpp │ │ │ ├── version │ │ │ └── version.hpp │ │ │ ├── welt.hpp │ │ │ └── world │ │ │ └── world.hpp │ └── src │ │ ├── block.cpp │ │ ├── bsh │ │ ├── bshtexture.cpp │ │ ├── bshwriter.cpp │ │ └── zeitexture.cpp │ │ ├── camera │ │ ├── bshresources.cpp │ │ └── camera.cpp │ │ ├── cod │ │ ├── basegad_dat.cpp │ │ ├── buildings.cpp │ │ ├── cod_parser.cpp │ │ ├── codhelpers.cpp │ │ ├── host_gad.cpp │ │ ├── mission_gad.cpp │ │ └── text_cod.cpp │ │ ├── common │ │ └── stringhelpers.cpp │ │ ├── files │ │ └── files.cpp │ │ ├── framebuffer │ │ ├── framebuffer.cpp │ │ ├── framebuffer_pal8.cpp │ │ ├── framebuffer_rgb24.cpp │ │ ├── framebuffer_trans_pal8.cpp │ │ └── palette.cpp │ │ ├── gam │ │ ├── chunk.cpp │ │ ├── city.cpp │ │ ├── deer.cpp │ │ ├── gam_parser.cpp │ │ ├── island3.cpp │ │ ├── island4.cpp │ │ ├── island5.cpp │ │ ├── islandhouse.cpp │ │ ├── marketplace.cpp │ │ ├── military.cpp │ │ ├── missions.cpp │ │ ├── productionlist.cpp │ │ ├── randomislands.cpp │ │ ├── rawgrowth.cpp │ │ ├── scene.cpp │ │ ├── settlers.cpp │ │ ├── shipyard.cpp │ │ ├── template.cpp │ │ └── warehouse.cpp │ │ ├── insel.cpp │ │ ├── karte.cpp │ │ ├── mdcii.cpp │ │ ├── menu │ │ ├── gamewindow.cpp │ │ ├── mainmenu.cpp │ │ ├── scale.cpp │ │ ├── singleplayerwindow.cpp │ │ └── startgamewindow.cpp │ │ ├── renderer │ │ └── renderer.cpp │ │ ├── savegames │ │ ├── savegames.cpp │ │ └── scenarios.cpp │ │ ├── spielbildschirm.cpp │ │ ├── strukturen.cpp │ │ ├── test │ │ ├── catch2 │ │ │ └── catch.hpp │ │ ├── cod_parser_test │ │ │ ├── cod_parser_test.cpp │ │ │ ├── test.cod │ │ │ ├── test.txt │ │ │ ├── test2.cod │ │ │ ├── test2.txt │ │ │ ├── test3.cod │ │ │ ├── test3.txt │ │ │ ├── test_array.cod │ │ │ └── test_array.txt │ │ └── data_field_reader │ │ │ ├── haus_values.py │ │ │ ├── read_gadget_objekt.py │ │ │ └── read_haus_objekt.py │ │ ├── version │ │ └── version.cpp │ │ ├── welt.cpp │ │ └── world │ │ └── world.cpp ├── paldump │ ├── CMakeLists.txt │ └── src │ │ └── paldump.cpp ├── weltbmp │ ├── CMakeLists.txt │ └── src │ │ └── weltbmp.cpp ├── worldbmp │ ├── CMakeLists.txt │ └── src │ │ └── worldbmp.cpp ├── zeidump │ ├── CMakeLists.txt │ └── src │ │ └── zeidump.cpp └── zeitext │ ├── CMakeLists.txt │ └── src │ └── zeitext.cpp ├── tests ├── CMakeLists.txt ├── README.md ├── cache-test │ ├── CMakeLists.txt │ ├── cacheProtobufTest.cpp │ └── main.cpp ├── googletest │ ├── .clang-format │ ├── .gitignore │ ├── .travis.yml │ ├── BUILD.bazel │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── WORKSPACE │ ├── appveyor.yml │ ├── ci │ │ ├── build-linux-bazel.sh │ │ ├── build-platformio.sh │ │ ├── env-linux.sh │ │ ├── env-osx.sh │ │ ├── get-nprocessors.sh │ │ ├── install-linux.sh │ │ ├── install-osx.sh │ │ ├── install-platformio.sh │ │ ├── log-config.sh │ │ └── travis.sh │ ├── googlemock │ │ ├── CMakeLists.txt │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cmake │ │ │ ├── gmock.pc.in │ │ │ └── gmock_main.pc.in │ │ ├── docs │ │ │ ├── cheat_sheet.md │ │ │ ├── community_created_documentation.md │ │ │ ├── cook_book.md │ │ │ ├── for_dummies.md │ │ │ ├── gmock_faq.md │ │ │ └── pump_manual.md │ │ ├── include │ │ │ └── gmock │ │ │ │ ├── gmock-actions.h │ │ │ │ ├── gmock-cardinalities.h │ │ │ │ ├── gmock-function-mocker.h │ │ │ │ ├── gmock-generated-actions.h │ │ │ │ ├── gmock-generated-actions.h.pump │ │ │ │ ├── gmock-matchers.h │ │ │ │ ├── gmock-more-matchers.h │ │ │ │ ├── gmock-nice-strict.h │ │ │ │ ├── gmock-spec-builders.h │ │ │ │ ├── gmock.h │ │ │ │ └── internal │ │ │ │ ├── custom │ │ │ │ ├── README.md │ │ │ │ ├── gmock-generated-actions.h │ │ │ │ ├── gmock-generated-actions.h.pump │ │ │ │ ├── gmock-matchers.h │ │ │ │ └── gmock-port.h │ │ │ │ ├── gmock-internal-utils.h │ │ │ │ ├── gmock-port.h │ │ │ │ └── gmock-pp.h │ │ ├── scripts │ │ │ ├── README.md │ │ │ ├── fuse_gmock_files.py │ │ │ ├── generator │ │ │ │ ├── LICENSE │ │ │ │ ├── README │ │ │ │ ├── README.cppclean │ │ │ │ ├── cpp │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── ast.py │ │ │ │ │ ├── gmock_class.py │ │ │ │ │ ├── gmock_class_test.py │ │ │ │ │ ├── keywords.py │ │ │ │ │ ├── tokenize.py │ │ │ │ │ └── utils.py │ │ │ │ └── gmock_gen.py │ │ │ └── pump.py │ │ ├── src │ │ │ ├── gmock-all.cc │ │ │ ├── gmock-cardinalities.cc │ │ │ ├── gmock-internal-utils.cc │ │ │ ├── gmock-matchers.cc │ │ │ ├── gmock-spec-builders.cc │ │ │ ├── gmock.cc │ │ │ └── gmock_main.cc │ │ └── test │ │ │ ├── BUILD.bazel │ │ │ ├── gmock-actions_test.cc │ │ │ ├── gmock-cardinalities_test.cc │ │ │ ├── gmock-function-mocker_nc.cc │ │ │ ├── gmock-function-mocker_nc_test.py │ │ │ ├── gmock-function-mocker_test.cc │ │ │ ├── gmock-generated-actions_test.cc │ │ │ ├── gmock-internal-utils_test.cc │ │ │ ├── gmock-matchers_test.cc │ │ │ ├── gmock-more-actions_test.cc │ │ │ ├── gmock-nice-strict_test.cc │ │ │ ├── gmock-port_test.cc │ │ │ ├── gmock-pp-string_test.cc │ │ │ ├── gmock-pp_test.cc │ │ │ ├── gmock-spec-builders_test.cc │ │ │ ├── gmock_all_test.cc │ │ │ ├── gmock_ex_test.cc │ │ │ ├── gmock_leak_test.py │ │ │ ├── gmock_leak_test_.cc │ │ │ ├── gmock_link2_test.cc │ │ │ ├── gmock_link_test.cc │ │ │ ├── gmock_link_test.h │ │ │ ├── gmock_output_test.py │ │ │ ├── gmock_output_test_.cc │ │ │ ├── gmock_output_test_golden.txt │ │ │ ├── gmock_stress_test.cc │ │ │ ├── gmock_test.cc │ │ │ ├── gmock_test_utils.py │ │ │ └── pump_test.py │ ├── googletest │ │ ├── CMakeLists.txt │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── README.md │ │ ├── cmake │ │ │ ├── Config.cmake.in │ │ │ ├── gtest.pc.in │ │ │ ├── gtest_main.pc.in │ │ │ ├── internal_utils.cmake │ │ │ └── libgtest.la.in │ │ ├── docs │ │ │ ├── advanced.md │ │ │ ├── faq.md │ │ │ ├── pkgconfig.md │ │ │ ├── primer.md │ │ │ └── samples.md │ │ ├── include │ │ │ └── gtest │ │ │ │ ├── gtest-death-test.h │ │ │ │ ├── gtest-matchers.h │ │ │ │ ├── gtest-message.h │ │ │ │ ├── gtest-param-test.h │ │ │ │ ├── gtest-printers.h │ │ │ │ ├── gtest-spi.h │ │ │ │ ├── gtest-test-part.h │ │ │ │ ├── gtest-typed-test.h │ │ │ │ ├── gtest.h │ │ │ │ ├── gtest_pred_impl.h │ │ │ │ ├── gtest_prod.h │ │ │ │ └── internal │ │ │ │ ├── custom │ │ │ │ ├── README.md │ │ │ │ ├── gtest-port.h │ │ │ │ ├── gtest-printers.h │ │ │ │ └── gtest.h │ │ │ │ ├── gtest-death-test-internal.h │ │ │ │ ├── gtest-filepath.h │ │ │ │ ├── gtest-internal.h │ │ │ │ ├── gtest-param-util.h │ │ │ │ ├── gtest-port-arch.h │ │ │ │ ├── gtest-port.h │ │ │ │ ├── gtest-string.h │ │ │ │ └── gtest-type-util.h │ │ ├── samples │ │ │ ├── prime_tables.h │ │ │ ├── sample1.cc │ │ │ ├── sample1.h │ │ │ ├── sample10_unittest.cc │ │ │ ├── sample1_unittest.cc │ │ │ ├── sample2.cc │ │ │ ├── sample2.h │ │ │ ├── sample2_unittest.cc │ │ │ ├── sample3-inl.h │ │ │ ├── sample3_unittest.cc │ │ │ ├── sample4.cc │ │ │ ├── sample4.h │ │ │ ├── sample4_unittest.cc │ │ │ ├── sample5_unittest.cc │ │ │ ├── sample6_unittest.cc │ │ │ ├── sample7_unittest.cc │ │ │ ├── sample8_unittest.cc │ │ │ └── sample9_unittest.cc │ │ ├── scripts │ │ │ ├── README.md │ │ │ ├── common.py │ │ │ ├── fuse_gtest_files.py │ │ │ ├── gen_gtest_pred_impl.py │ │ │ ├── gtest-config.in │ │ │ ├── release_docs.py │ │ │ ├── run_with_path.py │ │ │ ├── test │ │ │ │ └── Makefile │ │ │ ├── upload.py │ │ │ └── upload_gtest.py │ │ ├── src │ │ │ ├── gtest-all.cc │ │ │ ├── gtest-death-test.cc │ │ │ ├── gtest-filepath.cc │ │ │ ├── gtest-internal-inl.h │ │ │ ├── gtest-matchers.cc │ │ │ ├── gtest-port.cc │ │ │ ├── gtest-printers.cc │ │ │ ├── gtest-test-part.cc │ │ │ ├── gtest-typed-test.cc │ │ │ ├── gtest.cc │ │ │ └── gtest_main.cc │ │ └── test │ │ │ ├── BUILD.bazel │ │ │ ├── googletest-break-on-failure-unittest.py │ │ │ ├── googletest-break-on-failure-unittest_.cc │ │ │ ├── googletest-catch-exceptions-test.py │ │ │ ├── googletest-catch-exceptions-test_.cc │ │ │ ├── googletest-color-test.py │ │ │ ├── googletest-color-test_.cc │ │ │ ├── googletest-death-test-test.cc │ │ │ ├── googletest-death-test_ex_test.cc │ │ │ ├── googletest-env-var-test.py │ │ │ ├── googletest-env-var-test_.cc │ │ │ ├── googletest-failfast-unittest.py │ │ │ ├── googletest-failfast-unittest_.cc │ │ │ ├── googletest-filepath-test.cc │ │ │ ├── googletest-filter-unittest.py │ │ │ ├── googletest-filter-unittest_.cc │ │ │ ├── googletest-json-outfiles-test.py │ │ │ ├── googletest-json-output-unittest.py │ │ │ ├── googletest-list-tests-unittest.py │ │ │ ├── googletest-list-tests-unittest_.cc │ │ │ ├── googletest-listener-test.cc │ │ │ ├── googletest-message-test.cc │ │ │ ├── googletest-options-test.cc │ │ │ ├── googletest-output-test-golden-lin.txt │ │ │ ├── googletest-output-test.py │ │ │ ├── googletest-output-test_.cc │ │ │ ├── googletest-param-test-invalid-name1-test.py │ │ │ ├── googletest-param-test-invalid-name1-test_.cc │ │ │ ├── googletest-param-test-invalid-name2-test.py │ │ │ ├── googletest-param-test-invalid-name2-test_.cc │ │ │ ├── googletest-param-test-test.cc │ │ │ ├── googletest-param-test-test.h │ │ │ ├── googletest-param-test2-test.cc │ │ │ ├── googletest-port-test.cc │ │ │ ├── googletest-printers-test.cc │ │ │ ├── googletest-setuptestsuite-test.py │ │ │ ├── googletest-setuptestsuite-test_.cc │ │ │ ├── googletest-shuffle-test.py │ │ │ ├── googletest-shuffle-test_.cc │ │ │ ├── googletest-test-part-test.cc │ │ │ ├── googletest-throw-on-failure-test.py │ │ │ ├── googletest-throw-on-failure-test_.cc │ │ │ ├── googletest-uninitialized-test.py │ │ │ ├── googletest-uninitialized-test_.cc │ │ │ ├── gtest-typed-test2_test.cc │ │ │ ├── gtest-typed-test_test.cc │ │ │ ├── gtest-typed-test_test.h │ │ │ ├── gtest-unittest-api_test.cc │ │ │ ├── gtest_all_test.cc │ │ │ ├── gtest_assert_by_exception_test.cc │ │ │ ├── gtest_environment_test.cc │ │ │ ├── gtest_help_test.py │ │ │ ├── gtest_help_test_.cc │ │ │ ├── gtest_json_test_utils.py │ │ │ ├── gtest_list_output_unittest.py │ │ │ ├── gtest_list_output_unittest_.cc │ │ │ ├── gtest_main_unittest.cc │ │ │ ├── gtest_no_test_unittest.cc │ │ │ ├── gtest_pred_impl_unittest.cc │ │ │ ├── gtest_premature_exit_test.cc │ │ │ ├── gtest_prod_test.cc │ │ │ ├── gtest_repeat_test.cc │ │ │ ├── gtest_skip_check_output_test.py │ │ │ ├── gtest_skip_environment_check_output_test.py │ │ │ ├── gtest_skip_in_environment_setup_test.cc │ │ │ ├── gtest_skip_test.cc │ │ │ ├── gtest_sole_header_test.cc │ │ │ ├── gtest_stress_test.cc │ │ │ ├── gtest_test_macro_stack_footprint_test.cc │ │ │ ├── gtest_test_utils.py │ │ │ ├── gtest_testbridge_test.py │ │ │ ├── gtest_testbridge_test_.cc │ │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ │ ├── gtest_unittest.cc │ │ │ ├── gtest_xml_outfile1_test_.cc │ │ │ ├── gtest_xml_outfile2_test_.cc │ │ │ ├── gtest_xml_outfiles_test.py │ │ │ ├── gtest_xml_output_unittest.py │ │ │ ├── gtest_xml_output_unittest_.cc │ │ │ ├── gtest_xml_test_utils.py │ │ │ ├── production.cc │ │ │ └── production.h │ ├── library.json │ └── platformio.ini ├── proto-gamelist-test │ ├── CMakeLists.txt │ ├── main.cpp │ └── protoGamesTest.cpp └── proto-textcod-test │ ├── CMakeLists.txt │ ├── main.cpp │ ├── text.cod │ └── textcodTest.cpp ├── thirdparty ├── CMakeLists.txt ├── PlatformFolders │ ├── CMakeLists.txt │ └── PlatformFolders │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── doxygen.conf │ │ ├── platform_folders.cpp │ │ ├── platform_foldersConfig.cmake.in │ │ └── sago │ │ ├── platform_folders.cpp │ │ └── platform_folders.h └── nanogui-sdl │ ├── CMakeLists.txt │ └── nanogui-sdl │ ├── .gitignore │ ├── .travis.yml │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── README.md │ ├── cmake │ ├── FindSDL2.cmake │ ├── FindSDL2IMAGE.cmake │ ├── FindSDL2TTF.cmake │ └── screenshot.png │ ├── example1.cpp │ ├── resources │ ├── Roboto-Bold.ttf │ ├── Roboto-Regular.ttf │ ├── bin2c.c │ ├── entypo.ttf │ ├── icons │ │ ├── icon1.png │ │ ├── icon2.png │ │ ├── icon3.png │ │ ├── icon4.png │ │ ├── icon5.png │ │ ├── icon6.png │ │ ├── icon7.png │ │ └── icon8.png │ └── screenshot1.png │ ├── sdlgui │ ├── button.cpp │ ├── button.h │ ├── checkbox.cpp │ ├── checkbox.h │ ├── colorpicker.cpp │ ├── colorpicker.h │ ├── colorwheel.cpp │ ├── colorwheel.h │ ├── combobox.cpp │ ├── combobox.h │ ├── common.cpp │ ├── common.h │ ├── darwin.mm │ ├── dropdownbox.cpp │ ├── dropdownbox.h │ ├── entypo.h │ ├── fontstash.h │ ├── formhelper.h │ ├── graph.cpp │ ├── graph.h │ ├── imagepanel.cpp │ ├── imagepanel.h │ ├── imageview.cpp │ ├── imageview.h │ ├── label.cpp │ ├── label.h │ ├── layout.cpp │ ├── layout.h │ ├── loadimages.cpp │ ├── messagedialog.cpp │ ├── messagedialog.h │ ├── nanort.h │ ├── nanovg.c │ ├── nanovg.h │ ├── nanovg_rt.h │ ├── popup.cpp │ ├── popup.h │ ├── popupbutton.cpp │ ├── popupbutton.h │ ├── progressbar.cpp │ ├── progressbar.h │ ├── resources.cpp │ ├── resources.h │ ├── screen.cpp │ ├── screen.h │ ├── sdlguii.h │ ├── slider.cpp │ ├── slider.h │ ├── stackedwidget.cpp │ ├── stackedwidget.h │ ├── stb_image.h │ ├── stb_truetype.h │ ├── switchbox.cpp │ ├── switchbox.h │ ├── tabheader.cpp │ ├── tabheader.h │ ├── tabwidget.cpp │ ├── tabwidget.h │ ├── textbox.cpp │ ├── textbox.h │ ├── texturebutton.cpp │ ├── texturebutton.h │ ├── texturetable.h │ ├── textureview.cpp │ ├── textureview.h │ ├── theme.cpp │ ├── theme.h │ ├── toolbutton.h │ ├── vscrollpanel.cpp │ ├── vscrollpanel.h │ ├── widget.cpp │ ├── widget.h │ ├── window.cpp │ └── window.h │ └── twoscreens.cpp └── version.h.in /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | executors: 3 | exec: 4 | docker: 5 | - image: siredmar/mdcii-builder:latest 6 | 7 | jobs: 8 | build: 9 | executor: exec 10 | steps: 11 | - checkout 12 | - run: 13 | name: Create build directories 14 | command: | 15 | mkdir -p build 16 | - run: 17 | name: Setup cmake and build artifacts 18 | command: | 19 | cd build 20 | cmake -DCMAKE_BUILD_TYPE=Release .. 21 | make -j16 22 | - run: 23 | name: Run unit tests 24 | command: | 25 | cd build 26 | ./cacheprotobuf-test 27 | ./proto-gamelist-test 28 | ./proto-textcod-test 29 | - persist_to_workspace: 30 | root: . 31 | paths: build 32 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .git 3 | build -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | \.vscode/ 3 | build 4 | compile_commands.json 5 | .clangd/ 6 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | Armin Schlegel - https://github.com/siredmar 3 | Benedikt Freisen - https://github.com/roybaer 4 | Christian Flach - https://github.com/cmfcmf 5 | 6 | Thanks to all Contributors 7 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{build}' 2 | branches: 3 | only: 4 | - master 5 | clone_folder: c:\projects\cmake-init 6 | image: 7 | - Visual Studio 2013 8 | - Visual Studio 2015 9 | - Visual Studio 2017 10 | configuration: 11 | - Release 12 | - Debug 13 | platform: 14 | - x64 15 | environment: 16 | matrix: 17 | - arch: Win64 18 | # - arch: #does not work, Release|x64 not a valid target 19 | matrix: 20 | fast_finish: true 21 | 22 | # skip unsupported combinations 23 | init: 24 | - set arch= 25 | - if "%arch%"=="Win64" ( set arch= Win64) 26 | - echo %arch% 27 | - echo %APPVEYOR_BUILD_WORKER_IMAGE% 28 | - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set generator="Visual Studio 15 2017%arch%" ) 29 | - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( set generator="Visual Studio 14 2015%arch%" ) 30 | - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" ( set generator="Visual Studio 12 2013%arch%" ) 31 | - echo %generator% 32 | 33 | before_build: 34 | - cmd: |- 35 | mkdir build 36 | cd build 37 | cmake --version 38 | cmake .. -G %generator% 39 | 40 | build: 41 | project: c:\projects\cmake-init\build\template.sln 42 | verbosity: minimal 43 | parallel: true 44 | only_commits: 45 | files: 46 | - CMakeLists.txt 47 | - appveyor.yml 48 | - source/ 49 | - cmake/ 50 | -------------------------------------------------------------------------------- /cmake-init-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/cmake-init-logo.png -------------------------------------------------------------------------------- /cmake/CheckTemplate.cmake: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Get cmake-init latest commit SHA on master 4 | # 5 | 6 | file(DOWNLOAD 7 | "https://api.github.com/repos/cginternals/cmake-init/commits/master" 8 | "${PROJECT_BINARY_DIR}/cmake-init.github.data" 9 | ) 10 | file(READ 11 | "${PROJECT_BINARY_DIR}/cmake-init.github.data" 12 | CMAKE_INIT_INFO 13 | ) 14 | 15 | string(REGEX MATCH 16 | "\"sha\": \"([0-9a-f]+)\"," 17 | CMAKE_INIT_SHA 18 | ${CMAKE_INIT_INFO}) 19 | 20 | string(SUBSTRING 21 | ${CMAKE_INIT_SHA} 22 | 8 23 | 40 24 | CMAKE_INIT_SHA 25 | ) 26 | 27 | # 28 | # Get latest cmake-init commit on this repository 29 | # 30 | 31 | # APPLIED_CMAKE_INIT_SHA can be set by parent script 32 | if(NOT APPLIED_CMAKE_INIT_SHA) 33 | # [TODO]: Get from git commit list (see cmake_init/source/scripts/check_template.sh) 34 | set(APPLIED_CMAKE_INIT_SHA "") 35 | endif () 36 | 37 | if("${APPLIED_CMAKE_INIT_SHA}" STREQUAL "") 38 | message(WARNING 39 | "No cmake-init version detected, could not verify up-to-dateness. " 40 | "Set the cmake-init version by defining a META_CMAKE_INIT_SHA for your project." 41 | ) 42 | return() 43 | endif() 44 | 45 | if(${APPLIED_CMAKE_INIT_SHA} STREQUAL ${CMAKE_INIT_SHA}) 46 | message(STATUS "cmake-init template is up-to-date (${CMAKE_INIT_SHA})") 47 | else() 48 | message(STATUS "cmake-init template needs an update https://github.com/cginternals/cmake-init/compare/${APPLIED_CMAKE_INIT_SHA}...master") 49 | endif() 50 | -------------------------------------------------------------------------------- /cmake/ClangTidy.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Function to register a target for clang-tidy 3 | function(perform_clang_tidy check_target target) 4 | set(includes "$") 5 | 6 | add_custom_target( 7 | ${check_target} 8 | COMMAND 9 | ${clang_tidy_EXECUTABLE} 10 | -p\t${PROJECT_BINARY_DIR} 11 | ${ARGN} 12 | -checks=* 13 | "$<$>:--\t$<$:-I$>>" 14 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 15 | ) 16 | 17 | set_target_properties(${check_target} 18 | PROPERTIES 19 | FOLDER "Maintenance" 20 | EXCLUDE_FROM_DEFAULT_BUILD 1 21 | ) 22 | 23 | add_dependencies(${check_target} ${target}) 24 | endfunction() 25 | -------------------------------------------------------------------------------- /cmake/ComponentInstall.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Execute cmake_install.cmake wrapper that allows to pass both DESTDIR and COMPONENT environment variable 3 | 4 | execute_process( 5 | COMMAND ${CMAKE_COMMAND} -DCOMPONENT=$ENV{COMPONENT} -P cmake_install.cmake 6 | ) 7 | -------------------------------------------------------------------------------- /cmake/Coverage.cmake: -------------------------------------------------------------------------------- 1 | 2 | include(${CMAKE_CURRENT_LIST_DIR}/Gcov.cmake) 3 | 4 | set(OPTION_COVERAGE_ENABLED OFF) 5 | 6 | set(LCOV_EXCLUDE_COVERAGE 7 | ${LCOV_EXCLUDE_COVERAGE} 8 | "\"*/googletest/*\"" 9 | "\"*v1*\"" 10 | "\"/usr/*\"" 11 | ) 12 | 13 | # Function to register a target for enabled coverage report 14 | function(generate_coverage_report target) 15 | if(NOT TARGET coverage) 16 | add_custom_target(coverage) 17 | 18 | set_target_properties(coverage 19 | PROPERTIES 20 | FOLDER "Maintenance" 21 | EXCLUDE_FROM_DEFAULT_BUILD 1 22 | ) 23 | endif() 24 | 25 | if (${OPTION_COVERAGE_ENABLED}) 26 | generate_lcov_report(coverage-${target} ${target} ${ARGN}) 27 | add_dependencies(coverage coverage-${target}) 28 | endif() 29 | endfunction() 30 | 31 | # Enable or disable coverage 32 | function(enable_coverage status) 33 | if(NOT ${status}) 34 | set(OPTION_COVERAGE_ENABLED ${status} PARENT_SCOPE) 35 | message(STATUS "Coverage lcov skipped: Manually disabled") 36 | 37 | return() 38 | endif() 39 | 40 | find_package(lcov) 41 | 42 | if(NOT lcov_FOUND) 43 | set(OPTION_COVERAGE_ENABLED OFF PARENT_SCOPE) 44 | message(STATUS "Coverage lcov skipped: lcov not found") 45 | 46 | return() 47 | endif() 48 | 49 | set(OPTION_COVERAGE_ENABLED ${status} PARENT_SCOPE) 50 | message(STATUS "Coverage report enabled") 51 | endfunction() 52 | -------------------------------------------------------------------------------- /cmake/Cppcheck.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Function to register a target for cppcheck 3 | function(perform_cppcheck check_target target) 4 | set(includes "$") 5 | 6 | add_custom_target( 7 | ${check_target} 8 | COMMAND 9 | ${cppcheck_EXECUTABLE} 10 | "$<$:-I$>" 11 | --enable=all 12 | --std=c++11 13 | --verbose 14 | --suppress=missingIncludeSystem 15 | ${ARGN} 16 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 17 | ) 18 | 19 | set_target_properties(${check_target} 20 | PROPERTIES 21 | FOLDER "Maintenance" 22 | EXCLUDE_FROM_DEFAULT_BUILD 1 23 | ) 24 | 25 | add_dependencies(${check_target} ${target}) 26 | endfunction() 27 | -------------------------------------------------------------------------------- /cmake/Custom.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Set policy if policy is available 3 | function(set_policy POL VAL) 4 | 5 | if(POLICY ${POL}) 6 | cmake_policy(SET ${POL} ${VAL}) 7 | endif() 8 | 9 | endfunction(set_policy) 10 | 11 | 12 | # Define function "source_group_by_path with three mandatory arguments (PARENT_PATH, REGEX, GROUP, ...) 13 | # to group source files in folders (e.g. for MSVC solutions). 14 | # 15 | # Example: 16 | # source_group_by_path("${CMAKE_CURRENT_SOURCE_DIR}/src" "\\\\.h$|\\\\.inl$|\\\\.cpp$|\\\\.c$|\\\\.ui$|\\\\.qrc$" "Source Files" ${sources}) 17 | function(source_group_by_path PARENT_PATH REGEX GROUP) 18 | 19 | foreach (FILENAME ${ARGN}) 20 | 21 | get_filename_component(FILEPATH "${FILENAME}" REALPATH) 22 | file(RELATIVE_PATH FILEPATH ${PARENT_PATH} ${FILEPATH}) 23 | get_filename_component(FILEPATH "${FILEPATH}" DIRECTORY) 24 | 25 | string(REPLACE "/" "\\" FILEPATH "${FILEPATH}") 26 | 27 | source_group("${GROUP}\\${FILEPATH}" REGULAR_EXPRESSION "${REGEX}" FILES ${FILENAME}) 28 | 29 | endforeach() 30 | 31 | endfunction(source_group_by_path) 32 | 33 | 34 | # Function that extract entries matching a given regex from a list. 35 | # ${OUTPUT} will store the list of matching filenames. 36 | function(list_extract OUTPUT REGEX) 37 | 38 | foreach(FILENAME ${ARGN}) 39 | if(${FILENAME} MATCHES "${REGEX}") 40 | list(APPEND ${OUTPUT} ${FILENAME}) 41 | endif() 42 | endforeach() 43 | 44 | set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) 45 | 46 | endfunction(list_extract) 47 | -------------------------------------------------------------------------------- /cmake/FindEGL.cmake: -------------------------------------------------------------------------------- 1 | 2 | # EGL::EGL 3 | # EGL_FOUND 4 | # EGL_INCLUDE_DIR 5 | # EGL_LIBRARY 6 | 7 | include(FindPackageHandleStandardArgs) 8 | 9 | find_path(EGL_INCLUDE_DIR EGL/egl.h 10 | 11 | PATHS 12 | $ENV{EGL_DIR} 13 | /usr 14 | /usr/local 15 | /sw 16 | /opt/local 17 | 18 | PATH_SUFFIXES 19 | /include 20 | 21 | DOC "The directory where EGL/egl.h resides") 22 | 23 | find_library(EGL_LIBRARY NAMES EGL 24 | 25 | PATHS 26 | $ENV{EGL_DIR} 27 | /usr 28 | /usr/local 29 | /sw 30 | /opt/local 31 | 32 | # authors prefered choice for development 33 | 34 | PATH_SUFFIXES 35 | /lib 36 | /lib64 37 | /lib/x86_64-linux-gnu 38 | 39 | DOC "The EGL library") 40 | 41 | add_library(EGL::EGL SHARED IMPORTED) 42 | 43 | set_target_properties(EGL::EGL PROPERTIES 44 | INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" 45 | INTERFACE_LINK_LIBRARIES "${EGL_LIBRARY}" 46 | ) 47 | 48 | set_property(TARGET EGL::EGL APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 49 | set_target_properties(EGL::EGL PROPERTIES 50 | IMPORTED_LOCATION_RELEASE "${EGL_LIBRARY}" 51 | ) 52 | 53 | find_package_handle_standard_args(EGL REQUIRED_VARS EGL_INCLUDE_DIR EGL_LIBRARY) 54 | mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY) 55 | 56 | -------------------------------------------------------------------------------- /cmake/FindGLESv2.cmake: -------------------------------------------------------------------------------- 1 | 2 | # GLESv2::GLESv2 3 | # GLESv2_FOUND 4 | # GLESv2_INCLUDE_DIR 5 | # GLESv2_LIBRARY 6 | 7 | include(FindPackageHandleStandardArgs) 8 | 9 | find_path(GLESv2_INCLUDE_DIR GLES2/gl2.h 10 | 11 | PATHS 12 | $ENV{GLESv2_DIR} 13 | /usr 14 | /usr/local 15 | /sw 16 | /opt/local 17 | 18 | PATH_SUFFIXES 19 | /include 20 | 21 | DOC "The directory where GLESv2/GLESv2.h resides") 22 | 23 | find_library(GLESv2_LIBRARY NAMES GLESv2 24 | 25 | PATHS 26 | $ENV{GLESv2_DIR} 27 | /usr 28 | /usr/local 29 | /sw 30 | /opt/local 31 | 32 | # authors prefered choice for development 33 | 34 | PATH_SUFFIXES 35 | /lib 36 | /lib64 37 | /lib/x86_64-linux-gnu 38 | 39 | DOC "The GLESv2 library") 40 | 41 | add_library(GLESv2::GLESv2 SHARED IMPORTED) 42 | 43 | set_target_properties(GLESv2::GLESv2 PROPERTIES 44 | INTERFACE_INCLUDE_DIRECTORIES "${GLESv2_INCLUDE_DIR}" 45 | INTERFACE_LINK_LIBRARIES "${GLESv2_LIBRARY}" 46 | ) 47 | 48 | set_property(TARGET GLESv2::GLESv2 APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 49 | set_target_properties(GLESv2::GLESv2 PROPERTIES 50 | IMPORTED_LOCATION_RELEASE "${GLESv2_LIBRARY}" 51 | ) 52 | 53 | find_package_handle_standard_args(GLESv2 REQUIRED_VARS GLESv2_INCLUDE_DIR GLESv2_LIBRARY) 54 | mark_as_advanced(GLESv2_INCLUDE_DIR GLESv2_LIBRARY) 55 | 56 | -------------------------------------------------------------------------------- /cmake/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | 2 | # GLEW_FOUND 3 | # GLEW_INCLUDE_DIR 4 | # GLEW_LIBRARY 5 | 6 | # GLEW_BINARY (win32 only) 7 | 8 | include(FindPackageHandleStandardArgs) 9 | 10 | find_path(GLEW_INCLUDE_DIR GL/glew.h 11 | 12 | PATHS 13 | $ENV{GLEW_DIR} 14 | /usr 15 | /usr/local 16 | /sw 17 | /opt/local 18 | 19 | PATH_SUFFIXES 20 | /include 21 | 22 | DOC "The directory where GL/glew.h resides") 23 | 24 | if (X64) 25 | set(GLEW_BUILD_DIR Release/x64) 26 | else() 27 | set(GLEW_BUILD_DIR Release/Win32) 28 | endif() 29 | 30 | find_library(GLEW_LIBRARY NAMES GLEW glew glew32 glew32s 31 | 32 | PATHS 33 | $ENV{GLEW_DIR} 34 | /usr 35 | /usr/local 36 | /sw 37 | /opt/local 38 | 39 | # authors prefered choice for development 40 | /build 41 | /build-release 42 | /build-debug 43 | $ENV{GLEW_DIR}/build 44 | $ENV{GLEW_DIR}/build-release 45 | $ENV{GLEW_DIR}/build-debug 46 | 47 | PATH_SUFFIXES 48 | /lib 49 | /lib64 50 | /lib/${GLEW_BUILD_DIR} 51 | 52 | DOC "The GLEW library") 53 | 54 | if(WIN32) 55 | 56 | find_file(GLEW_BINARY NAMES glew32.dll glew32s.dll 57 | 58 | HINTS 59 | ${GLEW_INCLUDE_DIR}/.. 60 | 61 | PATHS 62 | $ENV{GLEW_DIR} 63 | 64 | PATH_SUFFIXES 65 | /bin 66 | /bin/${GLEW_BUILD_DIR} 67 | 68 | DOC "The GLEW binary") 69 | 70 | endif() 71 | 72 | find_package_handle_standard_args(GLEW REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) 73 | mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) 74 | -------------------------------------------------------------------------------- /cmake/FindHIDAPI.cmake: -------------------------------------------------------------------------------- 1 | 2 | # HIDAPI_FOUND 3 | # HIDAPI_INCLUDE_DIRS 4 | # HIDAPI_LIBRARIES 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | find_path(HIDAPI_INCLUDE_DIRS 9 | NAMES hidapi/hidapi.h 10 | /usr/include 11 | /usr/local/include 12 | /sw/include 13 | /opt/local/include 14 | DOC "The directory where hidapi/hidapi.h resides") 15 | 16 | find_library(HIDAPI_LIBRARIES 17 | NAMES hidapi-hidraw hidapi-libusb 18 | PATHS 19 | /usr/lib64 20 | /usr/local/lib64 21 | /sw/lib64 22 | /opt/loca/lib64 23 | /usr/lib 24 | /usr/local/lib 25 | /sw/lib 26 | /opt/local/lib 27 | DOC "The hidapi library") 28 | 29 | 30 | find_package_handle_standard_args(HIDAPI REQUIRED_VARS HIDAPI_LIBRARIES HIDAPI_INCLUDE_DIRS) 31 | 32 | mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY) 33 | 34 | -------------------------------------------------------------------------------- /cmake/Findclang_tidy.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findclang_tidy results: 3 | # clang_tidy_FOUND 4 | # clang_tidy_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | find_program(clang_tidy_EXECUTABLE 9 | NAMES 10 | clang-tidy-3.5 11 | clang-tidy-3.6 12 | clang-tidy-3.7 13 | clang-tidy-3.8 14 | clang-tidy-3.9 15 | clang-tidy-4.0 16 | clang-tidy 17 | PATHS 18 | "${CLANG_TIDY_DIR}" 19 | ) 20 | 21 | find_package_handle_standard_args(clang_tidy 22 | FOUND_VAR 23 | clang_tidy_FOUND 24 | REQUIRED_VARS 25 | clang_tidy_EXECUTABLE 26 | ) 27 | 28 | mark_as_advanced(clang_tidy_EXECUTABLE) -------------------------------------------------------------------------------- /cmake/Findcppcheck.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findcppcheck results: 3 | # cppcheck_FOUND 4 | # cppcheck_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | # work around CMP0053, see http://public.kitware.com/pipermail/cmake/2014-November/059117.html 9 | set(PROGRAMFILES_x86_ENV "PROGRAMFILES(x86)") 10 | 11 | find_program(cppcheck_EXECUTABLE 12 | NAMES 13 | cppcheck 14 | PATHS 15 | "${CPPCHECK_DIR}" 16 | "$ENV{CPPCHECK_DIR}" 17 | "$ENV{PROGRAMFILES}/Cppcheck" 18 | "$ENV{${PROGRAMFILES_x86_ENV}}/Cppcheck" 19 | ) 20 | 21 | find_package_handle_standard_args(cppcheck 22 | FOUND_VAR 23 | cppcheck_FOUND 24 | REQUIRED_VARS 25 | cppcheck_EXECUTABLE 26 | ) 27 | 28 | mark_as_advanced(cppcheck_EXECUTABLE) 29 | -------------------------------------------------------------------------------- /cmake/Findgcov.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findgcov results: 3 | # gcov_FOUND 4 | # gcov_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | # work around CMP0053, see http://public.kitware.com/pipermail/cmake/2014-November/059117.html 9 | set(PROGRAMFILES_x86_ENV "PROGRAMFILES(x86)") 10 | 11 | find_program(gcov_EXECUTABLE 12 | NAMES 13 | gcov 14 | PATHS 15 | "${GCOV_DIR}" 16 | "$ENV{GCOV_DIR}" 17 | "$ENV{PROGRAMFILES}/gcov" 18 | "$ENV{${PROGRAMFILES_x86_ENV}}/gcov" 19 | ) 20 | 21 | find_package_handle_standard_args(gcov 22 | FOUND_VAR 23 | gcov_FOUND 24 | REQUIRED_VARS 25 | gcov_EXECUTABLE 26 | ) 27 | 28 | mark_as_advanced(gcov_EXECUTABLE) 29 | -------------------------------------------------------------------------------- /cmake/Findlcov.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findlcov results: 3 | # lcov_FOUND 4 | # lcov_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | # work around CMP0053, see http://public.kitware.com/pipermail/cmake/2014-November/059117.html 9 | set(PROGRAMFILES_x86_ENV "PROGRAMFILES(x86)") 10 | 11 | find_program(lcov_EXECUTABLE 12 | NAMES 13 | lcov 14 | PATHS 15 | "${LCOV_DIR}" 16 | "$ENV{LCOV_DIR}" 17 | "$ENV{PROGRAMFILES}/lcov" 18 | "$ENV{${PROGRAMFILES_x86_ENV}}/lcov" 19 | ) 20 | 21 | find_program(genhtml_EXECUTABLE 22 | NAMES 23 | genhtml 24 | PATHS 25 | "${LCOV_DIR}" 26 | "$ENV{LCOV_DIR}" 27 | "$ENV{PROGRAMFILES}/lcov" 28 | "$ENV{${PROGRAMFILES_x86_ENV}}/lcov" 29 | ) 30 | 31 | find_package_handle_standard_args(lcov 32 | FOUND_VAR 33 | lcov_FOUND 34 | REQUIRED_VARS 35 | lcov_EXECUTABLE 36 | genhtml_EXECUTABLE 37 | ) 38 | 39 | mark_as_advanced( 40 | lcov_EXECUTABLE 41 | genhtml_EXECUTABLE 42 | ) 43 | -------------------------------------------------------------------------------- /cmake/Findnodejs.cmake: -------------------------------------------------------------------------------- 1 | 2 | # NODEJS_FOUND 3 | # NODEJS_INCLUDE_DIRS 4 | # NODEJS_INCLUDE_DIR 5 | # NODEJS_LIBUV_INCLUDE_DIR 6 | 7 | include(FindPackageHandleStandardArgs) 8 | 9 | find_path(NODEJS_INCLUDE_DIR node.h 10 | $ENV{NODEJS_HOME} 11 | $ENV{NODEJSDIR} 12 | $ENV{NODEJS_HOME}/src 13 | $ENV{NODEJSDIR}/src 14 | /usr/include/nodejs/src 15 | /usr/local/include/nodejs/src 16 | /usr/include 17 | /usr/local/include 18 | /sw/include 19 | /usr/local/include/node 20 | /opt/local/include 21 | DOC "The directory where node.h resides.") 22 | 23 | find_path(NODEJS_LIBUV_INCLUDE_DIR uv.h 24 | $ENV{NODEJS_HOME} 25 | $ENV{NODEJSDIR} 26 | $ENV{NODEJS_HOME}/src 27 | $ENV{NODEJSDIR}/src 28 | $ENV{NODEJS_HOME}/deps/uv/include 29 | $ENV{NODEJSDIR}/deps/uv/include 30 | /usr/include/nodejs/deps/uv/include 31 | /usr/local/include/nodejs/deps/uv/include 32 | /usr/include 33 | /usr/local/include 34 | /sw/include 35 | /opt/local/include 36 | /usr/local/include/node 37 | DOC "The directory where uv.h resides.") 38 | 39 | find_path(NODEJS_LIBV8_INCLUDE_DIR v8.h 40 | $ENV{NODEJS_HOME} 41 | $ENV{NODEJSDIR} 42 | $ENV{NODEJS_HOME}/src 43 | $ENV{NODEJSDIR}/src 44 | $ENV{NODEJS_HOME}/deps/v8/include 45 | $ENV{NODEJSDIR}/deps/v8/include 46 | /usr/include/nodejs/deps/uv/include 47 | /usr/local/include/nodejs/deps/uv/include 48 | /usr/include 49 | /usr/local/include 50 | /sw/include 51 | /opt/local/include 52 | /usr/local/include/node 53 | DOC "The directory where v8.h resides.") 54 | 55 | set(NODEJS_INCLUDE_DIRS ${NODEJS_INCLUDE_DIR} ${NODEJS_LIBUV_INCLUDE_DIR} ${NODEJS_LIBV8_INCLUDE_DIR}) 56 | 57 | find_package_handle_standard_args(NODEJS REQUIRED_VARS NODEJS_INCLUDE_DIRS) 58 | mark_as_advanced(NODEJS_INCLUDE_DIRS) 59 | -------------------------------------------------------------------------------- /cmake/GenerateTemplateExportHeader.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Creates an export header similar to generate_export_header, but for templates. 3 | # The main difference is that for MSVC, templates must not get exported. 4 | # When the file ${export_file} is included in source code, the macro ${target_id}_TEMPLATE_API 5 | # may get used to define public visibility for templates on GCC and Clang platforms. 6 | function(generate_template_export_header target target_id export_file) 7 | if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") 8 | configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_msvc_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file} @ONLY) 9 | else() 10 | configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file} @ONLY) 11 | endif() 12 | endfunction() 13 | -------------------------------------------------------------------------------- /cmake/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright Iowa State University 2009-2010. 12 | # Distributed under the Boost Software License, Version 1.0. 13 | # (See accompanying file LICENSE_1_0.txt or copy at 14 | # http://www.boost.org/LICENSE_1_0.txt) 15 | 16 | set(HEAD_HASH) 17 | set(HEAD_REF) 18 | 19 | if (NOT EXISTS "@HEAD_FILE@") 20 | return() 21 | endif() 22 | 23 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 24 | 25 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 26 | if(HEAD_CONTENTS MATCHES "ref") 27 | # named branch 28 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 29 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 30 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 31 | elseif(EXISTS "@GIT_DIR@/packed-refs") 32 | configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) 33 | file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) 34 | if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") 35 | set(HEAD_HASH "${CMAKE_MATCH_1}") 36 | endif() 37 | endif() 38 | else() 39 | # detached HEAD 40 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 41 | endif() 42 | 43 | if(NOT HEAD_HASH AND EXISTS "@GIT_DATA@/head-ref") 44 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 45 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 46 | endif() 47 | -------------------------------------------------------------------------------- /cmake/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/cmake/README.md -------------------------------------------------------------------------------- /cmake/RuntimeDependencies.cmake: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Default dependencies for the runtime-package 4 | # 5 | 6 | # Install 3rd-party runtime dependencies into runtime-component 7 | # install(FILES ... COMPONENT runtime) 8 | 9 | 10 | # 11 | # Full dependencies for self-contained packages 12 | # 13 | 14 | if(OPTION_SELF_CONTAINED) 15 | 16 | # Install 3rd-party runtime dependencies into runtime-component 17 | # install(FILES ... COMPONENT runtime) 18 | 19 | endif() 20 | -------------------------------------------------------------------------------- /deploy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Target 'pack' 4 | # 5 | 6 | add_custom_target(pack) 7 | set_target_properties(pack PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1) 8 | 9 | 10 | # Install additional runtime dependencies 11 | include(${PROJECT_SOURCE_DIR}/cmake/RuntimeDependencies.cmake) 12 | 13 | 14 | # 15 | # Packages 16 | # 17 | 18 | include(packages/pack-${META_PROJECT_NAME}.cmake) 19 | 20 | 21 | # 22 | # Target 'component_install' 23 | # 24 | 25 | add_custom_target( 26 | component_install 27 | COMMAND make preinstall 28 | COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/ComponentInstall.cmake 29 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR} 30 | ) 31 | -------------------------------------------------------------------------------- /deploy/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Deployment Types 3 | 4 | ## System Install 5 | 6 | ## Global Install 7 | 8 | ## Source Build 9 | 10 | ## Relocatable 11 | 12 | # Packages and Installer 13 | 14 | ## Package Manager 15 | 16 | # Components 17 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/changelog: -------------------------------------------------------------------------------- 1 | 2 | cmake-init (2.0.0-0) UNRELEASED; urgency=low 3 | 4 | * Initial release. 5 | 6 | -- Willy Scheibel Tue, 31 Jan 2017 13:30:00 +0100 7 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/control: -------------------------------------------------------------------------------- 1 | Source: cmake-init 2 | Section: misc 3 | Priority: optional 4 | Maintainer: Willy Scheibel 5 | Build-Depends: build-essential, cmake, qtbase5-dev, doxygen, graphviz 6 | Standards-Version: 3.8.0 7 | 8 | Package: libcmake-init 9 | Architecture: any 10 | Depends: 11 | Homepage: https://github.com/cginternals/cmake-init 12 | Description: Template for reliable, cross-platform C++ project setup using cmake. 13 | 14 | Package: libcmake-init-dev 15 | Architecture: any 16 | Depends: libcmake-init 17 | Homepage: https://github.com/cginternals/cmake-init 18 | Description: Template for reliable, cross-platform C++ project setup using cmake. 19 | 20 | Package: libcmake-init-examples-data 21 | Architecture: any 22 | Homepage: https://github.com/cginternals/cmake-init 23 | Description: Template for reliable, cross-platform C++ project setup using cmake. 24 | 25 | Package: libcmake-init-examples 26 | Architecture: any 27 | Depends: libcmake-init, libcmake-init-examples-data, libqt5core5a 28 | Homepage: https://github.com/cginternals/cmake-init 29 | Description: Template for reliable, cross-platform C++ project setup using cmake. 30 | 31 | Package: libcmake-init-docs 32 | Architecture: any 33 | Homepage: https://github.com/cginternals/cmake-init 34 | Description: Template for reliable, cross-platform C++ project setup using cmake. 35 | 36 | Package: libcmake-init-dbg 37 | Architecture: any 38 | Depends: libcmake-init, libcmake-init-dev 39 | Homepage: https://github.com/cginternals/cmake-init 40 | Description: Template for reliable, cross-platform C++ project setup using cmake. 41 | 42 | Package: libcmake-init-all 43 | Architecture: any 44 | Depends: libcmake-init, libcmake-init-dev, libcmake-init-docs, libcmake-init-examples 45 | Homepage: https://github.com/cginternals/cmake-init 46 | Description: Template for reliable, cross-platform C++ project setup using cmake. -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianised by Willy Scheibel on 2 | Tue, 31 Jan 2017 13:30:00 +0100 3 | 4 | It was downloaded from: 5 | 6 | https://github.com/cginternals/cmake-init 7 | 8 | Upstream Author: 9 | 10 | CG Internals 11 | 12 | Copyright: 13 | 14 | Copyright (c) 2015-2017 CG Internals GmbH and Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany. 15 | 16 | License: 17 | 18 | This software is available to you under the terms of the MIT license, see "https://github.com/cginternals/cmake-init/blob/master/LICENSE". 19 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/recipe.txt: -------------------------------------------------------------------------------- 1 | # git-build-recipe format 0.4 deb-version {debupstream}+{revno} 2 | lp:cmake-init 3 | nest-part packaging lp:cmake-init deploy/ubuntu-ppa/debian debian master 4 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | RUN apt-get update && \ 4 | apt-get install -y --no-install-recommends \ 5 | build-essential \ 6 | cmake \ 7 | libsdl2-dev \ 8 | libsdl2-image-2.0-0 \ 9 | libsdl2-image-dev \ 10 | libsdl2-ttf-2.0-0 \ 11 | libsdl2-ttf-dev \ 12 | libboost-system1.65.1 \ 13 | libboost-system1.65-dev \ 14 | libboost-regex1.65.1 \ 15 | libboost-regex1.65-dev \ 16 | libboost-program-options1.65.1 \ 17 | libboost-program-options1.65-dev \ 18 | libboost-iostreams1.65.1 \ 19 | libboost-iostreams1.65-dev \ 20 | libboost-filesystem1.65.1 \ 21 | libboost-filesystem1.65-dev \ 22 | libprotobuf-dev \ 23 | libprotobuf-c-dev \ 24 | protobuf-compiler \ 25 | protobuf-c-compiler \ 26 | gcc-8 \ 27 | g++-8 \ 28 | gosu && \ 29 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8 && \ 30 | update-alternatives --config gcc && \ 31 | apt-get clean && \ 32 | rm -rf /var/lib/apt/lists/* 33 | 34 | WORKDIR /build 35 | 36 | COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh 37 | RUN chmod +x /usr/local/bin/entrypoint.sh 38 | 39 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] 40 | -------------------------------------------------------------------------------- /docker/Readme.md: -------------------------------------------------------------------------------- 1 | # MDCII docker builder image 2 | 3 | This image contains everything to build mdcii within a docker environment for ubuntu 18.04. 4 | 5 | ## Precondition 6 | 7 | Clone the repository somewhere 8 | 9 | cd /projects 10 | git clone https://github.com/siredmar/mdcii-engine 11 | cd mdcii-engine 12 | 13 | ## How to build the image 14 | 15 | Go to the projects root directory 16 | 17 | cd /projects/mdcii-engine 18 | docker build --tag mdcii-builder -f docker/Dockerfile . 19 | 20 | ## Building mdcii with the builder image 21 | 22 | # define the build directory and thus where to store the compiled artifacts 23 | MDCII_OUTPUT_DIR=/tmp/mdcii 24 | 25 | # build it! 26 | cd /projects/mdcii-engine 27 | docker run --rm -it -v /projects/mdcii-engine:/source -v ${MDCII_OUTPUT_DIR}:/build siredmar/mdcii-builder bash -c "cmake -DCMAKE_BUILD_TYPE=Debug /source && make -j$(nproc)" 28 | -------------------------------------------------------------------------------- /docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Add non root user 4 | # Either use the LOCAL_USER_ID if passed in at runtime or 5 | # fallback 6 | USER_ID=${LOCAL_USER_ID:-8000} 7 | 8 | echo "Starting with UID : ${USER_ID}" 9 | useradd --shell /bin/bash -u "${USER_ID}" -o -m user 10 | export HOME=/home/user 11 | 12 | mkdir -p /build 13 | chown user:user /build 14 | 15 | exec gosu user "$@" 16 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Target 'docs' 4 | # 5 | 6 | if(NOT OPTION_BUILD_DOCS) 7 | return() 8 | endif() 9 | 10 | add_custom_target(docs) 11 | 12 | 13 | # 14 | # Documentation 15 | # 16 | 17 | add_subdirectory(api-docs) 18 | add_subdirectory(manual) 19 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/docs/README.md -------------------------------------------------------------------------------- /docs/api-docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Find doxygen 4 | # 5 | 6 | find_package(Doxygen) 7 | if(NOT DOXYGEN_FOUND) 8 | message(STATUS "Disabled generation of doxygen documentation (missing doxygen).") 9 | return() 10 | endif() 11 | 12 | 13 | # 14 | # Target name 15 | # 16 | 17 | set(target api-docs) 18 | message(STATUS "Doc ${target}") 19 | 20 | 21 | # 22 | # Input file 23 | # 24 | 25 | set(doxyfile_in doxyfile.in) 26 | 27 | 28 | # 29 | # Create documentation 30 | # 31 | 32 | # Set project variables 33 | set(doxyfile "${CMAKE_CURRENT_BINARY_DIR}/doxyfile") 34 | set(doxyfile_directory "${CMAKE_CURRENT_BINARY_DIR}/html") 35 | set(doxyfile_html "${doxyfile_directory}/index.html") 36 | 37 | # Get filename and path of doxyfile 38 | get_filename_component(name ${doxyfile_in} NAME) 39 | get_filename_component(path ${doxyfile_in} PATH) 40 | if(NOT path) 41 | set(path ${CMAKE_CURRENT_SOURCE_DIR}) 42 | endif() 43 | 44 | # Configure doxyfile (if it is a real doxyfile already, it should simply copy the file) 45 | set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 46 | configure_file(${doxyfile_in} ${doxyfile} @ONLY) 47 | 48 | # Invoke doxygen 49 | add_custom_command( 50 | OUTPUT ${doxyfile_html} 51 | DEPENDS ${doxyfile} ${META_PROJECT_NAME}::baselib ${META_PROJECT_NAME}::fiblib 52 | WORKING_DIRECTORY ${path} 53 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${path} ${doxyfile_directory} # ToDO, configure doxygen to use source as is 54 | COMMAND ${DOXYGEN} \"${doxyfile}\" 55 | COMMENT "Creating doxygen documentation." 56 | ) 57 | 58 | # Declare target 59 | add_custom_target(${target} ALL DEPENDS ${doxyfile_html}) 60 | add_dependencies(docs ${target}) 61 | 62 | 63 | # 64 | # Deployment 65 | # 66 | 67 | install( 68 | DIRECTORY ${doxyfile_directory} 69 | DESTINATION ${INSTALL_DOC} 70 | COMPONENT docs 71 | ) 72 | -------------------------------------------------------------------------------- /docs/doc/README.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | This folder is intended to document all those things for which doxygen comments are unsuitable. 4 | -------------------------------------------------------------------------------- /docs/doc/bshdump.md: -------------------------------------------------------------------------------- 1 | # mdcii-bshdump 2 | 3 | With `bshdump` a tool for unpacking the \`bsh' graphic archives is available. 4 | 5 | ## Operation 6 | 7 | The program accepts the following command line parameters: 8 | 9 | Allowed options: 10 | -i [ --input ] arg Input file (*.bsh) 11 | -f [ --format ] arg (=pnm) Format (bmp or pnm) 12 | -b [ --bpp ] arg (=24) Bits per pixel (8 or 24) 13 | -p [ --prefix ] arg (=g_) Prefix (including path) for the target file names 14 | -c [ --color ] arg (=0) background color for transparent areas 15 | -h [ --help ] Outputs this help text 16 | -------------------------------------------------------------------------------- /docs/doc/bshpacker.md: -------------------------------------------------------------------------------- 1 | # mdcii-bshpacker 2 | 3 | With `bshpacker` a tool for packing the `bsh` graphic archives is available. 4 | 5 | ## Operation 6 | 7 | The program accepts the following command line parameters: 8 | 9 | Allowed options: 10 | -o [ --output ] arg Target file (*.bsh, *.zei) 11 | -s [ --signature ] arg (=BSH) Signature (BSH or ZEI) 12 | -f [ --format ] arg (=pnm) Format (bmp or pnm) 13 | -b [ --bpp ] arg (=8) Bits per pixel (8 or 24) 14 | -p [ --prefix ] arg (=g_) Prefix (including path) for the names of the 15 | Source files 16 | -n [ --number ] arg (=1) Number of images to be processed (with numbers 0 17 | to n-1) 18 | -c [ --color ] arg (=0) background color for transparent areas 19 | -e [ --extra ] arg (=0) Extra columns in the output files 20 | -h [ --help ] Outputs this help text 21 | 22 | Translated with www.DeepL.com/Translator (free version) 23 | -------------------------------------------------------------------------------- /docs/doc/mdcii-sdltest.md: -------------------------------------------------------------------------------- 1 | # mdcii-sdltest 2 | 3 | The programm `mdcii-sdltest` is the main program of mdcii. It provides the main menu and allows to view savegames and single player scenarios. 4 | 5 | ## Usage 6 | 7 | There are following command line arguments: 8 | 9 | Options: 10 | -w [ --width ] arg (=1024) Screen width 11 | -h [ --height ] arg (=768) Screen height 12 | -f [ --fullscreen ] arg (=0) Fullscreen (true/false) 13 | -p [ --path ] arg (=.) Path to your instalation path of the game 14 | -h [ --help ] Prints this help 15 | -------------------------------------------------------------------------------- /docs/doc/produktion.md: -------------------------------------------------------------------------------- 1 | # Production sequence 2 | 3 | Notes on changes in the Prodlist data between saved scores immediately after each other 4 | 5 | 0e 05 29 6 | 7 | active building without resources: wait step 3 probably reduced by 4 to 10 => ani increased from 3 to 4 and load_denominator from 179 to 190 8 | 9 | 0e 28 10 10 | 11 | load_denominator = 231 => load_denominator = 121 (= (231+11)/2 ) 12 | 0e 0b 18 13 | 229 => 120 14 | 15 | Assumption for ani: Number of zero crossings of the waiting step without production 16 | 17 | With production 18 | 19 | 0e 0c 25 20 | 0e 13 16 21 | 0e 13 1e 22 | 23 | Assumed sequence 24 | 25 | wait step is reduced by 1 every second. 26 | At zero crossing 27 | 28 | - a modulo dependent on the building type is added to wait step. 29 | - the modulo is added to occupancy_denominator 30 | - if the building is currently producing (i.e. if there are enough raw materials) 31 | - another type-dependent value added to load_counter 32 | - ani set to 0 33 | - a type-dependent value of raw material (and raw material2) deducted 34 | - a type-dependent value added to product 35 | - otherwise 36 | - ani increased by 1 (not above 0x0f) 37 | 38 | If utilization_denominator exceeds a certain value, utilization_denominator and utilization_counter are halved. 39 | 40 | Translated with www.DeepL.com/Translator (free version) 41 | -------------------------------------------------------------------------------- /docs/doc/unbekannt.md: -------------------------------------------------------------------------------- 1 | # Fehlende Informationen 2 | 3 | ## Schiffe 4 | 5 | - Weiße Flagge 6 | - Patrouille (Punkt 1, Punkt 2) 7 | - Im Angriff 8 | - Animationsschritt? 9 | - Sinkt gerade 10 | - Formation? 11 | 12 | ## Werft 13 | 14 | - Lagerstand Stoffe (wird offenbar nicht mitgespeichert) 15 | - Hat Rohstoffmangel 16 | - Auslastung? 17 | - Lebenspunkte? 18 | 19 | ## Timer 20 | 21 | (alles unbekannt) 22 | 23 | ## Player 24 | 25 | - Punktestand 26 | - ... 27 | 28 | ## Soldat 29 | 30 | - Formation 31 | - ... 32 | -------------------------------------------------------------------------------- /docs/doc/warencodes.md: -------------------------------------------------------------------------------- 1 | # Warencodes 2 | 3 | | Code | Ware | 4 | | ------ | ------------ | 5 | | 0x0961 | Eisenerz | 6 | | 0x0965 | Gold | 7 | | 0x05e1 | Wolle | 8 | | 0x05e7 | Zuckerrohr | 9 | | 0x05e3 | Tabak | 10 | | 0x05e9 | Schlachtvieh | 11 | | 0x05df | Weizen | 12 | | 0x01f5 | Mehl | 13 | | 0x0209 | Eisen | 14 | | 0x0205 | Schwerter | 15 | | 0x0211 | Musketen | 16 | | 0x020f | Kanonen | 17 | | 0x0433 | Nahrung | 18 | | 0x020d | Tabakwaren | 19 | | 0x05dd | Gewürze | 20 | | 0x05e5 | Kakao | 21 | | 0x0207 | Alkohol | 22 | | 0x01fb | Stoffe | 23 | | 0x01f9 | Kleidung | 24 | | 0x0215 | Schmuck | 25 | | 0x0203 | Werkzeug | 26 | | 0x07d1 | Holz | 27 | | 0x0201 | Steine | 28 | 29 | Folgende Codes werden für Soldaten im Laderaum von Schiffen verwendet: 30 | 31 | | Code | Einheit | 32 | | ------ | ------------------ | 33 | | 0x26ad | Infanterist (rot) | 34 | | 0x26ae | Infanterist (blau) | 35 | | 0x26af | Infanterist (gelb) | 36 | | 0x26b0 | Infanterist (grau) | 37 | | 0x26b1 | Kavallerist (rot) | 38 | | 0x26b2 | Kavallerist (blau) | 39 | | 0x26b3 | Kavallerist (gelb) | 40 | | 0x26b4 | Kavallerist (grau) | 41 | | 0x26b5 | Musketier (rot) | 42 | | 0x26b6 | Musketier (blau) | 43 | | 0x26b7 | Musketier (gelb) | 44 | | 0x26b8 | Musketier (grau) | 45 | | 0x26b9 | Kanonier (rot) | 46 | | 0x26ba | Kanonier (blau) | 47 | | 0x26bb | Kanonier (gelb) | 48 | | 0x26bc | Kanonier (grau) | 49 | 50 | Die Farbe wird im Spiel nicht angezeigt und beim Ausladen überschrieben. 51 | -------------------------------------------------------------------------------- /docs/manual/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Find LaTeX 4 | # 5 | 6 | find_package(LATEX) 7 | if(NOT LATEX_FOUND) 8 | message(STATUS "Disabled generation of documentation (missing LaTeX).") 9 | return() 10 | endif() 11 | 12 | 13 | # 14 | # Target name 15 | # 16 | 17 | set(target docs-manual) 18 | message(STATUS "Doc ${target}") 19 | 20 | 21 | # 22 | # Input and output files 23 | # 24 | 25 | set(source "${CMAKE_CURRENT_SOURCE_DIR}/cmake-init.tex") 26 | set(pdf "${CMAKE_CURRENT_BINARY_DIR}/cmake-init.pdf") 27 | 28 | 29 | # 30 | # Create documentation 31 | # 32 | 33 | # Invoke LaTeX 34 | add_custom_command( 35 | OUTPUT ${pdf} 36 | DEPENDS ${source} 37 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 38 | COMMAND ${PDFLATEX_COMPILER} \"${source}\" 39 | COMMAND ${PDFLATEX_COMPILER} \"${source}\" 40 | COMMAND ${PDFLATEX_COMPILER} \"${source}\" 41 | COMMENT "Creating LaTeX documentation." 42 | ) 43 | 44 | # Declare target 45 | add_custom_target(${target} ALL DEPENDS ${pdf}) 46 | add_dependencies(docs ${target}) 47 | 48 | 49 | # 50 | # Deployment 51 | # 52 | 53 | # PDF file 54 | install(FILES ${pdf} 55 | DESTINATION "${INSTALL_DOC}" 56 | COMPONENT docs 57 | ) 58 | -------------------------------------------------------------------------------- /docs/manual/cmake-init.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | 4 | \usepackage[pdfborder={0 0 0}]{hyperref} 5 | 6 | \begin{document} 7 | 8 | \title{cmake-init: C++ CMake Project Template} 9 | 10 | \maketitle 11 | 12 | \begin{abstract} 13 | \noindent 14 | cmake-init is a copy and paste template, that provides the following features: 15 | 16 | \begin{itemize} 17 | \item Cross Platform 18 | \begin{itemize} 19 | \item Windows 20 | \item Linux 21 | \item Mac 22 | \end{itemize} 23 | \item Libraries, Applications, Testing template 24 | \item Documentation template 25 | \item Installation, Packaging template 26 | \item CMake find script template for defined libraries 27 | \end{itemize} 28 | 29 | \end{abstract} 30 | 31 | \setcounter{tocdepth}{2} 32 | \tableofcontents 33 | 34 | \newpage 35 | 36 | \end{document} 37 | -------------------------------------------------------------------------------- /mdcii-config.cmake: -------------------------------------------------------------------------------- 1 | 2 | # This config script tries to locate the project either in its source tree 3 | # or from an install location. 4 | # 5 | # Please adjust the list of submodules to search for. 6 | 7 | 8 | # Find depencencies 9 | include(CMakeFindDependencyMacro) 10 | #find_dependency(glm) 11 | 12 | 13 | # List of modules 14 | set(MODULE_NAMES 15 | baselib 16 | fiblib 17 | ) 18 | 19 | 20 | # Macro to search for a specific module 21 | macro(find_module FILENAME) 22 | if(EXISTS "${FILENAME}") 23 | set(MODULE_FOUND TRUE) 24 | include("${FILENAME}") 25 | endif() 26 | endmacro() 27 | 28 | # Macro to search for all modules 29 | macro(find_modules PREFIX) 30 | foreach(module_name ${MODULE_NAMES}) 31 | if(TARGET ${module_name}) 32 | set(MODULE_FOUND TRUE) 33 | else() 34 | find_module("${CMAKE_CURRENT_LIST_DIR}/${PREFIX}/${module_name}/${module_name}-export.cmake") 35 | endif() 36 | endforeach(module_name) 37 | endmacro() 38 | 39 | 40 | # Try install location 41 | set(MODULE_FOUND FALSE) 42 | find_modules("cmake") 43 | 44 | if(MODULE_FOUND) 45 | return() 46 | endif() 47 | 48 | 49 | # Try common build locations 50 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") 51 | find_modules("build-debug/cmake") 52 | find_modules("build/cmake") 53 | else() 54 | find_modules("build/cmake") 55 | find_modules("build-debug/cmake") 56 | endif() 57 | 58 | 59 | # Signal success/failure to CMake 60 | set(template_FOUND ${MODULE_FOUND}) 61 | -------------------------------------------------------------------------------- /source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Configuration for all sub-projects 4 | # 5 | 6 | # Generate version-header 7 | configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_NAME}/${META_PROJECT_NAME}-version.h @ONLY) 8 | 9 | 10 | # 11 | # Sub-projects 12 | # 13 | 14 | add_subdirectory(lib) 15 | add_subdirectory(mdcii) 16 | add_subdirectory(thirdparty) 17 | 18 | # Tests 19 | if(OPTION_BUILD_TESTS AND NOT MINGW) 20 | set(IDE_FOLDER "Tests") 21 | add_subdirectory(tests) 22 | endif() 23 | 24 | 25 | # 26 | # Deployment 27 | # 28 | 29 | # Deploy generated headers 30 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_NAME} DESTINATION include COMPONENT dev) 31 | -------------------------------------------------------------------------------- /source/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(proto-cod) 2 | add_subdirectory(proto-textcod) 3 | add_subdirectory(proto-gamelist) -------------------------------------------------------------------------------- /source/lib/proto-cod/cod.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package cod_pb; 4 | 5 | message Value 6 | { 7 | oneof Value 8 | { 9 | int32 value_int = 1; 10 | float value_float = 2; 11 | string value_string = 3; 12 | } 13 | } 14 | 15 | message ArrayValue 16 | { 17 | repeated Value value = 1; 18 | } 19 | 20 | message Variable 21 | { 22 | string name = 1; 23 | oneof Value 24 | { 25 | int32 value_int = 2; 26 | float value_float = 3; 27 | string value_string = 4; 28 | ArrayValue value_array = 5; 29 | } 30 | } 31 | 32 | message Variables 33 | { 34 | repeated Variable variable = 1; 35 | } 36 | 37 | message Object 38 | { 39 | string name = 1; 40 | Variables variables = 2; 41 | repeated Object objects = 3; 42 | } 43 | 44 | message Objects 45 | { 46 | repeated Object object = 1; 47 | } 48 | -------------------------------------------------------------------------------- /source/lib/proto-gamelist/gamelist.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package GamesPb; 4 | 5 | enum SingleGameFlags 6 | { 7 | UNSET = 0; 8 | // true means multiplayer, false means single player 9 | PLAYERS = 1; 10 | } 11 | 12 | // Single game mission 13 | message SingleGame 14 | { 15 | // the name of the game 16 | string name = 1; 17 | // the full directory path of the scenario file 18 | string path = 2; 19 | // the ranking resulting in stars in games list 20 | int32 stars = 3; 21 | // flags, bitfield of type SingleGameFlags 22 | int32 flags = 4; 23 | // flag indicating if the single mission comes from the original game or with NINA addon 24 | bool original = 5; 25 | // mission number count 26 | int32 missionNumber = 6; 27 | // mission text 28 | string missionText = 7; 29 | } 30 | 31 | // Campaign: group of multiple missions 32 | message Campaign 33 | { 34 | // the name of the campaign 35 | string name = 1; 36 | // the ranking of the campaign resulting in stars in games list 37 | int32 stars = 2; 38 | // campaign number 39 | int32 number = 3; 40 | // the list of single games for the campaign 41 | repeated SingleGame game = 4; 42 | } 43 | 44 | // Endless missions 45 | message EndlessGame 46 | { 47 | // the name of the game 48 | string name = 1; 49 | // the full directory path of the scenario file 50 | string path = 2; 51 | // the ranking resulting in stars in games list 52 | int32 stars = 3; 53 | // flags like single/multiplayer 54 | int32 flags = 4; 55 | // mission text 56 | string missionText = 5; 57 | } 58 | 59 | message Games 60 | { 61 | // a list of original single game missions called 62 | repeated SingleGame addonSingle = 1; 63 | // a list of addon single game missions called 64 | repeated SingleGame originalSingle = 2; 65 | // a list of campaigns containing single games 66 | repeated Campaign campaign = 3; 67 | // a list of endless games 68 | repeated EndlessGame endless = 4; 69 | } 70 | -------------------------------------------------------------------------------- /source/lib/proto-textcod/textcod.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package TextcodPb; 4 | 5 | message Section 6 | { 7 | string name = 1; 8 | repeated string value = 2; 9 | } 10 | 11 | message Texts 12 | { 13 | repeated Section section = 1; 14 | } 15 | -------------------------------------------------------------------------------- /source/mdcii/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(mdcii) 2 | add_subdirectory(mdcii-sdltest) 3 | add_subdirectory(bshdump) 4 | add_subdirectory(bshpacker) 5 | add_subdirectory(codcat) 6 | add_subdirectory(weltbmp) 7 | add_subdirectory(inselbmp) 8 | add_subdirectory(islandbmp) 9 | add_subdirectory(zeitext) 10 | add_subdirectory(cod_parser) 11 | add_subdirectory(gam_parser) 12 | add_subdirectory(zeidump) 13 | add_subdirectory(paldump) 14 | add_subdirectory(worldbmp) -------------------------------------------------------------------------------- /source/mdcii/cod_parser/src/cod_parser.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "mdcii/cod/buildings.hpp" 6 | #include "mdcii/cod/cod_parser.hpp" 7 | #include "mdcii/files/files.hpp" 8 | 9 | namespace po = boost::program_options; 10 | 11 | int main(int argc, char** argv) 12 | { 13 | std::string cod_path; 14 | bool decrypt; 15 | po::options_description desc("Zulässige Optionen"); 16 | desc.add_options()("cod,c", po::value(&cod_path)->default_value("test.cod"), "Path to .cod file"); 17 | desc.add_options()("decrypt,d", po::value(&decrypt)->default_value(true), "decrypt true/false"); 18 | desc.add_options()("help,h", "Gibt diesen Hilfetext aus"); 19 | 20 | po::variables_map vm; 21 | po::store(po::parse_command_line(argc, argv, desc), vm); 22 | po::notify(vm); 23 | 24 | if (vm.count("help")) 25 | { 26 | std::cout << desc << std::endl; 27 | exit(EXIT_SUCCESS); 28 | } 29 | CodParser cod(cod_path, decrypt, true); 30 | } 31 | -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test.cod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/mdcii/cod_parser/test.cod -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test.txt: -------------------------------------------------------------------------------- 1 | VARIABLEA = 5000 2 | 3 | Objekt: TEST 4 | 5 | Nummer: 0 6 | Vara: VARIABLEA 7 | Varb: 999 8 | Objekt: ASDF 9 | var: 1, 2 10 | EndObj; 11 | ObjFill: 0, 3 12 | 13 | Nummer: 0 14 | Vara: VARIABLEA 15 | Varb: 1000 16 | 17 | @Nummer: +1 18 | Vara: VARIABLEA+10 19 | @Varb: +1 20 | 21 | @Nummer: +1 22 | Vara: VARIABLEA+20 23 | @Varb: +1 24 | 25 | 26 | EndObj; 27 | 28 | Objekt: A 29 | 30 | Nummer: 0 31 | OBJ = Nummer 32 | a: 10 33 | b: 20 34 | Arr: 1, 2, 3 35 | Objekt: QWERT 36 | c: 30, 40 37 | EndObj; 38 | 39 | @Nummer: +1 40 | ObjFill: OBJ 41 | @a: +1 42 | @b: +1 43 | ArrMath: 10-Arr[0], 11-Arr[1], 12-Arr[2] 44 | 45 | @Nummer: +1 46 | a: 1 47 | b: 0 48 | Arr: 10, 20, 30 49 | ArrMath: 9+Arr[0], 8+Arr[1], 7+Arr[2] 50 | 51 | EndObj; -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test2.cod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/mdcii/cod_parser/test2.cod -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test2.txt: -------------------------------------------------------------------------------- 1 | Objekt: A 2 | 3 | Nummer: 0 4 | OBJ = Nummer 5 | a: 1 6 | b: 2 7 | Objekt: ASDF 8 | c: 3, 4 9 | EndObj; 10 | 11 | @Nummer: +1 12 | ObjFill: OBJ 13 | @a: +1 14 | @b: +1 15 | 16 | @Nummer: +1 17 | a: 1 18 | b: 2 19 | Arr: 1, 2, 3 20 | ArrMath: 10-Arr[0], 11-Arr[1], 12-Arr[2] 21 | 22 | @Nummer: +1 23 | a: 1 24 | b: 2 25 | Arr: 10, 20, 30 26 | ArrMath: 9+Arr[0], 8+Arr[1], 7+Arr[2] 27 | 28 | EndObj; -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test3.cod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/mdcii/cod_parser/test3.cod -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test3.txt: -------------------------------------------------------------------------------- 1 | Objekt: TEST 2 | 3 | Nummer: 0 4 | Pos: 0, 0 5 | 6 | Nummer: 0 7 | @Pos: +0, -1 8 | 9 | @Nummer: +1 10 | @Pos: +2, -3 11 | 12 | @Nummer: +1 13 | @Pos: -5, +10 14 | 15 | EndObj; -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test4.txt: -------------------------------------------------------------------------------- 1 | IDWOHN = 10000 2 | GFXWOHN = IDWOHN+100 3 | 4 | Objekt: TEST 5 | @Nummer: +1 6 | BASE = Nummer 7 | Id: IDWOHN+0 8 | Gfx: GFXWOHN+0 9 | 10 | @Nummer: +1 11 | BASE = Nummer 12 | GFXNR = GFXWOHN+80 13 | Id: IDWOHN+1 14 | Gfx: GFXNR 15 | 16 | @Nummer: +1 17 | BASE = Nummer 18 | @GFXNR = +10 19 | Id: IDWOHN+2 20 | Gfx: GFXNR 21 | EndObj; 22 | -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test_array.cod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/mdcii/cod_parser/test_array.cod -------------------------------------------------------------------------------- /source/mdcii/cod_parser/test_array.txt: -------------------------------------------------------------------------------- 1 | Objekt: ARRAY_TEST 2 | 3 | Nummer: 0 4 | Pos: 20, 42 ; Property array 5 | Posoffs: 30-Pos[0], 200-Pos[1] ; 30 - 20, 200 - 42 -> 10, 158 6 | 7 | EndObj; -------------------------------------------------------------------------------- /source/mdcii/codcat/src/codcat.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2018 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include 20 | #include 21 | // #include 22 | #include 23 | 24 | using namespace std; 25 | using namespace boost::iostreams; 26 | 27 | struct bytewise_2s_complement_input_filter 28 | { 29 | typedef char char_type; 30 | typedef input_filter_tag category; 31 | 32 | template 33 | int get(Source& src) 34 | { 35 | int c = boost::iostreams::get(src); 36 | if (c != EOF && c != WOULD_BLOCK) 37 | c = -c & 0xff; 38 | return c; 39 | } 40 | }; 41 | 42 | int main(int argc, char** argv) 43 | { 44 | if (argc != 2) 45 | exit(EXIT_FAILURE); 46 | 47 | filtering_istream in; 48 | // in.push(newline_filter(newline::dos)); 49 | in.push(bytewise_2s_complement_input_filter()); 50 | in.push(file_source(argv[1])); 51 | 52 | while (in.good()) 53 | { 54 | char c = in.get(); 55 | cout.put(c); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/animation.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2017 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef ANIMATION_HPP 20 | #define ANIMATION_HPP 21 | 22 | struct Animation 23 | { 24 | int x; 25 | int y; 26 | int z; 27 | int ani; 28 | int start_index; 29 | int schritte; 30 | int bs_z_versatz; 31 | bool wiederholen; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/block.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef BLOCK_HPP 20 | #define BLOCK_HPP 21 | 22 | #include 23 | #include 24 | 25 | class Block 26 | { 27 | public: 28 | char kennung[16]; 29 | uint32_t length; 30 | uint8_t* data; 31 | 32 | explicit Block(std::istream& f); 33 | ~Block(); 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/bsh/bshreader.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2020 Armin Schlegel 4 | // Copyright (C) 2015 Benedikt Freisen 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | #ifndef _BSHREADER_HPP 21 | #define _BSHREADER_HPP 22 | 23 | #include 24 | 25 | #include "genericbshreader.hpp" 26 | 27 | struct BshImage : public GenericBshImage<0> 28 | { 29 | }; 30 | 31 | class BshReader : public GenericBshReader 32 | { 33 | public: 34 | explicit BshReader(const std::string& path) 35 | : GenericBshReader(path, "BSH") 36 | { 37 | } 38 | }; 39 | 40 | #endif // _BSHREADER_HPP 41 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/bsh/bshtexture.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // Copyright (C) 2020 Armin Schlegel 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef _BSH_TEXTURE_HPP 20 | #define _BSH_TEXTURE_HPP 21 | 22 | #include 23 | 24 | #include "bshreader.hpp" 25 | #include "framebuffer/framebuffer_pal8.hpp" 26 | #include "framebuffer/palette.hpp" 27 | 28 | class BshImageToSDLTextureConverter 29 | { 30 | public: 31 | explicit BshImageToSDLTextureConverter(SDL_Renderer* renderer); 32 | SDL_Texture* Convert(BshImage* image); 33 | 34 | private: 35 | SDL_Renderer* renderer; 36 | }; 37 | 38 | #endif // _BSH_TEXTURE_HPP -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/bsh/bshwriter.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2020 Armin Schlegel 4 | // Copyright (C) 2017 Benedikt Freisen 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | #ifndef _BSHWRITER_HPP_ 21 | #define _BSHWRITER_HPP_ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | class BshWriter 28 | { 29 | public: 30 | explicit BshWriter(int transparentColor = 0, int extraColumns = 0, bool isZei = false); 31 | ~BshWriter(); 32 | void WriteBsh(uint8_t* image, int width, int height, std::vector& target); 33 | void ReadPGM(const char* path, uint8_t*& image, int& width, int& height); 34 | void AttachPGM(const char* path); 35 | void WriteFile(const char* path); 36 | 37 | private: 38 | int transparentColor; 39 | int extraColumns; 40 | bool isZei; 41 | 42 | struct ImageWithMeta 43 | { 44 | uint32_t width; 45 | uint32_t height; 46 | uint32_t typ; 47 | uint32_t length; 48 | uint32_t crc; 49 | uint32_t offset; 50 | int duplicateOf; 51 | std::vector data; 52 | }; 53 | std::vector images; 54 | }; 55 | 56 | #endif // _BSHWRITER_HPP_ 57 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/bsh/zeireader.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef ZEI_LESER_HPP 20 | #define ZEI_LESER_HPP 21 | 22 | #include 23 | 24 | #include "genericbshreader.hpp" 25 | 26 | struct ZeiCharacter : public GenericBshImage<3> 27 | { 28 | }; 29 | 30 | class ZeiReader : public GenericBshReader 31 | { 32 | public: 33 | explicit ZeiReader(const std::string& path) 34 | : GenericBshReader(path, "ZEI") 35 | { 36 | } 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/bsh/zeitexture.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef _ZEI_TEXTURE 19 | #define _ZEI_TEXTURE 20 | 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | #include "bshreader.hpp" 27 | #include "files/files.hpp" 28 | #include "framebuffer/framebuffer_pal8.hpp" 29 | #include "framebuffer/palette.hpp" 30 | 31 | class StringToSDLTextureConverter 32 | { 33 | public: 34 | explicit StringToSDLTextureConverter(SDL_Renderer* renderer, const std::string& font); 35 | SDL_Texture* Convert(const std::string& str, int color = 245, int shadowColor = 0, int verticalMargin = 0); 36 | 37 | private: 38 | SDL_Renderer* renderer; 39 | std::string font; 40 | Files* files; 41 | std::shared_ptr zei; 42 | std::wstring_convert> converter; 43 | }; 44 | 45 | #endif -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/cod/codhelpers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _CODHELPERS_HPP_ 2 | #define _CODHELPERS_HPP_ 3 | 4 | #include 5 | #include 6 | 7 | std::vector ReadFile(const std::string& path, bool decode, bool filterEmptyLines = true); 8 | std::vector ReadFileAsString(const std::string& buffer, bool filterEmptyLines = true); 9 | 10 | // String handling functions 11 | std::vector RegexMatch(const std::string& regex, const std::string& str); 12 | std::vector RegexSearch(const std::string& regex, const std::string& str); 13 | std::string TabsToSpaces(const std::string& str); 14 | int CountFrontSpaces(const std::string& str); 15 | std::string RemoveTrailingCharacters(const std::string& str, const char charToRemove); 16 | std::string RemoveLeadingCharacters(const std::string& str, const char charToRemove); 17 | std::string TrimSpacesLeadingTrailing(const std::string& s); 18 | bool IsEmpty(const std::string& str); 19 | bool IsSubstring(const std::string& str, const std::string& substr); 20 | std::vector SplitByDelimiter(const std::string& str, const std::string& delim); 21 | std::string TrimCommentFromLine(const std::string& str); 22 | bool BeginsWith(const std::string& str, const std::string& begin); 23 | std::string RemoveDigits(const std::string& str); 24 | 25 | #endif // _CODHELPERS_HPP_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/common/stringhelpers.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __STRINGHELPERS_HPP_ 2 | #define __STRINGHELPERS_HPP_ 3 | 4 | std::wstring stringToWstring(const std::string& utf8Str); 5 | std::string iso_8859_1_to_utf8(std::string& str); 6 | std::string removeTrailingCarriageReturnNewline(const std::string& input); 7 | 8 | #endif // __STRINGHELPERS_HPP_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/framebuffer/framebuffer_pal8.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2020 Armin Schlegel 4 | // Copyright (C) 2015 Benedikt Freisen 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | #ifndef _FRAMEBUFFER_PAL8_HPP_ 21 | #define _FRAMEBUFFER_PAL8_HPP_ 22 | 23 | #include 24 | 25 | #include "../bsh/bshreader.hpp" 26 | #include "framebuffer.hpp" 27 | 28 | class FramebufferPal8 : public Framebuffer 29 | { 30 | public: 31 | explicit FramebufferPal8(uint32_t width, uint32_t height, uint32_t color = 0, uint8_t* buffer = NULL, uint32_t bufferLength = 0); 32 | void DrawBshImage(BshImage& image, int x, int y); 33 | void DrawPixel(int x, int y, uint8_t color); 34 | void ExportPNM(const char* path); 35 | void ExportBMP(const char* path); 36 | void Clear(); 37 | 38 | private: 39 | uint8_t dunkel[256]; 40 | void DrawBshImageFull(BshImage& image, int x, int y); 41 | void DrawBshImagePartial(BshImage& image, int x, int y); 42 | }; 43 | 44 | #endif // _FRAMEBUFFER_PAL8_HPP_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/framebuffer/framebuffer_rgb24.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2020 Armin Schlegel 4 | // Copyright (C) 2015 Benedikt Freisen 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | 20 | #ifndef _FRAMEBUFFER_RGB24_HPP_ 21 | #define _FRAMEBUFFER_RGB24_HPP_ 22 | 23 | #include 24 | 25 | #include "../bsh/bshreader.hpp" 26 | #include "framebuffer.hpp" 27 | 28 | class FramebufferRgb24 : public Framebuffer 29 | { 30 | public: 31 | explicit FramebufferRgb24(uint32_t width, uint32_t height, uint32_t color = 0, uint8_t* buffer = NULL, uint32_t bufferLength = 0); 32 | void DrawBshImage(BshImage& image, int x, int y); 33 | void DrawPixel(int x, int y, uint8_t color); 34 | void ExportPNM(const char* path); 35 | void ExportBMP(const char* path); 36 | void Clear(); 37 | 38 | private: 39 | void DrawBshImageFull(BshImage& image, int x, int y); 40 | void DrawBshImagePartial(BshImage& image, int x, int y); 41 | }; 42 | 43 | #endif // _FRAMEBUFFER_RGB24_HPP_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/framebuffer/framebuffer_trans_pal8.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2020 Armin Schlegel 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef _FRAMEBUFFER_TRANS_PAL8_HPP_ 20 | #define _FRAMEBUFFER_TRANS_PAL8_HPP_ 21 | 22 | #include 23 | 24 | #include "../bsh/bshreader.hpp" 25 | #include "framebuffer.hpp" 26 | 27 | class FramebufferTransparentPal8 : public Framebuffer 28 | { 29 | public: 30 | explicit FramebufferTransparentPal8( 31 | uint32_t width, uint32_t height, uint32_t color = 0, uint8_t* buffer = NULL, uint32_t bufferLength = 0, uint8_t transparent = 253); 32 | void DrawBshImage(BshImage& image, int x, int y); 33 | void DrawPixel(int x, int y, uint8_t color); 34 | void ExportPNM(const char* path); 35 | void ExportBMP(const char* path); 36 | void Clear(); 37 | 38 | private: 39 | uint8_t transparent; 40 | uint8_t dunkel[256]; 41 | 42 | void DrawBshImageFull(BshImage& image, int x, int y); 43 | }; 44 | 45 | #endif // _FRAMEBUFFER_TRANS_PAL8_HPP_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/gam/deer.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef _DEER_HPP 19 | #define _DEER_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | struct DeerData // Hirsch2 26 | { 27 | uint32_t inselnr : 8; 28 | uint32_t posx : 8; 29 | uint32_t posy : 8; 30 | uint32_t timecnt; 31 | }; 32 | 33 | class Deer 34 | { 35 | public: 36 | Deer() 37 | { 38 | } 39 | explicit Deer(uint8_t* data, uint32_t length, const std::string& name); 40 | std::vector deers; 41 | 42 | private: 43 | std::string name; 44 | }; 45 | 46 | #endif // _DEER_HPP -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/gam/island3.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef _ISLAND3_HPP 19 | #define _ISLAND3_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "files/files.hpp" 27 | 28 | #include "cod/buildings.hpp" 29 | 30 | #include "chunk.hpp" 31 | #include "deer.hpp" 32 | #include "island.hpp" 33 | #include "islandhouse.hpp" 34 | #include "military.hpp" 35 | #include "shipyard.hpp" 36 | #include "warehouse.hpp" 37 | 38 | struct Island3Data // Insel3 39 | { 40 | uint8_t inselnr; // ID for this island (per game) 41 | uint8_t width; // width 42 | uint8_t height; // height 43 | uint8_t a; // TODO: unknown 44 | uint16_t x_pos; // position of island x 45 | uint16_t y_pos; // position of island y 46 | uint16_t b; // TODO: unknown 47 | uint16_t c; // TODO: unknown 48 | uint8_t bytes1[28]; // TODO: unknown 49 | }; 50 | 51 | class Island3 52 | { 53 | public: 54 | explicit Island3(uint8_t* data, uint32_t length, const std::string& name); 55 | Island3Data island3; 56 | 57 | private: 58 | std::string name; 59 | }; 60 | 61 | #endif // _ISLAND3_HPP -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/gam/marketplace.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef _MARKETPLACE_HPP 19 | #define _MARKETPLACE_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | struct MarketPlaceGoods 26 | { 27 | uint32_t goodConsumption; // Letzter Verbrauch 28 | uint32_t goodCoverRatio; // Deckungssatz der Bedürfnisse 29 | uint32_t empty0; // empty 30 | uint16_t houseId; // Hausnummer für Warentyp !! 31 | uint8_t goodSupplyLevel; // Versorgungsgrad mit dieser Ware 32 | uint8_t empty1; // empty 33 | }; 34 | 35 | struct MarketPlaceData // MARKT 36 | { 37 | uint8_t islandNumber : 8; 38 | uint8_t cityNumber : 4; // Auf welcher Insel und Stadt?? 39 | MarketPlaceGoods goods[16]; // ACHTUNG: Falls MARKT_WAREMAX > 16 40 | }; 41 | 42 | class MarketPlace 43 | { 44 | public: 45 | MarketPlace() 46 | { 47 | } 48 | explicit MarketPlace(uint8_t* data, uint32_t length, const std::string& name); 49 | std::vector marketPlace; 50 | 51 | private: 52 | std::string name; 53 | }; 54 | 55 | #endif // _MARKETPLACE_HPP -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/gam/rawgrowth.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef _RAWGROWTH_HPP 19 | #define _RAWGROWTH_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | struct RawGrowthData // ROHWACHS2 26 | { 27 | uint8_t islandNumber; // On which island is the raw good 28 | uint8_t posx; // Position on the island 29 | uint8_t posy; // Position on the island 30 | uint8_t speed; // Which speed counter (MAXWACHSSPEEDKIND) 31 | uint8_t speedcnt; // If (Timecnt != SpeedCnt) currentfield->animationCount++ (MAXROHWACHSCNT) 32 | uint8_t animationCount; // current animation index 33 | uint8_t empty1; 34 | uint8_t empty2; 35 | }; 36 | 37 | class RawGrowth 38 | { 39 | public: 40 | RawGrowth() 41 | { 42 | } 43 | explicit RawGrowth(uint8_t* data, uint32_t length, const std::string& name); 44 | std::vector rawGrowth; 45 | 46 | private: 47 | std::string name; 48 | }; 49 | 50 | #endif // _RAWGROWTH_HPP -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/gam/template.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef _TEMPLATE_HPP 19 | #define _TEMPLATE_HPP 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | struct TemplateData // 26 | { 27 | }; 28 | 29 | class Template 30 | { 31 | public: 32 | Template() 33 | { 34 | } 35 | explicit Template(uint8_t* data, uint32_t length, const std::string& name); 36 | std::vector template; 37 | TemplateData template; 38 | 39 | private: 40 | std::string name; 41 | }; 42 | 43 | #endif // _TEMPLATE_HPP -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/karte.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef KARTE_HPP 20 | #define KARTE_HPP 21 | 22 | #include "camera/camera.hpp" 23 | #include "framebuffer/framebuffer.hpp" 24 | #include "welt.hpp" 25 | #include 26 | 27 | class Karte 28 | { 29 | int xpos; 30 | int ypos; 31 | int width; 32 | int height; 33 | 34 | public: 35 | explicit Karte(int xpos = 0, int ypos = 0, int width = 500, int height = 350); 36 | 37 | void zeichne_bild(Framebuffer& fb, Welt& welt); 38 | void zeichne_kameraposition(Framebuffer& fb, Kamera& kamera); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/mdcii.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _MDCII_H_ 2 | #define _MDCII_H_ 3 | class Mdcii 4 | { 5 | public: 6 | explicit Mdcii(int screen_width, int screen_height, bool fullscreen, const std::string& files_path); 7 | 8 | private: 9 | static Uint32 TimerCallback(Uint32 interval, void* param); 10 | }; 11 | 12 | #endif -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/menu/fps.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | // Based on nanogui-sdl by Dalerank 19 | #ifndef FPS_H_ 20 | #define FPS_H_ 21 | 22 | #include 23 | 24 | class Fps 25 | { 26 | public: 27 | explicit Fps(int tickInterval = 41) 28 | : m_tickInterval(tickInterval) 29 | , m_nextTime(SDL_GetTicks() + tickInterval) 30 | { 31 | } 32 | 33 | void Next() 34 | { 35 | SDL_Delay(GetTicksToNextFrame()); 36 | 37 | m_nextTime += m_tickInterval; 38 | } 39 | 40 | private: 41 | const int m_tickInterval; 42 | Uint32 m_nextTime; 43 | 44 | Uint32 GetTicksToNextFrame() const 45 | { 46 | Uint32 now = SDL_GetTicks(); 47 | 48 | return (m_nextTime <= now) ? 0 : m_nextTime - now; 49 | } 50 | }; 51 | 52 | #endif -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/savegames/savegames.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef _SAVEGAMES_H_ 19 | #define _SAVEGAMES_H_ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "gamelist.pb.h" 27 | 28 | #include "files/files.hpp" 29 | 30 | class Savegames 31 | { 32 | public: 33 | explicit Savegames(const std::string& basepath, const std::string& fileEnding); 34 | unsigned int size() const; 35 | std::experimental::optional GetPath(unsigned int index) const; 36 | std::experimental::optional GetName(unsigned int index) const; 37 | std::experimental::optional GetRanking(unsigned int index) const; 38 | std::vector> GetSavegames() const; 39 | // GamesPb::Games Get() const; 40 | 41 | private: 42 | // vector element contains: path, name, ranking 43 | // GamesPb::Games gamelist; 44 | std::vector> savegames; 45 | }; 46 | 47 | #endif // _SAVEGAMES_H_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/savegames/scenarios.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef _SCENARIOS_H_ 19 | #define _SCENARIOS_H_ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include "gamelist.pb.h" 27 | 28 | #include "files/files.hpp" 29 | 30 | class Scenarios 31 | { 32 | public: 33 | explicit Scenarios(const std::string& basepath, const std::string& fileEnding); 34 | unsigned int size() const; 35 | GamesPb::Games Get() const; 36 | 37 | private: 38 | int CampagneIndex(const std::string& name); 39 | void SortCampaigns(); 40 | void SortOriginalMissions(); 41 | void SortCampaignMissions(GamesPb::Campaign* campaign); 42 | GamesPb::Games gamelist; 43 | }; 44 | 45 | #endif // _SAVEGAMES_H_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/sdl2shared/sdl2shared.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _SDL2SHARED_HPP_ 2 | #define _SDL2SHARED_HPP_ 3 | 4 | #include 5 | #include // shared_ptr 6 | 7 | namespace sdl2 8 | { 9 | static void SDL_DelRes(SDL_Window* r) 10 | { 11 | SDL_DestroyWindow(r); 12 | } 13 | static void SDL_DelRes(SDL_Renderer* r) 14 | { 15 | SDL_DestroyRenderer(r); 16 | } 17 | static void SDL_DelRes(SDL_Texture* r) 18 | { 19 | SDL_DestroyTexture(r); 20 | } 21 | static void SDL_DelRes(SDL_Surface* r) 22 | { 23 | SDL_FreeSurface(r); 24 | } 25 | 26 | template 27 | std::shared_ptr make_shared(T* t) 28 | { 29 | return std::shared_ptr(t, [](T* t) { SDL_DelRes(t); }); 30 | } 31 | } 32 | #endif // _SDL2SHARED_HPP_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/spielbildschirm.hpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #ifndef SPIELBILDSCHIRM_HPP 20 | #define SPIELBILDSCHIRM_HPP 21 | 22 | #include 23 | 24 | #include "camera/camera.hpp" 25 | #include "framebuffer/framebuffer.hpp" 26 | #include "karte.hpp" 27 | #include "version/version.hpp" 28 | #include "welt.hpp" 29 | 30 | class Spielbildschirm 31 | { 32 | public: 33 | explicit Spielbildschirm(Framebuffer& fb); 34 | ~Spielbildschirm(); 35 | void zeichne_bild(Welt& welt, int maus_x, int maus_y); 36 | 37 | std::shared_ptr kamera; // vorübergehend public 38 | 39 | private: 40 | Spielbildschirm() = default; 41 | Framebuffer& fb; 42 | Karte karte; 43 | std::shared_ptr buildings; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/version/version.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2019 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #ifndef VERSION_HPP 19 | #define VERSION_HPP 20 | 21 | #include 22 | 23 | enum class AnnoVersion 24 | { 25 | VANILLA = 0, 26 | NINA = 1, 27 | OTHER = 2 28 | }; 29 | 30 | class Version 31 | { 32 | public: 33 | static AnnoVersion DetectGameVersion(); 34 | static std::string GameVersionString(); 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/include/mdcii/world/world.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __WORLD_HPP_ 2 | #define __WORLD_HPP_ 3 | 4 | #include "gam/gam_parser.hpp" 5 | #include "gam/island.hpp" 6 | #include "gam/islandhouse.hpp" 7 | 8 | class World 9 | { 10 | public: 11 | explicit World(GamParser gamParser); 12 | std::experimental::optional> IslandOnPosition(uint16_t x, uint16_t y); 13 | bool IslandNumberOnPosition(uint8_t number, uint16_t x, uint16_t y); 14 | IslandHouseData TileOnPosition(uint16_t x, uint16_t y); 15 | enum 16 | { 17 | Width = 500, 18 | Height = 350 19 | }; 20 | 21 | private: 22 | GamParser gamParser; 23 | }; 24 | 25 | #endif // __WORLD_HPP_ -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/block.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "block.hpp" 20 | 21 | Block::Block(std::istream& f) 22 | { 23 | f.read(this->kennung, sizeof(this->kennung)); 24 | f.read((char*)&this->length, sizeof(this->length)); 25 | this->data = new uint8_t[this->length]; 26 | f.read((char*)this->data, this->length); 27 | } 28 | 29 | Block::~Block() 30 | { 31 | delete[] data; 32 | } 33 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/common/stringhelpers.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "common/stringhelpers.hpp" 8 | 9 | std::wstring stringToWstring(const std::string& utf8Str) 10 | { 11 | std::wstring_convert> conv; 12 | return conv.from_bytes(utf8Str); 13 | } 14 | 15 | std::string iso_8859_1_to_utf8(std::string& str) 16 | { 17 | std::string strOut; 18 | for (std::string::iterator it = str.begin(); it != str.end(); ++it) 19 | { 20 | uint8_t ch = *it; 21 | if (ch < 0x80) 22 | { 23 | strOut.push_back(ch); 24 | } 25 | else 26 | { 27 | strOut.push_back(0xc0 | ch >> 6); 28 | strOut.push_back(0x80 | (ch & 0x3f)); 29 | } 30 | } 31 | return strOut; 32 | } 33 | 34 | std::string removeTrailingCarriageReturnNewline(const std::string& input) 35 | { 36 | std::regex r("[\r\n]{2,}"); 37 | return std::regex_replace(input, r, "\r\n"); 38 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/city.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/city.hpp" 21 | 22 | City4::City4(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int num = length / sizeof(City4Data); 26 | for (int i = 0; i < num; i++) 27 | { 28 | City4Data entity; 29 | int l = length / num; 30 | memset((char*)&entity, 0, l); 31 | memcpy((char*)&entity, data + (i * l), l); 32 | city.push_back(entity); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/deer.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/deer.hpp" 21 | 22 | Deer::Deer(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int num = length / sizeof(DeerData); 26 | for (int i = 0; i < num; i++) 27 | { 28 | DeerData entity; 29 | int l = length / num; 30 | memset((char*)&entity, 0, l); 31 | memcpy((char*)&entity, data + (i * l), l); 32 | deers.push_back(entity); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/island3.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/island.hpp" 21 | 22 | Island3::Island3(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | memcpy((char*)&island3, data, length); 26 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/island4.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/island.hpp" 21 | 22 | Island4::Island4(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | memcpy((char*)&island, data, length); 26 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/marketplace.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/marketplace.hpp" 21 | 22 | MarketPlace::MarketPlace(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int num = length / sizeof(MarketPlaceData); 26 | for (int i = 0; i < num; i++) 27 | { 28 | MarketPlaceData entity; 29 | int l = length / num; 30 | memset((char*)&entity, 0, l); 31 | memcpy((char*)&entity, data + (i * l), l); 32 | marketPlace.push_back(entity); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/military.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/military.hpp" 21 | 22 | Military::Military(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int num = length / sizeof(MilitaryData); 26 | for (int i = 0; i < num; i++) 27 | { 28 | MilitaryData entity; 29 | int l = length / num; 30 | memset((char*)&entity, 0, l); 31 | memcpy((char*)&entity, data + (i * l), l); 32 | military.push_back(entity); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/productionlist.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/productionlist.hpp" 21 | 22 | ProductionList::ProductionList(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int numProdlist = length / sizeof(ProductionListData); 26 | for (int i = 0; i < numProdlist; i++) 27 | { 28 | ProductionListData p; 29 | int l = length / numProdlist; 30 | memset((char*)&p, 0, l); 31 | memcpy((char*)&p, data + (i * l), l); 32 | productionList.push_back(p); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/randomislands.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/template.hpp" 21 | 22 | Template::Template(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | memcpy((char*)&template, data, length); 26 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/rawgrowth.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/rawgrowth.hpp" 21 | 22 | RawGrowth::RawGrowth(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int num = length / sizeof(RawGrowthData); 26 | for (int i = 0; i < num; i++) 27 | { 28 | RawGrowthData entity; 29 | int l = length / num; 30 | memset((char*)&entity, 0, l); 31 | memcpy((char*)&entity, data + (i * l), l); 32 | rawGrowth.push_back(entity); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/scene.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/scene.hpp" 21 | 22 | SceneRanking::SceneRanking(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | memcpy((char*)&sceneRanking, data, length); 26 | } 27 | 28 | SceneSave::SceneSave(uint8_t* data, uint32_t length, const std::string& name) 29 | : name(name) 30 | { 31 | memcpy((char*)&sceneSave, data, length); 32 | } 33 | 34 | SceneCampaign::SceneCampaign(uint8_t* data, uint32_t length, const std::string& name) 35 | : name(name) 36 | { 37 | memcpy((char*)&sceneCampaign, data, length); 38 | } 39 | 40 | SceneGameID::SceneGameID(uint8_t* data, uint32_t length, const std::string& name) 41 | : name(name) 42 | { 43 | memcpy((char*)&sceneGameID, data, length); 44 | } 45 | 46 | SceneMissionNumber::SceneMissionNumber(uint8_t* data, uint32_t length, const std::string& name) 47 | : name(name) 48 | { 49 | memcpy((char*)&sceneMissionNumber, data, length); 50 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/settlers.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/settlers.hpp" 21 | 22 | Settlers::Settlers(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int num = length / sizeof(SettlersData); 26 | for (int i = 0; i < num; i++) 27 | { 28 | SettlersData entity; 29 | int l = length / num; 30 | memset((char*)&entity, 0, l); 31 | memcpy((char*)&entity, data + (i * l), l); 32 | settlers.push_back(entity); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/shipyard.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/shipyard.hpp" 21 | 22 | Shipyard::Shipyard(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int num = length / sizeof(ShipyardData); 26 | for (int i = 0; i < num; i++) 27 | { 28 | ShipyardData entity; 29 | int l = length / num; 30 | memset((char*)&entity, 0, l); 31 | memcpy((char*)&entity, data + (i * l), l); 32 | shipyard.push_back(entity); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/template.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "gam/template.hpp" 21 | 22 | Template::Template(uint8_t* data, uint32_t length, const std::string& name) 23 | : name(name) 24 | { 25 | int num = length / sizeof(TemplateData); 26 | for (int i = 0; i < num; i++) 27 | { 28 | TemplateData entity; 29 | int l = length / num; 30 | memset((char*)&entity, 0, l); 31 | memcpy((char*)&entity, data + (i * l), l); 32 | template.push_back(entity); 33 | } 34 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/gam/warehouse.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "gam/warehouse.hpp" 25 | 26 | Warehouse2::Warehouse2(uint8_t* data, uint32_t length, const std::string& name) 27 | : name(name) 28 | { 29 | int numWarehouses = length / sizeof(Warehouse2Data); 30 | for (int i = 0; i < numWarehouses; i++) 31 | { 32 | Warehouse2Data w; 33 | int warehouseLength = length / numWarehouses; 34 | memset((char*)&w, 0, warehouseLength); 35 | memcpy((char*)&w, data + (i * warehouseLength), warehouseLength); 36 | warehouses.push_back(w); 37 | } 38 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/renderer/renderer.cpp: -------------------------------------------------------------------------------- 1 | #include "renderer/renderer.hpp" 2 | 3 | void Renderer::RenderIsland(Island5 i) 4 | { 5 | auto islandHouseLayers = i.GetIslandHouseData(); 6 | auto islandHouse = islandHouseLayers[0]->GetIslandHouse(); 7 | // for (auto tile : islandHouse) 8 | // { 9 | // auto element = buildings->GetHouse(tile.id); 10 | // if (element) 11 | // { 12 | // // int x = tile.posx; 13 | // // int y = tile.posy; 14 | // // BshImage& bsh = bshReader.GetBshImage(element.value()->Gfx); 15 | // // int elevation = element.value()->Posoffs; 16 | // // fb.zeichne_bsh_bild_oz(bsh, (x - y + height) * XRASTER, (x + y) * YRASTER + 2 * YRASTER - elevation); 17 | // } 18 | // } 19 | } 20 | 21 | void Renderer::RenderIsland(std::shared_ptr i) 22 | { 23 | return RenderIsland(*i.get()); 24 | } 25 | 26 | // std::experimental::optional Renderer::TerrainTile(uint8_t x, uint8_t y) 27 | // { 28 | // auto h = islandHouseLayer.GetMap(std::make_pair(x, y)); 29 | // if (h) 30 | // { 31 | // uint8_t xp = h.value().posx; 32 | // uint8_t yp = h.value().posy; 33 | // if ((yp > y) || (xp > x)) 34 | // { 35 | // // TODO "target" auf einen sinnvollen Wert setzen 36 | // return {}; 37 | // } 38 | // auto r = islandHouseLayer.GetMap(std::make_pair(y - yp, x - xp)); 39 | // if (r) 40 | // { 41 | // IslandHouseData ret = r.value(); 42 | // ret.posx = xp; 43 | // ret.posy = yp; 44 | // return ret; 45 | // } 46 | // return {}; 47 | // } 48 | // return {}; 49 | // } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/spielbildschirm.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "spielbildschirm.hpp" 20 | 21 | Spielbildschirm::Spielbildschirm(Framebuffer& fb) 22 | : fb(fb) 23 | , karte(fb.width - 182, 0, 182, 156) 24 | { 25 | buildings = Buildings::Instance(); 26 | kamera = std::make_shared(); 27 | } 28 | 29 | Spielbildschirm::~Spielbildschirm() 30 | { 31 | } 32 | 33 | void Spielbildschirm::zeichne_bild(Welt& welt, int maus_x, int maus_y) 34 | { 35 | kamera->zeichne_bild(fb, welt, maus_x, maus_y); 36 | karte.zeichne_bild(fb, welt); 37 | karte.zeichne_kameraposition(fb, *kamera); 38 | } 39 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/strukturen.cpp: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of the MDCII Game Engine. 3 | // Copyright (C) 2015 Benedikt Freisen 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program; if not, write to the Free Software 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | 19 | #include "strukturen.hpp" 20 | 21 | char inselhaus_kennung[] = "INSELHAUS"; 22 | char wiff_kennung[] = "WIFF"; 23 | 24 | constexpr char Insel3::kennung[]; 25 | constexpr char Insel5::kennung[]; 26 | constexpr char Hirsch2::kennung[]; 27 | constexpr char Siedler::kennung[]; 28 | constexpr char Rohwachs::kennung[]; 29 | constexpr char Prodlist::kennung[]; 30 | constexpr char Werft::kennung[]; 31 | constexpr char Militar::kennung[]; 32 | constexpr char Stadt::kennung[]; 33 | constexpr char Kontor::kennung[]; 34 | constexpr char Markt::kennung[]; 35 | constexpr char Player::kennung[]; 36 | constexpr char Auftrag::kennung[]; 37 | constexpr char Handler::kennung[]; 38 | constexpr char Ship::kennung[]; 39 | constexpr char Soldat::kennung[]; 40 | constexpr char Turm::kennung[]; 41 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/cod_parser_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "../buildings.hpp" 6 | #include "../cod_parser.hpp" 7 | #include "../files/files.hpp" 8 | 9 | namespace po = boost::program_options; 10 | 11 | int main(int argc, char** argv) 12 | { 13 | std::string cod_path; 14 | bool decrypt; 15 | po::options_description desc("Zulässige Optionen"); 16 | desc.add_options()("cod,c", po::value(&cod_path)->default_value("test.cod"), "Path to .cod file"); 17 | desc.add_options()("decrypt,d", po::value(&decrypt)->default_value(true), "decrypt true/false"); 18 | desc.add_options()("help,h", "Gibt diesen Hilfetext aus"); 19 | 20 | po::variables_map vm; 21 | po::store(po::parse_command_line(argc, argv, desc), vm); 22 | po::notify(vm); 23 | 24 | if (vm.count("help")) 25 | { 26 | std::cout << desc << std::endl; 27 | exit(EXIT_SUCCESS); 28 | } 29 | // auto files = Files::CreateInstance(".", false); 30 | // if (files->CheckFile(cod_path) == true) 31 | { 32 | std::shared_ptr cod = std::make_shared(cod_path, decrypt, true); 33 | Haeuser buildings(cod); 34 | for (int i = 0; i < 2500; i++) 35 | { 36 | auto h = buildings.GetHouse(i); 37 | if (h) 38 | { 39 | // std::cout << h.value()->Id-20000 << "," << h.value()->Gfx << std::endl; 40 | if (h.value()->Size.w * h.value()->Size.h != h.value()->Rotate) 41 | { 42 | std::cout << h.value()->Id - 20000 << ": " << h.value()->Size.w << ", " << h.value()->Size.h << "!=" << h.value()->Rotate << std::endl; 43 | } 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/test.cod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/mdcii/mdcii/src/test/cod_parser_test/test.cod -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/test.txt: -------------------------------------------------------------------------------- 1 | VARIABLEA = 5000 2 | 3 | Objekt: TEST 4 | 5 | Nummer: 0 6 | Vara: VARIABLEA 7 | Varb: 999 8 | Objekt: ASDF 9 | var: 1, 2 10 | EndObj; 11 | ObjFill: 0, 3 12 | 13 | Nummer: 0 14 | Vara: VARIABLEA 15 | Varb: 1000 16 | 17 | @Nummer: +1 18 | Vara: VARIABLEA+10 19 | @Varb: +1 20 | 21 | @Nummer: +1 22 | Vara: VARIABLEA+20 23 | @Varb: +1 24 | 25 | 26 | EndObj; 27 | 28 | Objekt: A 29 | 30 | Nummer: 0 31 | OBJ = Nummer 32 | a: 10 33 | b: 20 34 | Arr: 1, 2, 3 35 | Objekt: QWERT 36 | c: 30, 40 37 | EndObj; 38 | 39 | @Nummer: +1 40 | ObjFill: OBJ 41 | @a: +1 42 | @b: +1 43 | ArrMath: 10-Arr[0], 11-Arr[1], 12-Arr[2] 44 | 45 | @Nummer: +1 46 | a: 1 47 | b: 0 48 | Arr: 10, 20, 30 49 | ArrMath: 9+Arr[0], 8+Arr[1], 7+Arr[2] 50 | 51 | EndObj; -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/test2.cod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/mdcii/mdcii/src/test/cod_parser_test/test2.cod -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/test2.txt: -------------------------------------------------------------------------------- 1 | Objekt: A 2 | 3 | Nummer: 0 4 | OBJ = Nummer 5 | a: 1 6 | b: 2 7 | Objekt: ASDF 8 | c: 3, 4 9 | EndObj; 10 | 11 | @Nummer: +1 12 | ObjFill: OBJ 13 | @a: +1 14 | @b: +1 15 | 16 | @Nummer: +1 17 | a: 1 18 | b: 2 19 | Arr: 1, 2, 3 20 | ArrMath: 10-Arr[0], 11-Arr[1], 12-Arr[2] 21 | 22 | @Nummer: +1 23 | a: 1 24 | b: 2 25 | Arr: 10, 20, 30 26 | ArrMath: 9+Arr[0], 8+Arr[1], 7+Arr[2] 27 | 28 | EndObj; -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/test3.cod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/mdcii/mdcii/src/test/cod_parser_test/test3.cod -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/test3.txt: -------------------------------------------------------------------------------- 1 | Objekt: TEST 2 | 3 | Nummer: 0 4 | Pos: 0, 0 5 | 6 | Nummer: 0 7 | @Pos: +0, -1 8 | 9 | @Nummer: +1 10 | @Pos: +2, -3 11 | 12 | @Nummer: +1 13 | @Pos: -5, +10 14 | 15 | EndObj; -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/test_array.cod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/mdcii/mdcii/src/test/cod_parser_test/test_array.cod -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/cod_parser_test/test_array.txt: -------------------------------------------------------------------------------- 1 | Objekt: ARRAY_TEST 2 | 3 | Nummer: 0 4 | Pos: 20, 42 ; Property array 5 | Posoffs: 30-Pos[0], 200-Pos[1] ; 30 - 20, 200 - 42 -> 10, 158 6 | 7 | EndObj; -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/data_field_reader/haus_values.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | import re 3 | import sys 4 | 5 | # Input is file that is generated from output of cod_parser_test 6 | filepath = sys.argv[1] 7 | match = sys.argv[2] 8 | 9 | with open(filepath) as fp: 10 | line = fp.readline() 11 | name = "" 12 | dictlist = [dict() for x in range(3)] 13 | dictindex = 0 14 | set = False 15 | haus_found = False 16 | while line: 17 | if("HAUS" in line): 18 | haus_found = True 19 | if(haus_found == True): 20 | if("{" not in line and "}" not in line): 21 | m = re.search('name:\s*\"(\w+)+\"', line) 22 | if(m is not None): 23 | name=m.group(1) 24 | if(name.isdigit() == True): 25 | dictindex = 0 26 | if("HAUS_PRODTYP" in line): 27 | dictindex = 1 28 | if("HAUS_BAUKOST" in line): 29 | dictindex = 2 30 | 31 | if set == False: 32 | m = re.search('\w+:\s*\"(\w+)+\"', line) 33 | if(m != None and m.group(1) == match): 34 | set = True 35 | line = fp.readline() 36 | continue 37 | 38 | if set == True: 39 | m = re.search('\w+:\s*\"(\w+)+\"', line) 40 | if(m != None): 41 | dictlist[dictindex][m.group(1)] = 0 42 | set = False 43 | continue 44 | line = fp.readline() 45 | 46 | print("\nObject:") 47 | for key, value in dictlist[0].iteritems(): 48 | print(key) 49 | print("\nHAUS_PRODTYP:") 50 | for key, value in dictlist[1].iteritems(): 51 | print(key) 52 | print("\nHAUS_BAUKOST:") 53 | for key, value in dictlist[2].iteritems(): 54 | print(key) 55 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/data_field_reader/read_gadget_objekt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | import re 3 | import sys 4 | 5 | # Input is file that is generated from output of cod_parser_test 6 | filepath = sys.argv[1] 7 | with open(filepath) as fp: 8 | line = fp.readline() 9 | name = "" 10 | dictlist = [dict() for x in range(3)] 11 | dictindex = 0 12 | haus_found = False 13 | 14 | while line: 15 | if("GADGET" in line): 16 | haus_found = True 17 | if(haus_found == True): 18 | if("{" not in line and "}" not in line and "value" not in line): 19 | set = True 20 | m = re.search('name:\s*\"(\w+)+\"', line) 21 | 22 | if(m != None): 23 | name=m.group(1) 24 | 25 | if(name.isdigit() == True): 26 | dictindex = 0 27 | set = False 28 | 29 | if(set == True): 30 | dictlist[dictindex][name] = 0 31 | 32 | line = fp.readline() 33 | 34 | print("\nObject:") 35 | for key, value in dictlist[0].items(): 36 | print(key) 37 | 38 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/test/data_field_reader/read_haus_objekt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | import re 3 | import sys 4 | 5 | # Input is file that is generated from output of cod_parser_test 6 | filepath = sys.argv[1] 7 | with open(filepath) as fp: 8 | line = fp.readline() 9 | name = "" 10 | dictlist = [dict() for x in range(3)] 11 | dictindex = 0 12 | haus_found = False 13 | 14 | while line: 15 | if("HAUS" in line): 16 | haus_found = True 17 | if(haus_found == True): 18 | if("{" not in line and "}" not in line and "value" not in line): 19 | set = True 20 | m = re.search('name:\s*\"(\w+)+\"', line) 21 | 22 | if(m != None): 23 | name=m.group(1) 24 | 25 | if(name.isdigit() == True): 26 | dictindex = 0 27 | set = False 28 | 29 | if(name == "HAUS_PRODTYP"): 30 | dictindex = 1 31 | set = False 32 | 33 | if(name == "HAUS_BAUKOST"): 34 | dictindex = 2 35 | set = False 36 | 37 | if(set == True): 38 | dictlist[dictindex][name] = 0 39 | 40 | line = fp.readline() 41 | 42 | print("\nObject:") 43 | for key, value in dictlist[0].items(): 44 | print(key) 45 | print("\nHAUS_PRODTYP:") 46 | for key, value in dictlist[1].items(): 47 | print(key) 48 | print("\nHAUS_BAUKOST:") 49 | for key, value in dictlist[2].items(): 50 | print(key) 51 | 52 | -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/version/version.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of the MDCII Game Engine. 2 | // Copyright (C) 2020 Armin Schlegel 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | 18 | #include 19 | 20 | #include "bsh/bshreader.hpp" 21 | #include "files/files.hpp" 22 | #include "version/version.hpp" 23 | 24 | AnnoVersion Version::DetectGameVersion() 25 | { 26 | try 27 | { 28 | auto files = Files::Instance(); 29 | BshReader bsh(files->FindPathForFile("sgfx/stadtfld.bsh")); 30 | if (bsh.Count() == 5748) 31 | { 32 | return AnnoVersion::VANILLA; 33 | } 34 | else // sgfx.count == 5964 35 | { 36 | return AnnoVersion::NINA; 37 | } 38 | } 39 | catch (...) 40 | { 41 | return AnnoVersion::OTHER; 42 | } 43 | } 44 | 45 | std::string Version::GameVersionString() 46 | { 47 | auto version = DetectGameVersion(); 48 | if (version == AnnoVersion::VANILLA) 49 | { 50 | return "vanilla"; 51 | } 52 | else if (version == AnnoVersion::NINA) 53 | { 54 | return "NINA"; 55 | } 56 | else 57 | { 58 | return "OTHER"; 59 | } 60 | } -------------------------------------------------------------------------------- /source/mdcii/mdcii/src/world/world.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "world/world.hpp" 3 | #include "gam/gam_parser.hpp" 4 | #include "gam/island.hpp" 5 | #include "gam/islandhouse.hpp" 6 | 7 | World::World(GamParser gamParser) 8 | : gamParser(gamParser) 9 | { 10 | } 11 | 12 | std::experimental::optional> World::IslandOnPosition(uint16_t x, uint16_t y) 13 | { 14 | for (int i = 0; i < gamParser.Islands5Size(); i++) 15 | { 16 | auto island = gamParser.GetIsland5(i); 17 | auto islandData = island->GetIslandData(); 18 | if ((x >= islandData.posx) && (y >= islandData.posy) && (x < islandData.posx + islandData.width) && (y < islandData.posy + islandData.height)) 19 | { 20 | return island; 21 | } 22 | } 23 | return {}; 24 | } 25 | 26 | bool World::IslandNumberOnPosition(uint8_t number, uint16_t x, uint16_t y) 27 | { 28 | auto i = IslandOnPosition(x, y); 29 | if (i) 30 | { 31 | if (i.value()->GetIslandData().islandNumber == number) 32 | { 33 | return true; 34 | } 35 | } 36 | return false; 37 | } 38 | 39 | IslandHouseData World::TileOnPosition(uint16_t x, uint16_t y) 40 | { 41 | auto island = IslandOnPosition(x, y); 42 | if (island) 43 | { 44 | return island.value()->TerrainTile(x, y); 45 | } 46 | else 47 | { 48 | // todo add sea and animate 49 | // { 50 | // memset(&feld, 0, sizeof(inselfeld_t)); 51 | // feld.bebauung = 1201; 52 | // auto info = buildings->GetHouse(feld.bebauung); 53 | // if (info) 54 | // { 55 | // feld.ani = (0x80000000 + y + x * 3 + ani) % info.value()->AnimAnz; 56 | // } 57 | // } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /source/tests/README.md: -------------------------------------------------------------------------------- 1 | ## Update googletest and googlemock 2 | 3 | After updating, the following changes needs to be applied manually: 4 | 5 | * https://github.com/cginternals/cmake-init/commit/6df2e5acd0111ca13f4a54f616a8e9e729f3fedc 6 | * https://github.com/cginternals/cmake-init/commit/da2b52c0b8b47989d779b8285c1a0294a71947ac 7 | * https://github.com/cginternals/cmake-init/commit/f505bef30fe3122d7bd3b8061fcf704fac452d7f 8 | * https://github.com/cginternals/cmake-init/commit/217786a6e8ab1c3a69ab899ec7fba06d5516452a 9 | 10 | ### Explicit diff 11 | 12 | `googletest/googlemock/CMakeLists.txt` 13 | 14 | * Add `set(BUILD_SHARED_LIBS OFF)` after the call to `option(BUILD_SHARED_LIBS ...)` 15 | * Add `set(CMAKE_MACOSX_RPATH OFF)` before the calls to `cxx_library(...)` 16 | * Add `set_target_properties(gmock_main PROPERTIES FOLDER "Tests")` after the calls to `cxx_library(...)` 17 | * Add `set_target_properties(gmock PROPERTIES FOLDER "Tests")` after the calls to `cxx_library(...)` 18 | 19 | `googletest/googletest/CMakeLists.txt` 20 | 21 | * Add `set(BUILD_SHARED_LIBS OFF)` after the call to `option(BUILD_SHARED_LIBS ...)` 22 | * Add `set(CMAKE_MACOSX_RPATH OFF)` before the calls to `cxx_library(...)` 23 | * Add `set_target_properties(gtest_main PROPERTIES FOLDER "Tests")` after the calls to `cxx_library(...)` 24 | * Add `set_target_properties(gtest PROPERTIES FOLDER "Tests")` after the calls to `cxx_library(...)` 25 | * Comment out the calls to `install` 26 | -------------------------------------------------------------------------------- /source/tests/cache-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # External dependencies 4 | # 5 | 6 | find_package(${META_PROJECT_NAME} REQUIRED HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../") 7 | 8 | # 9 | # Executable name and options 10 | # 11 | 12 | # Target name 13 | set(target cacheprotobuf-test) 14 | message(STATUS "Test ${target}") 15 | 16 | 17 | # 18 | # Sources 19 | # 20 | 21 | set(sources 22 | main.cpp 23 | cacheProtobufTest.cpp 24 | ) 25 | 26 | 27 | # 28 | # Create executable 29 | # 30 | 31 | # Build executable 32 | add_executable(${target} 33 | ${sources} 34 | ) 35 | 36 | # Create namespaced alias 37 | add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 38 | 39 | 40 | # 41 | # Project options 42 | # 43 | 44 | set_target_properties(${target} 45 | PROPERTIES 46 | ${DEFAULT_PROJECT_OPTIONS} 47 | FOLDER "${IDE_FOLDER}" 48 | ) 49 | 50 | 51 | # 52 | # Include directories 53 | # 54 | 55 | target_include_directories(${target} 56 | PRIVATE 57 | ${DEFAULT_INCLUDE_DIRECTORIES} 58 | ${PROJECT_BINARY_DIR}/source/include 59 | ) 60 | 61 | 62 | # 63 | # Libraries 64 | # 65 | 66 | target_link_libraries(${target} 67 | PRIVATE 68 | ${DEFAULT_LIBRARIES} 69 | ${META_PROJECT_NAME}::mdcii 70 | gmock-dev 71 | ) 72 | 73 | 74 | # 75 | # Compile definitions 76 | # 77 | 78 | target_compile_definitions(${target} 79 | PRIVATE 80 | ${DEFAULT_COMPILE_DEFINITIONS} 81 | ) 82 | 83 | 84 | # 85 | # Compile options 86 | # 87 | 88 | target_compile_options(${target} 89 | PRIVATE 90 | ${DEFAULT_COMPILE_OPTIONS} 91 | ) 92 | 93 | 94 | # 95 | # Linker options 96 | # 97 | 98 | target_link_libraries(${target} 99 | PRIVATE 100 | ${DEFAULT_LINKER_OPTIONS} 101 | ) -------------------------------------------------------------------------------- /source/tests/cache-test/cacheProtobufTest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include "cod.pb.h" 8 | 9 | namespace fs = std::filesystem; 10 | 11 | class CacheProtobufTest : public testing::Test 12 | { 13 | public: 14 | }; 15 | 16 | TEST_F(CacheProtobufTest, CheckSomeResults) 17 | { 18 | std::string path = fs::u8path("mdcii-tests/cacheprotobuftest.json"); 19 | std::string fullPath = std::string(path.c_str()); 20 | 21 | cod_pb::Object obj; 22 | obj.set_name("Test"); 23 | auto variables = obj.mutable_variables(); 24 | auto var = variables->add_variable(); 25 | var->set_name("Variable1"); 26 | var->set_value_string("value1"); 27 | CacheProtobuf cache(fullPath, true); 28 | ASSERT_EQ(cache.Exists(), false); 29 | cache.Serialize(obj); 30 | ASSERT_EQ(cache.Exists(), true); 31 | auto deserialized = cache.Deserialize(); 32 | ASSERT_EQ(deserialized.name(), "Test"); 33 | ASSERT_EQ(deserialized.variables().variable(0).name(), "Variable1"); 34 | ASSERT_EQ(deserialized.variables().variable(0).value_string(), "value1"); 35 | } -------------------------------------------------------------------------------- /source/tests/cache-test/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char* argv[]) 4 | { 5 | ::testing::InitGoogleMock(&argc, argv); 6 | return RUN_ALL_TESTS(); 7 | } -------------------------------------------------------------------------------- /source/tests/googletest/.clang-format: -------------------------------------------------------------------------------- 1 | # Run manually to reformat a file: 2 | # clang-format -i --style=file 3 | Language: Cpp 4 | BasedOnStyle: Google 5 | -------------------------------------------------------------------------------- /source/tests/googletest/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore CI build directory 2 | build/ 3 | xcuserdata 4 | cmake-build-debug/ 5 | .idea/ 6 | bazel-bin 7 | bazel-genfiles 8 | bazel-googletest 9 | bazel-out 10 | bazel-testlogs 11 | # python 12 | *.pyc 13 | 14 | # Visual Studio files 15 | .vs 16 | *.sdf 17 | *.opensdf 18 | *.VC.opendb 19 | *.suo 20 | *.user 21 | _ReSharper.Caches/ 22 | Win32-Debug/ 23 | Win32-Release/ 24 | x64-Debug/ 25 | x64-Release/ 26 | 27 | # Ignore autoconf / automake files 28 | Makefile.in 29 | aclocal.m4 30 | configure 31 | build-aux/ 32 | autom4te.cache/ 33 | googletest/m4/libtool.m4 34 | googletest/m4/ltoptions.m4 35 | googletest/m4/ltsugar.m4 36 | googletest/m4/ltversion.m4 37 | googletest/m4/lt~obsolete.m4 38 | googlemock/m4 39 | 40 | # Ignore generated directories. 41 | googlemock/fused-src/ 42 | googletest/fused-src/ 43 | 44 | # macOS files 45 | .DS_Store 46 | googletest/.DS_Store 47 | googletest/xcode/.DS_Store 48 | 49 | # Ignore cmake generated directories and files. 50 | CMakeFiles 51 | CTestTestfile.cmake 52 | Makefile 53 | cmake_install.cmake 54 | googlemock/CMakeFiles 55 | googlemock/CTestTestfile.cmake 56 | googlemock/Makefile 57 | googlemock/cmake_install.cmake 58 | googlemock/gtest 59 | /bin 60 | /googlemock/gmock.dir 61 | /googlemock/gmock_main.dir 62 | /googlemock/RUN_TESTS.vcxproj.filters 63 | /googlemock/RUN_TESTS.vcxproj 64 | /googlemock/INSTALL.vcxproj.filters 65 | /googlemock/INSTALL.vcxproj 66 | /googlemock/gmock_main.vcxproj.filters 67 | /googlemock/gmock_main.vcxproj 68 | /googlemock/gmock.vcxproj.filters 69 | /googlemock/gmock.vcxproj 70 | /googlemock/gmock.sln 71 | /googlemock/ALL_BUILD.vcxproj.filters 72 | /googlemock/ALL_BUILD.vcxproj 73 | /lib 74 | /Win32 75 | /ZERO_CHECK.vcxproj.filters 76 | /ZERO_CHECK.vcxproj 77 | /RUN_TESTS.vcxproj.filters 78 | /RUN_TESTS.vcxproj 79 | /INSTALL.vcxproj.filters 80 | /INSTALL.vcxproj 81 | /googletest-distribution.sln 82 | /CMakeCache.txt 83 | /ALL_BUILD.vcxproj.filters 84 | /ALL_BUILD.vcxproj 85 | -------------------------------------------------------------------------------- /source/tests/googletest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Note: CMake support is community-based. The maintainers do not use CMake 2 | # internally. 3 | 4 | cmake_minimum_required(VERSION 2.8.8) 5 | 6 | if (POLICY CMP0048) 7 | cmake_policy(SET CMP0048 NEW) 8 | endif (POLICY CMP0048) 9 | 10 | project(googletest-distribution) 11 | set(GOOGLETEST_VERSION 1.10.0) 12 | 13 | if (CMAKE_VERSION VERSION_GREATER "3.0.2") 14 | if(NOT CYGWIN AND NOT MSYS AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL QNX) 15 | set(CMAKE_CXX_EXTENSIONS OFF) 16 | endif() 17 | endif() 18 | 19 | enable_testing() 20 | 21 | include(CMakeDependentOption) 22 | include(GNUInstallDirs) 23 | 24 | #Note that googlemock target already builds googletest 25 | option(BUILD_GMOCK "Builds the googlemock subproject" ON) 26 | option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) 27 | 28 | if(BUILD_GMOCK) 29 | add_subdirectory( googlemock ) 30 | else() 31 | add_subdirectory( googletest ) 32 | endif() 33 | -------------------------------------------------------------------------------- /source/tests/googletest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /source/tests/googletest/WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "com_google_googletest") 2 | 3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4 | 5 | http_archive( 6 | name = "com_google_absl", # 2020-10-13T16:49:13Z 7 | urls = [ 8 | "https://github.com/abseil/abseil-cpp/archive/f3f785ab59478dd0312bf1b5df65d380650bf0dc.zip" 9 | ], 10 | strip_prefix = "abseil-cpp-f3f785ab59478dd0312bf1b5df65d380650bf0dc", 11 | sha256 = "00c3707bf9cd5eabd1ec6932cc65b97378c043f22573be3adf7d11bb7af17d06", 12 | ) 13 | 14 | http_archive( 15 | name = "rules_cc", # 2020-10-05T06:01:24Z 16 | urls = [ 17 | "https://github.com/bazelbuild/rules_cc/archive/f055da4ff0cb2b3c73de1fe2f094ebdfb8b3acb9.zip" 18 | ], 19 | strip_prefix = "rules_cc-f055da4ff0cb2b3c73de1fe2f094ebdfb8b3acb9", 20 | sha256 = "35ea62c63cd71d4000efe85f9f4f17e8afb23896c37ee9510952db2e9d8fbb70", 21 | ) 22 | 23 | http_archive( 24 | name = "rules_python", # 2020-09-30T13:50:21Z 25 | urls = [ 26 | "https://github.com/bazelbuild/rules_python/archive/c064f7008a30f307ea7516cf52358a653011f82b.zip", 27 | ], 28 | strip_prefix = "rules_python-c064f7008a30f307ea7516cf52358a653011f82b", 29 | sha256 = "6e49996ad3cf45b2232b8f94ca1e3ead369c28394c51632be8d85fe826383012", 30 | ) 31 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/build-linux-bazel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -e 33 | 34 | bazel version 35 | bazel test --curses=no //...:all 36 | bazel test --curses=no //...:all --define absl=1 37 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/build-platformio.sh: -------------------------------------------------------------------------------- 1 | # run PlatformIO builds 2 | platformio run 3 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/install-osx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -eu 33 | 34 | if [ "${TRAVIS_OS_NAME}" != "osx" ]; then 35 | echo "Not a macOS build; skipping installation" 36 | exit 0 37 | fi 38 | 39 | brew update 40 | brew install ccache gcc@4.9 41 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/install-platformio.sh: -------------------------------------------------------------------------------- 1 | # install PlatformIO 2 | sudo pip install -U platformio 3 | 4 | # update PlatformIO 5 | platformio update 6 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/travis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -evx 3 | 4 | . ci/get-nprocessors.sh 5 | 6 | # Tell make to use the processors. No preceding '-' required. 7 | MAKEFLAGS="j${NPROCESSORS}" 8 | export MAKEFLAGS 9 | 10 | env | sort 11 | 12 | # Set default values to OFF for these variables if not specified. 13 | : "${NO_EXCEPTION:=OFF}" 14 | : "${NO_RTTI:=OFF}" 15 | : "${COMPILER_IS_GNUCXX:=OFF}" 16 | 17 | mkdir build || true 18 | cd build 19 | cmake -Dgtest_build_samples=ON \ 20 | -Dgtest_build_tests=ON \ 21 | -Dgmock_build_tests=ON \ 22 | -Dcxx_no_exception="$NO_EXCEPTION" \ 23 | -Dcxx_no_rtti="$NO_RTTI" \ 24 | -DCMAKE_COMPILER_IS_GNUCXX="$COMPILER_IS_GNUCXX" \ 25 | -DCMAKE_CXX_FLAGS="$CXX_FLAGS" \ 26 | -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ 27 | .. 28 | make 29 | CTEST_OUTPUT_ON_FAILURE=1 make test 30 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Mocking Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Benoit Sigoure 7 | Bogdan Piloca 8 | Chandler Carruth 9 | Dave MacLachlan 10 | David Anderson 11 | Dean Sturtevant 12 | Gene Volovich 13 | Hal Burch 14 | Jeffrey Yasskin 15 | Jim Keller 16 | Joe Walnes 17 | Jon Wray 18 | Keir Mierle 19 | Keith Ray 20 | Kostya Serebryany 21 | Lev Makhlis 22 | Manuel Klimek 23 | Mario Tanev 24 | Mark Paskin 25 | Markus Heule 26 | Matthew Simmons 27 | Mike Bland 28 | Neal Norwitz 29 | Nermin Ozkiranartli 30 | Owen Carlsen 31 | Paneendra Ba 32 | Paul Menage 33 | Piotr Kaminski 34 | Russ Rufer 35 | Sverre Sundsdal 36 | Takeshi Yoshino 37 | Vadim Berman 38 | Vlad Losev 39 | Wolfgang Klier 40 | Zhanyong Wan 41 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/README.md: -------------------------------------------------------------------------------- 1 | # Googletest Mocking (gMock) Framework 2 | 3 | ### Overview 4 | 5 | Google's framework for writing and using C++ mock classes. It can help you 6 | derive better designs of your system and write better tests. 7 | 8 | It is inspired by: 9 | 10 | * [jMock](http://www.jmock.org/) 11 | * [EasyMock](http://www.easymock.org/) 12 | * [Hamcrest](http://code.google.com/p/hamcrest/) 13 | 14 | It is designed with C++'s specifics in mind. 15 | 16 | gMock: 17 | 18 | - Provides a declarative syntax for defining mocks. 19 | - Can define partial (hybrid) mocks, which are a cross of real and mock 20 | objects. 21 | - Handles functions of arbitrary types and overloaded functions. 22 | - Comes with a rich set of matchers for validating function arguments. 23 | - Uses an intuitive syntax for controlling the behavior of a mock. 24 | - Does automatic verification of expectations (no record-and-replay needed). 25 | - Allows arbitrary (partial) ordering constraints on function calls to be 26 | expressed. 27 | - Lets a user extend it by defining new matchers and actions. 28 | - Does not use exceptions. 29 | - Is easy to learn and use. 30 | 31 | Details and examples can be found here: 32 | 33 | * [gMock for Dummies](docs/for_dummies.md) 34 | * [Legacy gMock FAQ](docs/gmock_faq.md) 35 | * [gMock Cookbook](docs/cook_book.md) 36 | * [gMock Cheat Sheet](docs/cheat_sheet.md) 37 | 38 | Please note that code under scripts/generator/ is from the [cppclean 39 | project](http://code.google.com/p/cppclean/) and under the Apache 40 | License, which is different from Google Mock's license. 41 | 42 | Google Mock is a part of 43 | [Google Test C++ testing framework](http://github.com/google/googletest/) and a 44 | subject to the same requirements. 45 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/cmake/gmock.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: gmock 5 | Description: GoogleMock (without main() function) 6 | Version: @PROJECT_VERSION@ 7 | URL: https://github.com/google/googletest 8 | Requires: gtest = @PROJECT_VERSION@ 9 | Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ 11 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/cmake/gmock_main.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: gmock_main 5 | Description: GoogleMock (with main() function) 6 | Version: @PROJECT_VERSION@ 7 | URL: https://github.com/google/googletest 8 | Requires: gmock = @PROJECT_VERSION@ 9 | Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ 11 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/docs/community_created_documentation.md: -------------------------------------------------------------------------------- 1 | # Community-Created Documentation 2 | 3 | go/gunit-community-created-docs 4 | 5 | The following is a list, in no particular order, of links to documentation 6 | created by the Googletest community. 7 | 8 | * [Googlemock Insights](https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/googletest/insights.md), 9 | by [ElectricRCAircraftGuy](https://github.com/ElectricRCAircraftGuy) 10 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/include/gmock/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gmock-port.h` 6 | 7 | The following macros can be defined: 8 | 9 | ### Flag related macros: 10 | 11 | * `GMOCK_DECLARE_bool_(name)` 12 | * `GMOCK_DECLARE_int32_(name)` 13 | * `GMOCK_DECLARE_string_(name)` 14 | * `GMOCK_DEFINE_bool_(name, default_val, doc)` 15 | * `GMOCK_DEFINE_int32_(name, default_val, doc)` 16 | * `GMOCK_DEFINE_string_(name, default_val, doc)` 17 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h: -------------------------------------------------------------------------------- 1 | // This file was GENERATED by command: 2 | // pump.py gmock-generated-actions.h.pump 3 | // DO NOT EDIT BY HAND!!! 4 | 5 | // GOOGLETEST_CM0002 DO NOT DELETE 6 | 7 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 8 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 9 | 10 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $$ This is a Pump source file. Please use Pump to convert 3 | $$ it to callback-actions.h. 4 | $$ 5 | $var max_callback_arity = 5 6 | $$}} This meta comment fixes auto-indentation in editors. 7 | 8 | // GOOGLETEST_CM0002 DO NOT DELETE 9 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 10 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | 12 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 13 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/README.md: -------------------------------------------------------------------------------- 1 | # Please Note: 2 | 3 | Files in this directory are no longer supported by the maintainers. They 4 | represent mostly historical artifacts and supported by the community only. There 5 | is no guarantee whatsoever that these scripts still work. 6 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/README: -------------------------------------------------------------------------------- 1 | 2 | The Google Mock class generator is an application that is part of cppclean. 3 | For more information about cppclean, visit http://code.google.com/p/cppclean/ 4 | 5 | The mock generator requires Python 2.3.5 or later. If you don't have Python 6 | installed on your system, you will also need to install it. You can download 7 | Python from: http://www.python.org/download/releases/ 8 | 9 | To use the Google Mock class generator, you need to call it 10 | on the command line passing the header file and class for which you want 11 | to generate a Google Mock class. 12 | 13 | Make sure to install the scripts somewhere in your path. Then you can 14 | run the program. 15 | 16 | gmock_gen.py header-file.h [ClassName]... 17 | 18 | If no ClassNames are specified, all classes in the file are emitted. 19 | 20 | To change the indentation from the default of 2, set INDENT in 21 | the environment. For example to use an indent of 4 spaces: 22 | 23 | INDENT=4 gmock_gen.py header-file.h ClassName 24 | 25 | This version was made from SVN revision 281 in the cppclean repository. 26 | 27 | Known Limitations 28 | ----------------- 29 | Not all code will be generated properly. For example, when mocking templated 30 | classes, the template information is lost. You will need to add the template 31 | information manually. 32 | 33 | Not all permutations of using multiple pointers/references will be rendered 34 | properly. These will also have to be fixed manually. 35 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/cpp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/tests/googletest/googlemock/scripts/generator/cpp/__init__.py -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/cpp/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """Generic utilities for C++ parsing.""" 19 | 20 | import sys 21 | 22 | # Set to True to see the start/end token indices. 23 | DEBUG = True 24 | 25 | 26 | def ReadFile(filename, print_error=True): 27 | """Returns the contents of a file.""" 28 | try: 29 | fp = open(filename) 30 | try: 31 | return fp.read() 32 | finally: 33 | fp.close() 34 | except IOError: 35 | if print_error: 36 | print('Error reading %s: %s' % (filename, sys.exc_info()[1])) 37 | return None 38 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/gmock_gen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | """Driver for starting up Google Mock class generator.""" 18 | 19 | 20 | import os 21 | import sys 22 | 23 | if __name__ == '__main__': 24 | # Add the directory of this script to the path so we can import gmock_class. 25 | sys.path.append(os.path.dirname(__file__)) 26 | 27 | from cpp import gmock_class 28 | # Fix the docstring in case they require the usage. 29 | gmock_class.__doc__ = gmock_class.__doc__.replace('gmock_class.py', __file__) 30 | gmock_class.main() 31 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/test/gmock-function-mocker_nc.cc: -------------------------------------------------------------------------------- 1 | #include "gmock/gmock.h" 2 | 3 | #include 4 | #include 5 | 6 | #if defined(TEST_MOCK_METHOD_INVALID_CONST_SPEC) 7 | 8 | struct Base { 9 | MOCK_METHOD(int, F, (), (onst)); 10 | }; 11 | 12 | #else 13 | 14 | // Sanity check - this should compile. 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/test/gmock-function-mocker_nc_test.py: -------------------------------------------------------------------------------- 1 | """Negative compilation tests for Google Mock macro MOCK_METHOD.""" 2 | 3 | import os 4 | import sys 5 | 6 | IS_LINUX = os.name == "posix" and os.uname()[0] == "Linux" 7 | if not IS_LINUX: 8 | sys.stderr.write( 9 | "WARNING: Negative compilation tests are not supported on this platform") 10 | sys.exit(0) 11 | 12 | # Suppresses the 'Import not at the top of the file' lint complaint. 13 | # pylint: disable-msg=C6204 14 | from google3.testing.pybase import fake_target_util 15 | from google3.testing.pybase import googletest 16 | 17 | # pylint: enable-msg=C6204 18 | 19 | 20 | class GMockMethodNCTest(googletest.TestCase): 21 | """Negative compilation tests for MOCK_METHOD.""" 22 | 23 | # The class body is intentionally empty. The actual test*() methods 24 | # will be defined at run time by a call to 25 | # DefineNegativeCompilationTests() later. 26 | pass 27 | 28 | 29 | # Defines a list of test specs, where each element is a tuple 30 | # (test name, list of regexes for matching the compiler errors). 31 | TEST_SPECS = [ 32 | ("MOCK_METHOD_INVALID_CONST_SPEC", 33 | [r"onst cannot be recognized as a valid specification modifier"]), 34 | ] 35 | 36 | # Define a test method in GMockNCTest for each element in TEST_SPECS. 37 | fake_target_util.DefineNegativeCompilationTests( 38 | GMockMethodNCTest, 39 | "google3/third_party/googletest/googlemock/test/gmock-function-mocker_nc", 40 | "gmock-function-mocker_nc.o", TEST_SPECS) 41 | 42 | if __name__ == "__main__": 43 | googletest.main() 44 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Krystian Kuzniarek 21 | Manuel Klimek 22 | Markus Heule 23 | Mika Raento 24 | Miklós Fazekas 25 | Pasi Valminen 26 | Patrick Hanna 27 | Patrick Riley 28 | Peter Kaminski 29 | Preston Jackson 30 | Rainer Klaffenboeck 31 | Russ Cox 32 | Russ Rufer 33 | Sean Mcafee 34 | Sigurður Ásgeirsson 35 | Tracy Bialik 36 | Vadim Berman 37 | Vlad Losev 38 | Zhanyong Wan 39 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | include(CMakeFindDependencyMacro) 3 | if (@GTEST_HAS_PTHREAD@) 4 | set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@) 5 | find_dependency(Threads) 6 | endif() 7 | 8 | include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") 9 | check_required_components("@project_name@") 10 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/cmake/gtest.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: gtest 5 | Description: GoogleTest (without main() function) 6 | Version: @PROJECT_VERSION@ 7 | URL: https://github.com/google/googletest 8 | Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@ 9 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ 10 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/cmake/gtest_main.pc.in: -------------------------------------------------------------------------------- 1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 3 | 4 | Name: gtest_main 5 | Description: GoogleTest (with main() function) 6 | Version: @PROJECT_VERSION@ 7 | URL: https://github.com/google/googletest 8 | Requires: gtest = @PROJECT_VERSION@ 9 | Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ 11 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/cmake/libgtest.la.in: -------------------------------------------------------------------------------- 1 | # libgtest.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Names of this library. 8 | library_names='libgtest.so' 9 | 10 | # Is this an already installed library? 11 | installed=yes 12 | 13 | # Should we warn about portability when linking against -modules? 14 | shouldnotlink=no 15 | 16 | # Files to dlopen/dlpreopen 17 | dlopen='' 18 | dlpreopen='' 19 | 20 | # Directory that this library needs to be installed in: 21 | libdir='@CMAKE_INSTALL_FULL_LIBDIR@' 22 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/docs/samples.md: -------------------------------------------------------------------------------- 1 | # Googletest Samples {#samples} 2 | 3 | If you're like us, you'd like to look at 4 | [googletest samples.](https://github.com/google/googletest/tree/master/googletest/samples) 5 | The sample directory has a number of well-commented samples showing how to use a 6 | variety of googletest features. 7 | 8 | * Sample #1 shows the basic steps of using googletest to test C++ functions. 9 | * Sample #2 shows a more complex unit test for a class with multiple member 10 | functions. 11 | * Sample #3 uses a test fixture. 12 | * Sample #4 teaches you how to use googletest and `googletest.h` together to 13 | get the best of both libraries. 14 | * Sample #5 puts shared testing logic in a base test fixture, and reuses it in 15 | derived fixtures. 16 | * Sample #6 demonstrates type-parameterized tests. 17 | * Sample #7 teaches the basics of value-parameterized tests. 18 | * Sample #8 shows using `Combine()` in value-parameterized tests. 19 | * Sample #9 shows use of the listener API to modify Google Test's console 20 | output and the use of its reflection API to inspect test results. 21 | * Sample #10 shows use of the listener API to implement a primitive memory 22 | leak checker. 23 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/include/gtest/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gtest.h` 6 | 7 | ### The following macros can be defined: 8 | 9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of 10 | `OsStackTraceGetterInterface`. 11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See 12 | `testing::TempDir` for semantics and signature. 13 | 14 | ## Header `gtest-port.h` 15 | 16 | The following macros can be defined: 17 | 18 | ### Flag related macros: 19 | 20 | * `GTEST_FLAG(flag_name)` 21 | * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its 22 | own flagfile flag parsing. 23 | * `GTEST_DECLARE_bool_(name)` 24 | * `GTEST_DECLARE_int32_(name)` 25 | * `GTEST_DECLARE_string_(name)` 26 | * `GTEST_DEFINE_bool_(name, default_val, doc)` 27 | * `GTEST_DEFINE_int32_(name, default_val, doc)` 28 | * `GTEST_DEFINE_string_(name, default_val, doc)` 29 | 30 | ### Logging: 31 | 32 | * `GTEST_LOG_(severity)` 33 | * `GTEST_CHECK_(condition)` 34 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. 35 | 36 | ### Threading: 37 | 38 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. 39 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` 40 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` 41 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` 42 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` 43 | * `GTEST_LOCK_EXCLUDED_(locks)` 44 | 45 | ### Underlying library support features 46 | 47 | * `GTEST_HAS_CXXABI_H_` 48 | 49 | ### Exporting API symbols: 50 | 51 | * `GTEST_API_` - Specifier for exported symbols. 52 | 53 | ## Header `gtest-printers.h` 54 | 55 | * See documentation at `gtest/gtest-printers.h` for details on how to define a 56 | custom printer. 57 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/include/gtest/internal/custom/gtest.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 38 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/scripts/README.md: -------------------------------------------------------------------------------- 1 | # Please Note: 2 | 3 | Files in this directory are no longer supported by the maintainers. They 4 | represent mosty historical artifacts and supported by the community only. There 5 | is no guarantee whatsoever that these scripts still work. 6 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/scripts/run_with_path.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2010 Google Inc. All Rights Reserved. 4 | 5 | """Runs program specified in the command line with the substituted PATH. 6 | 7 | This script is needed for to support building under Pulse which is unable 8 | to override the existing PATH variable. 9 | """ 10 | 11 | import os 12 | import subprocess 13 | import sys 14 | 15 | SUBST_PATH_ENV_VAR_NAME = "SUBST_PATH" 16 | 17 | def main(): 18 | if SUBST_PATH_ENV_VAR_NAME in os.environ: 19 | os.environ["PATH"] = os.environ[SUBST_PATH_ENV_VAR_NAME] 20 | 21 | exit_code = subprocess.Popen(sys.argv[1:]).wait() 22 | 23 | # exit_code is negative (-signal) if the process has been terminated by 24 | # a signal. Returning negative exit code is not portable and so we return 25 | # 100 instead. 26 | if exit_code < 0: 27 | exit_code = 100 28 | 29 | sys.exit(exit_code) 30 | 31 | if __name__ == "__main__": 32 | main() 33 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // This is part of the unit test for gtest_prod.h. 32 | 33 | #include "production.h" 34 | 35 | PrivateCode::PrivateCode() : x_(0) {} 36 | -------------------------------------------------------------------------------- /source/tests/proto-gamelist-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # External dependencies 4 | # 5 | 6 | find_package(${META_PROJECT_NAME} REQUIRED HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../") 7 | 8 | # 9 | # Executable name and options 10 | # 11 | 12 | # Target name 13 | set(target proto-gamelist-test) 14 | message(STATUS "Test ${target}") 15 | 16 | 17 | # 18 | # Sources 19 | # 20 | 21 | set(sources 22 | main.cpp 23 | protoGamesTest.cpp 24 | ) 25 | 26 | 27 | # 28 | # Create executable 29 | # 30 | 31 | # Build executable 32 | add_executable(${target} 33 | ${sources} 34 | ) 35 | 36 | # Create namespaced alias 37 | add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 38 | 39 | 40 | # 41 | # Project options 42 | # 43 | 44 | set_target_properties(${target} 45 | PROPERTIES 46 | ${DEFAULT_PROJECT_OPTIONS} 47 | FOLDER "${IDE_FOLDER}" 48 | ) 49 | 50 | 51 | # 52 | # Include directories 53 | # 54 | 55 | target_include_directories(${target} 56 | PRIVATE 57 | ${DEFAULT_INCLUDE_DIRECTORIES} 58 | ${PROJECT_BINARY_DIR}/source/include 59 | ) 60 | 61 | 62 | # 63 | # Libraries 64 | # 65 | 66 | target_link_libraries(${target} 67 | PRIVATE 68 | ${DEFAULT_LIBRARIES} 69 | ${META_PROJECT_NAME}::mdcii 70 | gmock-dev 71 | ) 72 | 73 | 74 | # 75 | # Compile definitions 76 | # 77 | 78 | target_compile_definitions(${target} 79 | PRIVATE 80 | ${DEFAULT_COMPILE_DEFINITIONS} 81 | ) 82 | 83 | 84 | # 85 | # Compile options 86 | # 87 | 88 | target_compile_options(${target} 89 | PRIVATE 90 | ${DEFAULT_COMPILE_OPTIONS} 91 | ) 92 | 93 | 94 | # 95 | # Linker options 96 | # 97 | 98 | target_link_libraries(${target} 99 | PRIVATE 100 | ${DEFAULT_LINKER_OPTIONS} 101 | ) -------------------------------------------------------------------------------- /source/tests/proto-gamelist-test/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char* argv[]) 4 | { 5 | ::testing::InitGoogleMock(&argc, argv); 6 | return RUN_ALL_TESTS(); 7 | } -------------------------------------------------------------------------------- /source/tests/proto-gamelist-test/protoGamesTest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "gamelist.pb.h" 6 | 7 | class ProtoGamelistTest : public testing::Test 8 | { 9 | public: 10 | }; 11 | 12 | TEST_F(ProtoGamelistTest, SimpleSingleGamesList) 13 | { 14 | auto list = GamesPb::Games(); 15 | for (int i = 0; i < 5; i++) 16 | { 17 | auto singleScenario = list.add_originalsingle(); 18 | singleScenario->set_name("scenario " + std::to_string(i)); 19 | singleScenario->set_path("/tmp/scen" + std::to_string(i) + ".szs"); 20 | singleScenario->set_stars(i); 21 | singleScenario->set_flags(i % 2); 22 | } 23 | ASSERT_EQ(list.originalsingle_size(), 5); 24 | } -------------------------------------------------------------------------------- /source/tests/proto-textcod-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # External dependencies 4 | # 5 | 6 | find_package(${META_PROJECT_NAME} REQUIRED HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../") 7 | 8 | # 9 | # Executable name and options 10 | # 11 | 12 | # Target name 13 | set(target proto-textcod-test) 14 | message(STATUS "Test ${target}") 15 | 16 | 17 | # 18 | # Sources 19 | # 20 | 21 | set(sources 22 | main.cpp 23 | textcodTest.cpp 24 | ) 25 | 26 | 27 | # 28 | # Create executable 29 | # 30 | 31 | # Build executable 32 | add_executable(${target} 33 | ${sources} 34 | ) 35 | 36 | # Create namespaced alias 37 | add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 38 | 39 | 40 | # 41 | # Project options 42 | # 43 | 44 | set_target_properties(${target} 45 | PROPERTIES 46 | ${DEFAULT_PROJECT_OPTIONS} 47 | FOLDER "${IDE_FOLDER}" 48 | ) 49 | 50 | 51 | # 52 | # Include directories 53 | # 54 | 55 | target_include_directories(${target} 56 | PRIVATE 57 | ${DEFAULT_INCLUDE_DIRECTORIES} 58 | ${PROJECT_BINARY_DIR}/source/include 59 | ) 60 | 61 | 62 | # 63 | # Libraries 64 | # 65 | 66 | target_link_libraries(${target} 67 | PRIVATE 68 | ${DEFAULT_LIBRARIES} 69 | ${META_PROJECT_NAME}::mdcii 70 | gmock-dev 71 | ) 72 | 73 | 74 | # 75 | # Compile definitions 76 | # 77 | 78 | target_compile_definitions(${target} 79 | PRIVATE 80 | ${DEFAULT_COMPILE_DEFINITIONS} 81 | ) 82 | 83 | 84 | # 85 | # Compile options 86 | # 87 | 88 | target_compile_options(${target} 89 | PRIVATE 90 | ${DEFAULT_COMPILE_OPTIONS} 91 | ) 92 | 93 | 94 | # 95 | # Linker options 96 | # 97 | 98 | target_link_libraries(${target} 99 | PRIVATE 100 | ${DEFAULT_LINKER_OPTIONS} 101 | ) -------------------------------------------------------------------------------- /source/tests/proto-textcod-test/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char* argv[]) 4 | { 5 | ::testing::InitGoogleMock(&argc, argv); 6 | return RUN_ALL_TESTS(); 7 | } -------------------------------------------------------------------------------- /source/tests/proto-textcod-test/text.cod: -------------------------------------------------------------------------------- 1 | -------------------------------------------------- 2 | [ERROR] 3 | Error message 0! 4 | Error message 1! 5 | Error message 2! 6 | Error message 3! 7 | Error message 4! 8 | [END] 9 | -------------------------------------------------- 10 | [PATH] 11 | Some Path 12 | [END] 13 | -------------------------------------------------- 14 | [ENDLESSKIND] 15 | Easy 16 | Average 17 | Somewhat okay 18 | Hard 19 | 20 | [END] 21 | -------------------------------------------------- 22 | [KAMPAGNE] 23 | KMP0_MISSION0 24 | KMP0_MISSION1 25 | KMP0_MISSION2 26 | KMP0_MISSION3 27 | 28 | KMP1_MISSION0 29 | KMP1_MISSION1 30 | KMP1_MISSION2 31 | 32 | 33 | KMP2_MISSION0 34 | KMP2_MISSION1 35 | KMP2_MISSION2 36 | 37 | 38 | KMP3_MISSION0 39 | KMP3_MISSION1 40 | KMP3_MISSION2 41 | 42 | 43 | KMP4_MISSION0 44 | KMP4_MISSION1 45 | KMP4_MISSION2 46 | 47 | 48 | KMP5_MISSION0 49 | KMP5_MISSION1 50 | KMP5_MISSION2 51 | KMP5_MISSION3 52 | 53 | [END] 54 | -------------------------------------------------- 55 | [FIGKIND] 56 | Unused 57 | FIG0 58 | FIG1 59 | FIG2 60 | FIG3 61 | [END] -------------------------------------------------------------------------------- /source/thirdparty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(nanogui-sdl) 2 | add_subdirectory(PlatformFolders) -------------------------------------------------------------------------------- /source/thirdparty/PlatformFolders/PlatformFolders/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | 30 | # Sago's files 31 | private 32 | .deps 33 | doxygen 34 | *~ 35 | platform_folders 36 | nbproject 37 | 38 | # Commonly used build dir 39 | build 40 | -------------------------------------------------------------------------------- /source/thirdparty/PlatformFolders/PlatformFolders/.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | matrix: 3 | include: 4 | - os: linux 5 | env: BUILD_TYPE=Debug 6 | compiler: gcc 7 | - os: linux 8 | env: BUILD_TYPE=Debug 9 | compiler: clang 10 | - os: linux 11 | env: BUILD_TYPE=Release 12 | compiler: gcc 13 | - os: linux 14 | env: BUILD_TYPE=Release 15 | compiler: clang 16 | - os: osx 17 | env: BUILD_TYPE=Debug 18 | compiler: gcc 19 | - os: osx 20 | env: BUILD_TYPE=Debug 21 | compiler: clang 22 | - os: osx 23 | env: BUILD_TYPE=Release 24 | compiler: gcc 25 | - os: osx 26 | env: BUILD_TYPE=Release 27 | compiler: clang 28 | before_script: 29 | - mkdir -p build && cd build 30 | script: 31 | # Run cmake, then compile and run tests with make 32 | - cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && make -j$(nproc) && make test 33 | notifications: 34 | email: false 35 | -------------------------------------------------------------------------------- /source/thirdparty/PlatformFolders/PlatformFolders/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Poul Sander 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /source/thirdparty/PlatformFolders/PlatformFolders/platform_foldersConfig.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") 4 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/.gitignore: -------------------------------------------------------------------------------- 1 | /.directory 2 | /build/* 3 | /SDL2* 4 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/cmake/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/cmake/screenshot.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/Roboto-Bold.ttf -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/Roboto-Regular.ttf -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/entypo.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/entypo.ttf -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon1.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon2.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon3.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon4.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon5.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon6.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon7.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/icons/icon8.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/resources/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/siredmar/mdcii-engine/69d96c7f4c0e888b1cea21d563b0dd1f0ba31c86/source/thirdparty/nanogui-sdl/nanogui-sdl/resources/screenshot1.png -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/colorpicker.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdlgui/colorpicker.h -- push button with a popup to tweak a color value 3 | 4 | This widget was contributed by Christian Schueller. 5 | 6 | Based on NanoGUI by Wenzel Jakob . 7 | Adaptation for SDL by Dalerank 8 | 9 | All rights reserved. Use of this source code is governed by a 10 | BSD-style license that can be found in the LICENSE.txt file. 11 | */ 12 | 13 | #pragma once 14 | 15 | #include 16 | 17 | NAMESPACE_BEGIN(sdlgui) 18 | 19 | class ColorWheel; 20 | 21 | class ColorPicker : public PopupButton 22 | { 23 | public: 24 | ColorPicker(Widget *parent, const Color& color = { 1.f, 0.f, 0.f, 1.f }); 25 | 26 | /// Set the change callback 27 | std::function callback() const { return mCallback; } 28 | void setCallback(const std::function &callback) { mCallback = callback; } 29 | 30 | /// Get the current color 31 | Color color() const; 32 | /// Set the current color 33 | void setColor(const Color& color); 34 | 35 | protected: 36 | std::function mCallback; 37 | ColorWheel *mColorWheel; 38 | Button *mPickButton; 39 | }; 40 | 41 | NAMESPACE_END(sdlgui) 42 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/colorwheel.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdl_gui/colorwheel.h -- fancy analog widget to select a color value 3 | 4 | This widget was contributed by Dmitriy Morozov. 5 | 6 | Based on NanoGUI by Wenzel Jakob . 7 | Adaptation for SDL by Dalerank 8 | 9 | All rights reserved. Use of this source code is governed by a 10 | BSD-style license that can be found in the LICENSE.txt file. 11 | */ 12 | 13 | #pragma once 14 | 15 | #include 16 | 17 | NAMESPACE_BEGIN(sdlgui) 18 | 19 | class ColorWheel : public Widget 20 | { 21 | public: 22 | ColorWheel(Widget *parent, const Color& color = { 1.f, 0.f, 0.f, 1.f }); 23 | 24 | /// Set the change callback 25 | std::function callback() const { return mCallback; } 26 | void setCallback(const std::function &callback) { mCallback = callback; } 27 | 28 | /// Get the current color 29 | Color color() const; 30 | /// Set the current color 31 | void setColor(const Color& color); 32 | 33 | Vector2i preferredSize(SDL_Renderer *ctx) const override; 34 | void draw(SDL_Renderer *renderer) override; 35 | bool mouseButtonEvent(const Vector2i &p, int button, bool down, int modifiers); 36 | bool mouseDragEvent(const Vector2i &p, const Vector2i &rel, int button, int modifiers); 37 | 38 | private: 39 | enum Region { 40 | None = 0, 41 | InnerTriangle = 1, 42 | OuterCircle = 2, 43 | Both = 3 44 | }; 45 | 46 | Color hue2rgb(float h) const; 47 | Region adjustPosition(const Vector2i &p, Region consideredRegions = Both); 48 | 49 | protected: 50 | float mHue; 51 | float mWhite; 52 | float mBlack; 53 | Region mDragRegion; 54 | std::function mCallback; 55 | }; 56 | 57 | NAMESPACE_END(sdlgui) 58 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/darwin.mm: -------------------------------------------------------------------------------- 1 | #include 2 | #import 3 | 4 | NAMESPACE_BEGIN(nanogui) 5 | 6 | std::string file_dialog(const std::vector> &filetypes, bool save) { 7 | std::string path = ""; 8 | if (save) { 9 | NSSavePanel *saveDlg = [[NSSavePanel savePanel] retain]; 10 | 11 | NSMutableArray *types = [NSMutableArray new]; 12 | for (size_t idx = 0; idx < filetypes.size(); ++idx) 13 | [types addObject: [NSString stringWithUTF8String: filetypes[idx].first.c_str()]]; 14 | 15 | [saveDlg setAllowedFileTypes: types]; 16 | 17 | if ([saveDlg runModal] == NSModalResponseOK) 18 | path = [[[saveDlg URL] path] UTF8String]; 19 | } else { 20 | NSOpenPanel *openDlg = [[NSOpenPanel openPanel] retain]; 21 | 22 | [openDlg setCanChooseFiles:YES]; 23 | [openDlg setCanChooseDirectories:NO]; 24 | [openDlg setAllowsMultipleSelection:NO]; 25 | NSMutableArray *types = [NSMutableArray new]; 26 | for (size_t idx = 0; idx < filetypes.size(); ++idx) 27 | [types addObject: [NSString stringWithUTF8String: filetypes[idx].first.c_str()]]; 28 | 29 | [openDlg setAllowedFileTypes: types]; 30 | 31 | if ([openDlg runModal] == NSModalResponseOK) { 32 | for (NSURL* url in [openDlg URLs]) { 33 | path = std::string((char*) [[url path] UTF8String]); 34 | break; 35 | } 36 | } 37 | } 38 | return path; 39 | } 40 | 41 | void chdir_to_bundle_parent() { 42 | NSString *path = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent]; 43 | chdir([path fileSystemRepresentation]); 44 | } 45 | 46 | NAMESPACE_END(nanogui) 47 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/imagepanel.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdl_gui/imagepanel.h -- Image panel widget which shows a number of 3 | square-shaped icons 4 | 5 | Based on NanoGUI by Wenzel Jakob . 6 | Adaptation for SDL by Dalerank 7 | 8 | All rights reserved. Use of this source code is governed by a 9 | BSD-style license that can be found in the LICENSE.txt file. 10 | */ 11 | /** \file */ 12 | 13 | #pragma once 14 | 15 | #include 16 | 17 | NAMESPACE_BEGIN(sdlgui) 18 | 19 | /** 20 | * \class ImagePanel imagepanel.h sdl_gui/imagepanel.h 21 | * 22 | * \brief Image panel widget which shows a number of square-shaped icons. 23 | */ 24 | class ImagePanel : public Widget 25 | { 26 | public: 27 | ImagePanel(Widget *parent); 28 | ImagePanel(Widget *parent, const ListImages &data) 29 | : ImagePanel(parent) { setImages(data); } 30 | 31 | void setImages(const ListImages &data) { mImages = data; } 32 | const ListImages& images() const { return mImages; } 33 | 34 | std::function callback() const { return mCallback; } 35 | void setCallback(const std::function &callback) { mCallback = callback; } 36 | 37 | bool mouseMotionEvent(const Vector2i &p, const Vector2i &rel, int button, int modifiers) override; 38 | bool mouseButtonEvent(const Vector2i &p, int button, bool down, int modifiers) override; 39 | Vector2i preferredSize(SDL_Renderer *ctx) const override; 40 | void draw(SDL_Renderer* renderer) override; 41 | 42 | ImagePanel& withImages(const ListImages& data ) { setImages(data); return *this; } 43 | protected: 44 | Vector2i gridSize() const; 45 | int indexForPosition(const Vector2i &p) const; 46 | protected: 47 | ListImages mImages; 48 | std::function mCallback; 49 | int mThumbSize; 50 | int mSpacing; 51 | int mMargin; 52 | int mMouseIndex; 53 | }; 54 | 55 | NAMESPACE_END(sdlgui) 56 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/loadimages.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if defined(_WIN32) 4 | #include 5 | #else 6 | #include 7 | #endif 8 | #if defined(_WIN32) 9 | #include 10 | #else 11 | #include 12 | #endif 13 | 14 | #if defined(_WIN32) 15 | #include 16 | #else 17 | #include 18 | #endif 19 | 20 | NAMESPACE_BEGIN(sdlgui) 21 | 22 | ListImages loadImageDirectory(SDL_Renderer* renderer, const std::string &path) 23 | { 24 | ListImages result; 25 | #if !defined(_WIN32) 26 | DIR *dp = opendir(path.c_str()); 27 | if (!dp) 28 | throw std::runtime_error("Could not open image directory!"); 29 | struct dirent *ep; 30 | while ((ep = readdir(dp))) { 31 | const char *fname = ep->d_name; 32 | #else 33 | WIN32_FIND_DATA ffd; 34 | std::string searchPath = path + "/*.*"; 35 | HANDLE handle = FindFirstFileA(searchPath.c_str(), &ffd); 36 | if (handle == INVALID_HANDLE_VALUE) 37 | throw std::runtime_error("Could not open image directory!"); 38 | do { 39 | const char *fname = ffd.cFileName; 40 | #endif 41 | if (strstr(fname, "png") == nullptr) 42 | continue; 43 | std::string fullName = path + "/" + std::string(fname); 44 | SDL_Texture* tex = IMG_LoadTexture(renderer, fullName.c_str()); 45 | if (tex == 0) 46 | throw std::runtime_error("Could not open image data!"); 47 | ImageInfo iminfo; 48 | iminfo.tex = tex; 49 | iminfo.path = fullName; 50 | SDL_QueryTexture(tex, nullptr, nullptr, &iminfo.w, &iminfo.h); 51 | 52 | result.push_back(iminfo); 53 | #if !defined(_WIN32) 54 | } 55 | closedir(dp); 56 | #else 57 | } while (FindNextFileA(handle, &ffd) != 0); 58 | FindClose(handle); 59 | #endif 60 | return result; 61 | } 62 | 63 | NAMESPACE_END(sdlgui) -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/popupbutton.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdl_gui/popupbutton.h -- Button which launches a popup widget 3 | 4 | Based on NanoGUI by Wenzel Jakob . 5 | Adaptation for SDL by Dalerank 6 | 7 | All rights reserved. Use of this source code is governed by a 8 | BSD-style license that can be found in the LICENSE.txt file. 9 | */ 10 | /** \file */ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | NAMESPACE_BEGIN(sdlgui) 19 | 20 | /** 21 | * \class PopupButton popupbutton.h sdl_gui/popupbutton.h 22 | * 23 | * \brief Button which launches a popup widget. 24 | */ 25 | class PopupButton : public Button 26 | { 27 | public: 28 | PopupButton(Widget *parent, const std::string &caption = "Untitled", 29 | int buttonIcon = 0, 30 | int chevronIcon = ENTYPO_ICON_CHEVRON_SMALL_RIGHT); 31 | 32 | void setChevronIcon(int icon) { mChevronIcon = icon; } 33 | int chevronIcon() const { return mChevronIcon; } 34 | 35 | Popup& popup(const Vector2i& size) { mPopup->setFixedSize(size); return *mPopup; } 36 | Popup& popup() { return *mPopup; } 37 | Popup* popupptr() { return mPopup; } 38 | 39 | void draw(SDL_Renderer* renderer) override; 40 | Vector2i preferredSize(SDL_Renderer *ctx) const override; 41 | void performLayout(SDL_Renderer *ctx) override; 42 | 43 | PopupButton& withChevron(int icon) { setChevronIcon(icon); return *this; } 44 | protected: 45 | 46 | Popup *mPopup = nullptr; 47 | int mChevronIcon; 48 | 49 | Texture _chevronTex; 50 | }; 51 | 52 | NAMESPACE_END(sdlgui) 53 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/progressbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdl_gui/progressbar.h -- Standard widget for visualizing progress 3 | 4 | Based on NanoGUI by Wenzel Jakob . 5 | Adaptation for SDL by Dalerank 6 | 7 | All rights reserved. Use of this source code is governed by a 8 | BSD-style license that can be found in the LICENSE.txt file. 9 | */ 10 | /** \file */ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | NAMESPACE_BEGIN(sdlgui) 18 | 19 | /** 20 | * \class ProgressBar progressbar.h sdl_gui/progressbar.h 21 | * 22 | * \brief Standard widget for visualizing progress. 23 | */ 24 | class ProgressBar : public Widget 25 | { 26 | public: 27 | ProgressBar(Widget *parent); 28 | 29 | float value() { return mValue; } 30 | void setValue(float value); 31 | 32 | Vector2i preferredSize(SDL_Renderer *ctx) const override; 33 | void draw(SDL_Renderer* renderer) override; 34 | void drawBody(SDL_Renderer* renderer); 35 | void drawBar(SDL_Renderer* renderer); 36 | 37 | protected: 38 | float mValue; 39 | 40 | struct AsyncTexture; 41 | typedef std::shared_ptr AsyncTexturePtr; 42 | AsyncTexturePtr _body; 43 | AsyncTexturePtr _bar; 44 | }; 45 | 46 | NAMESPACE_END(sdlgui) 47 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/resources.h: -------------------------------------------------------------------------------- 1 | /* Autogenerated by bin2c */ 2 | 3 | #pragma once 4 | #include 5 | 6 | extern uint8_t roboto_bold_ttf[]; 7 | extern uint32_t roboto_bold_ttf_size; 8 | 9 | extern uint8_t roboto_regular_ttf[]; 10 | extern uint32_t roboto_regular_ttf_size; 11 | 12 | extern uint8_t entypo_ttf[]; 13 | extern uint32_t entypo_ttf_size; 14 | 15 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/sdlguii.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdl_gui/nanogui.h -- Pull in *everything* from NanoGUI 3 | 4 | Based on NanoGUI by Wenzel Jakob . 5 | Adaptation for SDL by Dalerank 6 | 7 | All rights reserved. Use of this source code is governed by a 8 | BSD-style license that can be found in the LICENSE.txt file. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/stackedwidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | sdlgui/stackedwidget.cpp -- Widget used to stack widgets on top 3 | of each other. Only the active widget is visible. 4 | 5 | The stacked widget was contributed by Stefan Ivanov. 6 | 7 | Based on NanoGUI by Wenzel Jakob . 8 | Adaptation for SDL by Dalerank 9 | 10 | All rights reserved. Use of this source code is governed by a 11 | BSD-style license that can be found in the LICENSE.txt file. 12 | */ 13 | 14 | #include 15 | 16 | NAMESPACE_BEGIN(sdlgui) 17 | 18 | StackedWidget::StackedWidget(Widget *parent) 19 | : Widget(parent) { } 20 | 21 | void StackedWidget::setSelectedIndex(int index) 22 | { 23 | assert(index < childCount()); 24 | if (mSelectedIndex >= 0) 25 | mChildren[mSelectedIndex]->setVisible(false); 26 | mSelectedIndex = index; 27 | mChildren[mSelectedIndex]->setVisible(true); 28 | } 29 | 30 | int StackedWidget::selectedIndex() const { 31 | return mSelectedIndex; 32 | } 33 | 34 | void StackedWidget::performLayout(SDL_Renderer *ctx) { 35 | for (auto child : mChildren) { 36 | child->setPosition({ 0, 0 }); 37 | child->setSize(mSize); 38 | child->performLayout(ctx); 39 | } 40 | } 41 | 42 | Vector2i StackedWidget::preferredSize(SDL_Renderer *ctx) const 43 | { 44 | Vector2i size{ 0, 0 }; 45 | for (auto child : mChildren) 46 | size = size.cmax(child->preferredSize(ctx)); 47 | return size; 48 | } 49 | 50 | void StackedWidget::addChild(int index, Widget *widget) { 51 | if (mSelectedIndex >= 0) 52 | mChildren[mSelectedIndex]->setVisible(false); 53 | Widget::addChild(index, widget); 54 | widget->setVisible(true); 55 | setSelectedIndex(index); 56 | } 57 | 58 | NAMESPACE_END(sdlgui) 59 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/stackedwidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdl_gui/stackedwidget.h -- Widget used to stack widgets on top 3 | of each other. Only the active widget is visible. 4 | 5 | The stacked widget was contributed by Stefan Ivanov. 6 | 7 | Based on NanoGUI by Wenzel Jakob . 8 | Adaptation for SDL by Dalerank 9 | 10 | 11 | All rights reserved. Use of this source code is governed by a 12 | BSD-style license that can be found in the LICENSE.txt file. 13 | */ 14 | /** \file */ 15 | 16 | #pragma once 17 | 18 | #include 19 | 20 | NAMESPACE_BEGIN(sdlgui) 21 | 22 | /** 23 | * \class StackedWidget stackedwidget.h sdl_gui/stackedwidget.h 24 | * 25 | * \brief A stack widget. 26 | */ 27 | class StackedWidget : public Widget 28 | { 29 | public: 30 | StackedWidget(Widget* parent); 31 | 32 | void setSelectedIndex(int index); 33 | int selectedIndex() const; 34 | 35 | void performLayout(SDL_Renderer* ctx) override; 36 | Vector2i preferredSize(SDL_Renderer* ctx) const override; 37 | void addChild(int index, Widget* widget) override; 38 | 39 | private: 40 | int mSelectedIndex = -1; 41 | }; 42 | 43 | NAMESPACE_END(sdlgui) 44 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/textureview.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | sdlgui/textureview.cpp -- SDL_Texture view 3 | 4 | The texture view widget was contributed by Armin Schlegel 5 | 6 | Based on NanoGUI by Wenzel Jakob . 7 | Adaptation for SDL by Dalerank 8 | 9 | All rights reserved. Use of this source code is governed by a 10 | BSD-style license that can be found in the LICENSE.txt file. 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | NAMESPACE_BEGIN(sdlgui) 17 | 18 | TextureView::TextureView(Widget* parent, SDL_Texture* texture) 19 | : Widget(parent) 20 | , mTexture(texture) 21 | { 22 | } 23 | 24 | Vector2i TextureView::preferredSize(SDL_Renderer* ctx) const 25 | { 26 | int w, h; 27 | SDL_QueryTexture(mTexture, nullptr, nullptr, &w, &h); 28 | return Vector2i(w, h); 29 | } 30 | 31 | void TextureView::draw(SDL_Renderer* renderer) 32 | { 33 | Widget::draw(renderer); 34 | SDL_Point ap = getAbsolutePos(); 35 | int w, h; 36 | SDL_QueryTexture(mTexture, nullptr, nullptr, &w, &h); 37 | auto mImageSize = Vector2i(w, h); 38 | 39 | int x, y; 40 | auto pos = absolutePosition(); 41 | x = pos[0]; 42 | y = pos[1]; 43 | SDL_Rect rect{x, y, w, h}; 44 | 45 | SDL_RenderCopy(renderer, mTexture, NULL, &rect); 46 | } 47 | 48 | NAMESPACE_END(sdlgui) 49 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/textureview.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdl_gui/textureview.h -- Texture view 3 | The texture view widget was contributed by Armin Schlegel 4 | 5 | Based on NanoGUI by Wenzel Jakob . 6 | Adaptation for SDL by Dalerank 7 | 8 | All rights reserved. Use of this source code is governed by a 9 | BSD-style license that can be found in the LICENSE.txt file. 10 | */ 11 | /** \file */ 12 | 13 | #pragma once 14 | 15 | #include 16 | 17 | NAMESPACE_BEGIN(sdlgui) 18 | 19 | /** 20 | * \class TextureView textureview.h sdl_gui/textureview.h 21 | * 22 | * \brief Texture view widget. 23 | * 24 | * Lets display view an SDL_Texture. 25 | */ 26 | class TextureView : public Widget 27 | { 28 | public: 29 | TextureView(Widget* parent, SDL_Texture* texture); 30 | 31 | SDL_Texture* texture() const 32 | { 33 | return mTexture; 34 | } 35 | /// Set the primary SDL_Texture 36 | void setTexture(SDL_Texture* texture) 37 | { 38 | mTexture = texture; 39 | } 40 | 41 | /// Compute the size needed to fully display the texture view 42 | virtual Vector2i preferredSize(SDL_Renderer* ctx) const override; 43 | 44 | /// Draw the texture view 45 | void draw(SDL_Renderer* renderer) override; 46 | 47 | protected: 48 | SDL_Texture* mTexture; 49 | }; 50 | 51 | NAMESPACE_END(sdlgui) 52 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/toolbutton.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdlgui/toolbutton.h -- Simple radio+toggle button with an icon 3 | 4 | Based on NanoGUI by Wenzel Jakob . 5 | Adaptation for SDL by Dalerank 6 | 7 | All rights reserved. Use of this source code is governed by a 8 | BSD-style license that can be found in the LICENSE.txt file. 9 | */ 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | NAMESPACE_BEGIN(sdlgui) 16 | 17 | class ToolButton : public Button 18 | { 19 | public: 20 | ToolButton(Widget *parent, int icon, 21 | const std::string &caption = "") 22 | : Button(parent, caption, icon) 23 | { 24 | setFlags(Flags::RadioButton | Flags::ToggleButton); 25 | setFixedSize(Vector2i(25, 25)); 26 | } 27 | }; 28 | 29 | NAMESPACE_END(sdlgui) 30 | -------------------------------------------------------------------------------- /source/thirdparty/nanogui-sdl/nanogui-sdl/sdlgui/vscrollpanel.h: -------------------------------------------------------------------------------- 1 | /* 2 | sdl_gui/vscrollpanel.h -- Adds a vertical scrollbar around a widget 3 | that is too big to fit into a certain area 4 | 5 | Based on NanoGUI by Wenzel Jakob . 6 | Adaptation for SDL by Dalerank 7 | 8 | All rights reserved. Use of this source code is governed by a 9 | BSD-style license that can be found in the LICENSE.txt file. 10 | */ 11 | /** \file */ 12 | 13 | #pragma once 14 | 15 | #include 16 | 17 | NAMESPACE_BEGIN(sdlgui) 18 | 19 | /** 20 | * \class VScrollPanel vscrollpanel.h sdl_gui/vscrollpanel.h 21 | * 22 | * \brief Adds a vertical scrollbar around a widget that is too big to fit into 23 | * a certain area. 24 | */ 25 | class VScrollPanel : public Widget 26 | { 27 | public: 28 | VScrollPanel(Widget* parent); 29 | 30 | void performLayout(SDL_Renderer* ctx) override; 31 | Vector2i preferredSize(SDL_Renderer* ctx) const override; 32 | bool mouseDragEvent(const Vector2i& p, const Vector2i& rel, int button, int modifiers) override; 33 | bool scrollEvent(const Vector2i& p, const Vector2f& rel) override; 34 | bool mouseButtonEvent(const Vector2i& p, int button, bool down, int modifiers) override; 35 | bool mouseMotionEvent(const Vector2i& p, const Vector2i& rel, int button, int modifiers) override; 36 | void draw(SDL_Renderer* render) override; 37 | 38 | float scroll(); 39 | float scrollAmount(); 40 | void setScrollAmount(float pixels); 41 | 42 | SDL_Point getAbsolutePos() const override; 43 | PntRect getAbsoluteCliprect() const override; 44 | int getAbsoluteTop() const override; 45 | 46 | protected: 47 | int mChildPreferredHeight; 48 | float mScroll; 49 | int mDOffset = 0; 50 | float mScrollAmount; 51 | // std::string mType; 52 | }; 53 | 54 | NAMESPACE_END(sdlgui) 55 | -------------------------------------------------------------------------------- /source/version.h.in: -------------------------------------------------------------------------------- 1 | 2 | #define @META_PROJECT_ID@_PROJECT_NAME "@META_PROJECT_NAME@" 3 | #define @META_PROJECT_ID@_PROJECT_DESCRIPTION "@META_PROJECT_DESCRIPTION@" 4 | 5 | #define @META_PROJECT_ID@_AUTHOR_ORGANIZATION "@META_AUTHOR_ORGANIZATION@" 6 | #define @META_PROJECT_ID@_AUTHOR_DOMAIN "@META_AUTHOR_DOMAIN@" 7 | #define @META_PROJECT_ID@_AUTHOR_MAINTAINER "@META_AUTHOR_MAINTAINER@" 8 | 9 | #define @META_PROJECT_ID@_VERSION_MAJOR "@META_VERSION_MAJOR@" 10 | #define @META_PROJECT_ID@_VERSION_MINOR "@META_VERSION_MINOR@" 11 | #define @META_PROJECT_ID@_VERSION_PATCH "@META_VERSION_PATCH@" 12 | #define @META_PROJECT_ID@_VERSION_REVISION "@META_VERSION_REVISION@" 13 | 14 | #define @META_PROJECT_ID@_VERSION "@META_VERSION@" 15 | #define @META_PROJECT_ID@_NAME_VERSION "@META_NAME_VERSION@" 16 | --------------------------------------------------------------------------------