checkin everything to test build on windows

This commit is contained in:
Sarah Faey 2025-03-28 18:13:23 +01:00
parent 875b0b2f88
commit b1f5d882f0
16 changed files with 250 additions and 0 deletions

1
.gitignore vendored
View file

@ -80,6 +80,7 @@ x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
build/
[Bb]in/
[Oo]bj/
[Ll]og/

50
CMakeLists.txt Normal file
View file

@ -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()

8
main.cpp Normal file
View file

@ -0,0 +1,8 @@
#include <iostream>
#include "src/Game.h"
int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl;
Game * game = new Game();
delete game;
}

19
src/Actors/Actor.cpp Normal file
View file

@ -0,0 +1,19 @@
// SPDX-FileCopyrightText: 2025 <copyright holder> <email>
// SPDX-License-Identifier: MIT
#include "Actor.h"
Actor::Actor()
{
}
Actor::Actor(const Actor& other)
{
}
Actor::~Actor()
{
}

32
src/Actors/Actor.h Normal file
View file

@ -0,0 +1,32 @@
// SPDX-FileCopyrightText: 2025 <copyright holder> <email>
// 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

View file

@ -0,0 +1,8 @@
#ifndef OBJECT_POOL_H
#define OBJECT_POOL_H
#endif

22
src/Game.cpp Normal file
View file

@ -0,0 +1,22 @@
// SPDX-FileCopyrightText: 2025 <copyright holder> <email>
// SPDX-License-Identifier: MIT
#include "Game.h"
#include <SDL3/SDL_assert.h>
#include <SDL3/SDL_log.h>
#include <iostream>
Game::Game()
{
SDL_assert(1< 0);
int i = 7;
i++;
//std::cout << i << std::endl;
}
Game::~Game()
{
}

26
src/Game.h Normal file
View file

@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: 2025 <copyright holder> <email>
// SPDX-License-Identifier: MIT
#ifndef GAME_H
#define GAME_H
/**
* @todo write docs
*/
class Game
{
public:
/**
* Default constructor
*/
Game();
/**
* Destructor
*/
~Game();
};
#endif // GAME_H

0
src/World/Tile.cpp Normal file
View file

19
src/World/Tile.h Normal file
View file

@ -0,0 +1,19 @@
#ifndef TILE_H
#define TILE_H
#include <cstdint>
#include <SDL3/SDL.h>
class Tile
{
public:
private:
int8_t tile_id_;
SDL_Texture* texture;
SDL_FRect tile_position;
int i = SDL_RenderTexture()
};
#endif

0
src/World/map.cpp Normal file
View file

23
src/World/map.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef MAP_H
#define MAP_H
#include <cstdint>
#include <array>
#include <vector>
#include "Tile.h"
class Map
{
public:
private:
int16_t size_x_;
int16_t size_y_;
int8_t* terrain_map_;
Tile* tile_map_;
std::vector<int16_t> static_objects_;
};
#endif

0
src/World/map_file.cpp Normal file
View file

30
src/World/map_file.h Normal file
View file

@ -0,0 +1,30 @@
#ifndef MAP_FILE_H
#define MAP_FILE_H
#include <vector>
#include <string>
#include <map>
struct TileMapFile
{
std::string file_name;
std::string material1;
std::string material2;
};
class MapFile
{
public:
private:
std::vector<TileMapFile> file_map_;
std::map<int8_t, std::string> material_map_;
int16_t size_x_;
int16_t size_y_;
int8_t * map_;
};
#endif

0
src/World/terain.cpp Normal file
View file

12
src/World/terain.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef TERAIN_H
#define TERAIN_H
class Terain
{
public:
private:
};
#endif