diff --git a/.gitignore b/.gitignore index 26913a1..1fe0567 100644 --- a/.gitignore +++ b/.gitignore @@ -80,6 +80,7 @@ x86/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ +build/ [Bb]in/ [Oo]bj/ [Ll]og/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1b44570 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,50 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 3.24) + +# Set the project name +project(Witch-Game) + + +#find_package(SDL3 REQUIRED) +#find_package(SDL3_image REQUIRED) + +#download SDL if not installed +#use git ls-remote --tags https://github.com/libsdl-org/SDL.git | tail -n 1 +#to get the newest git-tag +include(FetchContent) +FetchContent_Declare( + SDL3 + GIT_REPOSITORY https://github.com/libsdl-org/SDL.git + GIT_TAG f6864924f76e1a0b4abaefc76ae2ed22b1a8916e # release-3.2.8 + FIND_PACKAGE_ARGS NAMES SDL3 +) +FetchContent_Declare( + SDL3_image + GIT_REPOSITORY https://github.com/libsdl-org/SDL_image.git + GIT_TAG 11154afb7855293159588b245b446a4ef09e574f # release-3.2.4 + FIND_PACKAGE_ARGS NAMES SDL3_image +) +FetchContent_Declare( + SDL3_ttf + GIT_REPOSITORY https://github.com/libsdl-org/SDL_ttf.git + GIT_TAG 3675de381020a719c37f7c79f6564cf52c8f4dcc # release-3.2.0 + FIND_PACKAGE_ARGS NAMES SDL3_ttf +) +FetchContent_MakeAvailable(SDL3 SDL3_image SDL3_ttf) + +#list all files in Actors folder +set(ACTORS src/Actors/Actor.cpp) + +add_executable(Witch-Game main.cpp src/Game.cpp ${ACTORS}) + +target_compile_features(Witch-Game PRIVATE cxx_std_17) +target_link_libraries(Witch-Game SDL3 SDL3_image SDL3_ttf) + +#set compiler flags for warnings +if(MSVC) + target_compile_options(Witch-Game PRIVATE /W4 /WX) +else() + target_compile_options(Witch-Game PRIVATE -Wall -Wextra -Wpedantic) +endif() diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..1b14a4b --- /dev/null +++ b/main.cpp @@ -0,0 +1,8 @@ +#include +#include "src/Game.h" + +int main(int argc, char **argv) { + std::cout << "Hello, world!" << std::endl; + Game * game = new Game(); + delete game; +} diff --git a/src/Actors/Actor.cpp b/src/Actors/Actor.cpp new file mode 100644 index 0000000..62e0ecf --- /dev/null +++ b/src/Actors/Actor.cpp @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2025 +// SPDX-License-Identifier: MIT + +#include "Actor.h" + +Actor::Actor() +{ + +} + +Actor::Actor(const Actor& other) +{ + +} + +Actor::~Actor() +{ + +} diff --git a/src/Actors/Actor.h b/src/Actors/Actor.h new file mode 100644 index 0000000..4b45627 --- /dev/null +++ b/src/Actors/Actor.h @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2025 +// SPDX-License-Identifier: MIT + +#ifndef ACTOR_H +#define ACTOR_H + +/** + * @todo write docs + */ +class Actor +{ +public: + /** + * Default constructor + */ + Actor(); + + /** + * Copy constructor + * + * @param other TODO + */ + Actor(const Actor& other); + + /** + * Destructor + */ + ~Actor(); + +}; + +#endif // ACTOR_H diff --git a/src/DataStructures/ObjectPool.h b/src/DataStructures/ObjectPool.h new file mode 100644 index 0000000..47862e7 --- /dev/null +++ b/src/DataStructures/ObjectPool.h @@ -0,0 +1,8 @@ +#ifndef OBJECT_POOL_H +#define OBJECT_POOL_H + + + + + +#endif \ No newline at end of file diff --git a/src/Game.cpp b/src/Game.cpp new file mode 100644 index 0000000..4b91356 --- /dev/null +++ b/src/Game.cpp @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: 2025 +// SPDX-License-Identifier: MIT + +#include "Game.h" +#include +#include +#include + +Game::Game() +{ + SDL_assert(1< 0); + + int i = 7; + i++; + //std::cout << i << std::endl; +} + +Game::~Game() +{ + +} + diff --git a/src/Game.h b/src/Game.h new file mode 100644 index 0000000..222f0e1 --- /dev/null +++ b/src/Game.h @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2025 +// SPDX-License-Identifier: MIT + +#ifndef GAME_H +#define GAME_H + +/** + * @todo write docs + */ +class Game +{ +public: + /** + * Default constructor + */ + Game(); + + /** + * Destructor + */ + ~Game(); + +}; + +#endif // GAME_H + diff --git a/src/World/Tile.cpp b/src/World/Tile.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/World/Tile.h b/src/World/Tile.h new file mode 100644 index 0000000..c7ca2aa --- /dev/null +++ b/src/World/Tile.h @@ -0,0 +1,19 @@ +#ifndef TILE_H +#define TILE_H + +#include +#include + +class Tile +{ +public: + +private: + int8_t tile_id_; + SDL_Texture* texture; + SDL_FRect tile_position; + int i = SDL_RenderTexture() + +}; + +#endif \ No newline at end of file diff --git a/src/World/map.cpp b/src/World/map.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/World/map.h b/src/World/map.h new file mode 100644 index 0000000..204949d --- /dev/null +++ b/src/World/map.h @@ -0,0 +1,23 @@ +#ifndef MAP_H +#define MAP_H + +#include +#include +#include +#include "Tile.h" + +class Map +{ +public: + +private: + int16_t size_x_; + int16_t size_y_; + + int8_t* terrain_map_; + Tile* tile_map_; + std::vector static_objects_; + +}; + +#endif \ No newline at end of file diff --git a/src/World/map_file.cpp b/src/World/map_file.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/World/map_file.h b/src/World/map_file.h new file mode 100644 index 0000000..546057a --- /dev/null +++ b/src/World/map_file.h @@ -0,0 +1,30 @@ +#ifndef MAP_FILE_H +#define MAP_FILE_H + +#include +#include +#include + +struct TileMapFile +{ + std::string file_name; + std::string material1; + std::string material2; +}; + +class MapFile +{ +public: + + +private: + std::vector file_map_; + std::map material_map_; + int16_t size_x_; + int16_t size_y_; + int8_t * map_; +}; + + + +#endif \ No newline at end of file diff --git a/src/World/terain.cpp b/src/World/terain.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/World/terain.h b/src/World/terain.h new file mode 100644 index 0000000..64aa340 --- /dev/null +++ b/src/World/terain.h @@ -0,0 +1,12 @@ +#ifndef TERAIN_H +#define TERAIN_H + +class Terain +{ +public: + +private: + +}; + +#endif \ No newline at end of file