From c88fa0617b9591819988d71fcaff1972bf511089 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Fri, 13 Sep 2024 18:05:15 +0200 Subject: [PATCH] Initial commit --- .gitignore | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 35 +++++++++++++++++++++++++++ LICENSE | 9 +++++++ ProtoTank.cpp | 30 +++++++++++++++++++++++ README.md | 3 +++ conanfile.py | 55 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 197 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 ProtoTank.cpp create mode 100644 README.md create mode 100644 conanfile.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6c05cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,65 @@ +# ---> C++ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# ---> CMake +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +# ---> VisualStudioCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets +.cmake/ +.vsconan/ + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +build/ +CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6ae57b9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,35 @@ +# CMakeLists.txt + +# Written by JackCarterSmith, 2024 +# This file is released under the ProtoTank license. + +cmake_minimum_required(VERSION 3.23) +cmake_policy(VERSION 3.23) + +# define project +project(ProtoTank VERSION 0.1.0 DESCRIPTION "Arcade 80s-style game with tanks" LANGUAGES C;CXX) +#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY) + +include(FindPkgConfig) +include(CheckIncludeFile) +include(CheckCSourceCompiles) + +# Find libraries +find_package(SFML REQUIRED) +include_directories(sfml::sfml) + +# define src/headers files +FILE(GLOB AST_SCRS ./*.cpp) +FILE(GLOB AST_HRDS ./*.h) +SOURCE_GROUP("Source Files" FILES ${AST_SCRS}) +SOURCE_GROUP("Header Files" FILES ${AST_HRDS}) + +# targets declarations +add_executable(${PROJECT_NAME} ${AST_SCRS} ${AST_HRDS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}-v${PROJECT_VERSION}) +if(MSVC) + # msvc does not append 'lib' - do it here to have consistent name + set_target_properties(AST PROPERTIES IMPORT_PREFIX "lib") +endif() +target_link_libraries(${PROJECT_NAME} sfml::sfml) \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ab5b969 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2024 JCS-Prod + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/ProtoTank.cpp b/ProtoTank.cpp new file mode 100644 index 0000000..a3c3a01 --- /dev/null +++ b/ProtoTank.cpp @@ -0,0 +1,30 @@ +#include +#include + +#include + +#ifdef __AVX2__ +#endif + + +int main(int argc, char** argv) { + sf::RenderWindow window(sf::VideoMode(480, 240), "ProtoTank"); + sf::CircleShape shape(100.f); + shape.setFillColor(sf::Color::Green); + + while (window.isOpen()) + { + sf::Event event; + while (window.pollEvent(event)) + { + if (event.type == sf::Event::Closed) + window.close(); + } + + window.clear(); + window.draw(shape); + window.display(); + } + + return EXIT_SUCCESS; +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..1a8dc88 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ProtoTank + +A quick concept of a 80s arcade game with tanks \ No newline at end of file diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..aaf29aa --- /dev/null +++ b/conanfile.py @@ -0,0 +1,55 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain#,cmake_layout +from conan.tools.files import copy + +required_conan_version = ">=1.59" + +class ProtoTank(ConanFile): + name = "ProtoTank" + version = "0.1" + description = """Demo/PoC project + Arcade 80s-style game with tanks""" + license = "MIT" + author = "JackCarterSmith (j@jcsmith.fr)" + url = "https://git.jcsmith.fr/JCS-Prod/ProtoTank" + + package_type = "application" + revision_mode = "scm" + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps" + + + def configure(self): + self.options["sfml"].audio = True + self.options["sfml"].window = True + self.options["sfml"].network = False + self.options["sfml"].graphics = True + + if self.settings.os == "Linux": + self.options["sfml"].shared = False + self.options["sfml"].fPIC = True + + if self.settings.os == "Windows": + self.options["sfml"].shared = True + + def requirements(self): + self.requires("sfml/2.6.1") + +# def layout(self): +# cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + #tc.user_presets_path = False + tc.generate() + for dep in self.dependencies.values(): + if self.settings.os == "Windows" and len(dep.cpp_info.bindirs) > 0: + copy(self, "*.dll", dep.cpp_info.bindirs[0], self.build_folder) + +# def package(self): +# copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) +# copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) +# copy(self, pattern="*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) +# copy(self, pattern="*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) +# copy(self, pattern="*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) +# copy(self, pattern="*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False)