diff --git a/2dgk_7/2dgk_7/2dgk_7.vcxproj b/2dgk_7/2dgk_7/2dgk_7.vcxproj index 42c98b0..4008330 100644 --- a/2dgk_7/2dgk_7/2dgk_7.vcxproj +++ b/2dgk_7/2dgk_7/2dgk_7.vcxproj @@ -175,6 +175,7 @@ + diff --git a/2dgk_7/2dgk_7/2dgk_7.vcxproj.filters b/2dgk_7/2dgk_7/2dgk_7.vcxproj.filters index f8aacd2..45c7dbb 100644 --- a/2dgk_7/2dgk_7/2dgk_7.vcxproj.filters +++ b/2dgk_7/2dgk_7/2dgk_7.vcxproj.filters @@ -86,5 +86,8 @@ Header Files + + Header Files + \ No newline at end of file diff --git a/2dgk_7/2dgk_7/KActionBind.h b/2dgk_7/2dgk_7/KActionBind.h index e3c1eab..a659e34 100644 --- a/2dgk_7/2dgk_7/KActionBind.h +++ b/2dgk_7/2dgk_7/KActionBind.h @@ -1,5 +1,5 @@ #pragma once -#include "Controllers.h" +#include "KPlayer.h" #include "KPlayerController.h" namespace KapitanGame { @@ -10,22 +10,22 @@ namespace KapitanGame { Hold }; struct KActionBind { - KActionBind(std::string name, const InputState expectedInputState, KPlayerController* controllerObject, const KPlayerCommand command, const Controllers controller) : - Name(std::move(name)), ExpectedInputState(expectedInputState), ControllerObject(controllerObject), Command(command), Controller(controller) {} + KActionBind(std::string name, const InputState expectedInputState, KPlayerController* controllerObject, const KPlayerCommand command, const KPlayer player) : + Name(std::move(name)), ExpectedInputState(expectedInputState), ControllerObject(controllerObject), Command(command), Player(player) {} std::string Name; InputState ExpectedInputState; KPlayerController* ControllerObject; KPlayerCommand Command; - Controllers Controller; + KPlayer Player; }; struct KAxisBind { - KAxisBind(std::string name, KPlayerController* controllerObject, const KPlayerAxisCommand command, const Controllers controller) : - Name(std::move(name)), ControllerObject(controllerObject), AxisCommand(command), Controller(controller) {} + KAxisBind(std::string name, KPlayerController* controllerObject, const KPlayerAxisCommand command, const KPlayer player) : + Name(std::move(name)), ControllerObject(controllerObject), AxisCommand(command), Player(player) {} std::string Name; KPlayerController* ControllerObject; KPlayerAxisCommand AxisCommand; - Controllers Controller; + KPlayer Player; }; } diff --git a/2dgk_7/2dgk_7/KGame.cpp b/2dgk_7/2dgk_7/KGame.cpp index eaa2587..0a737fa 100644 --- a/2dgk_7/2dgk_7/KGame.cpp +++ b/2dgk_7/2dgk_7/KGame.cpp @@ -1,5 +1,6 @@ #include "KGame.h" #include "SDL.h" +#include #include #include #include @@ -65,32 +66,53 @@ namespace KapitanGame { //Loading success flag bool success = true; - if (!PlayerTexture.LoadFromFile("textures/player.bmp", Renderer)) + if (!PlayerTexture.LoadFromFile("assets/textures/P1.bmp", Renderer)) { printf("Failed to load player texture image!\n"); success = false; } - if (!PlayerTexture2.LoadFromFile("textures/player2.bmp", Renderer)) + if (!PlayerTexture2.LoadFromFile("assets/textures/P2.bmp", Renderer)) { printf("Failed to load player texture image!\n"); success = false; } + if (!WallTexture.LoadFromFile("assets/textures/wall.bmp", Renderer)) + { + printf("Failed to load wall texture image!\n"); + success = false; + } + if (!ExitTexture.LoadFromFile("assets/textures/exit.bmp", Renderer)) + { + printf("Failed to load exit texture image!\n"); + success = false; + } - for (int i = static_cast(TileType::Default); i <= static_cast(TileType::Dot); ++i) - { - if (!TileTextures[i].LoadFromFile("textures/0" + std::to_string(i) + ".bmp", Renderer)) - { - printf("Failed to load 0%d texture image!\n", i); - success = false; + std::ifstream configFile("config.json"); + if (configFile.fail()) { + printf("Failed to load config.json!\n"); + success = false; + } + else { + nlohmann::json configJson; + configFile >> configJson; + configFile.close(); + for (auto& player : configJson["Input"].items()) { + const auto playerEnum = Utils::GetPlayerFromString(player.key()); + for (auto& axisMapping : player.value()["AxisMappings"]) { + Input.AddAxisMapping(axisMapping["AxisName"].get(), axisMapping["Scale"].get(), axisMapping["Key"].get(), playerEnum); + } + for (auto& actionMapping : player.value()["ActionMappings"]) { + Input.AddActionMapping(actionMapping["ActionName"].get(), actionMapping["Key"].get(), playerEnum); + } } } Tiles.clear(); std::ifstream levelFile; - levelFile.open("level.txt"); + levelFile.open("assets/level1.txt"); if (levelFile.fail()) { - printf("Failed to load level.txt!\n"); + printf("Failed to load assets/level1.txt!\n"); success = false; } else @@ -104,16 +126,11 @@ namespace KapitanGame { auto type = TileType::Default; switch (line[i]) { - case '|': - type = TileType::VerticalWall; + case '#': + type = TileType::Wall; break; - case '-': - type = TileType::HorizontalWall; - break; - case '.': - type = TileType::Dot; - break; - default:; + default: + continue; } Tiles.emplace_back(i * Constants::TILE_WIDTH, y * Constants::TILE_HEIGHT, type); } diff --git a/2dgk_7/2dgk_7/KInput.cpp b/2dgk_7/2dgk_7/KInput.cpp index a108905..14e0bde 100644 --- a/2dgk_7/2dgk_7/KInput.cpp +++ b/2dgk_7/2dgk_7/KInput.cpp @@ -2,6 +2,7 @@ #include "Constants.h" #include +#include namespace KapitanGame { KInput::KInput() : GamePadsCount(0), Initialized(false) @@ -77,6 +78,8 @@ namespace KapitanGame { int size = 0; const Uint8* currentKeyStates = SDL_GetKeyboardState(&size); KeyboardInputs = std::vector(currentKeyStates, currentKeyStates + size); + ProcessActions(); + ProcessAxes(); } void KInput::HandleEvent(const SDL_Event& event) { switch (event.type) { @@ -119,71 +122,115 @@ namespace KapitanGame { } } - void KInput::BindAction(const std::string& name, InputState expectedInputState, KPlayerController* controllerObject, - KPlayerCommand command, Controllers controller) { - Actions.emplace_back(name, expectedInputState, controllerObject, command, controller); + void KInput::BindAction(const std::string& name, InputState expectedInputState, + KPlayerController* controllerObject, + KPlayerCommand command, KPlayer player) { + Actions.emplace_back(name, expectedInputState, controllerObject, command, player); } - void KInput::BindAxis(const std::string& name, KPlayerController* controllerObject, KPlayerAxisCommand command, Controllers controller) + void KInput::BindAxis(const std::string& name, KPlayerController* controllerObject, KPlayerAxisCommand command, KPlayer player) { - Axes.emplace_back(name, controllerObject, command, controller); + Axes.emplace_back(name, controllerObject, command, player); } - bool KInput::CheckAction(const std::string& name, const InputState expectedInputState, Controllers controller) { - const auto keyBind = KeyBinds[static_cast(controller)].find(name); - const auto buttonBind = ButtonBinds[static_cast(controller)].find(name); - switch (expectedInputState) { - case InputState::Pressed: - if (keyBind != KeyBinds[static_cast(controller)].end()) { + bool KInput::CheckAction(const std::string& name, const InputState expectedInputState, KPlayer player) { + const auto keyBindRange = KeyBinds[static_cast(player)].equal_range(name); + for (auto keyBind = keyBindRange.first; keyBind != keyBindRange.second; ++keyBind) { + switch (expectedInputState) { + case InputState::Pressed: if (IsKeyboardButtonPressed(keyBind->second)) { return true; } - } - - if (buttonBind != ButtonBinds[static_cast(controller)].end()) { - if (IsControllerButtonPressed(controller, buttonBind->second)) { - return true; - } - } - return false; - case InputState::Released: - if (keyBind != KeyBinds[static_cast(controller)].end()) { + break; + case InputState::Released: if (IsKeyboardButtonReleased(keyBind->second)) { return true; } - } - - if (buttonBind != ButtonBinds[static_cast(controller)].end()) { - if (IsControllerButtonReleased(controller, buttonBind->second)) { - return true; - } - } - return false; - case InputState::Hold: - if (keyBind != KeyBinds[static_cast(controller)].end()) { + break; + case InputState::Hold: if (IsKeyboardButtonHeld(keyBind->second)) { return true; } + break; } + } - if (buttonBind != ButtonBinds[static_cast(controller)].end()) { - if (IsControllerButtonHeld(controller, buttonBind->second)) { + const auto buttonBindRange = ButtonBinds[static_cast(player)].equal_range(name); + for (auto buttonBind = buttonBindRange.first; buttonBind != buttonBindRange.second; ++buttonBind) { + switch (expectedInputState) { + case InputState::Pressed: + if (IsControllerButtonPressed(buttonBind->second.first, buttonBind->second.second)) { return true; } + break; + case InputState::Released: + if (IsControllerButtonReleased(buttonBind->second.first, buttonBind->second.second)) { + return true; + } + break; + case InputState::Hold: + if (IsControllerButtonHeld(buttonBind->second.first, buttonBind->second.second)) { + return true; + } + break; } - return false; } return false; } void KInput::ProcessActions() { - for (auto &action : Actions) { - if (CheckAction(action.Name, action.ExpectedInputState, action.Controller)) { + for (auto& action : Actions) { + if (CheckAction(action.Name, action.ExpectedInputState, action.Player)) { std::invoke(action.Command, action.ControllerObject); } } } + void KInput::ProcessAxes() + { + for (auto& axis : Axes) { + std::invoke(axis.AxisCommand, axis.ControllerObject, GetAxisValue(axis.Name, axis.Player)); + } + } + + void KInput::AddAxisMapping(const std::string& name, const float& scale, const std::string& key, const KPlayer& player) + { + if (key.rfind("Gamepad", 0) == 0) { + const auto delimiterPosition = key.find('_', 7); + const auto controllerIndex = static_cast(std::stoi(key.substr(7, delimiterPosition))); + auto axis = key.substr(delimiterPosition + 1); + std::for_each(axis.begin(), axis.end(), [](char& c) { + c = ::tolower(c); + }); + ControllerAxisBinds[static_cast(player)].emplace(name, KControllerAxisMapping(controllerIndex, SDL_GameControllerGetAxisFromString(axis.c_str()), scale)); + } + else { + SDL_Scancode scanCode = SDL_GetScancodeFromName(key.c_str()); + if (scanCode != SDL_SCANCODE_UNKNOWN) { + KeyAxisBinds[static_cast(player)].emplace(name, std::make_pair(scanCode, scale)); + } + } + } + + void KInput::AddActionMapping(const std::string& name, const std::string& key, const KPlayer& player) + { + if (key.rfind("Gamepad", 0) == 0) { + const auto delimiterPosition = key.find('_', 7); + const auto controllerIndex = static_cast(std::stoi(key.substr(7, delimiterPosition))); + auto button = key.substr(delimiterPosition + 1); + std::for_each(button.begin(), button.end(), [](char& c) { + c = ::tolower(c); + }); + ButtonBinds[static_cast(player)].emplace(name, std::make_pair(controllerIndex, SDL_GameControllerGetButtonFromString(button.c_str()))); + } + else { + SDL_Scancode scanCode = SDL_GetScancodeFromName(key.c_str()); + if (scanCode != SDL_SCANCODE_UNKNOWN) { + KeyBinds[static_cast(player)].emplace(name, scanCode); + } + } + } + bool KInput::IsControllerButtonPressed(const Controllers controllerId, const SDL_GameControllerButton button) const { if (controllerId < Controllers::Controller1 || controllerId > static_cast(GamePadsCount - 1)) return false; @@ -228,6 +275,23 @@ namespace KapitanGame { return !KeyboardInputs[scanCode] && KeyboardInputs[scanCode] != LastKeyboardInputs[scanCode]; } + float KInput::GetAxisValue(const std::string& name, const KPlayer& player) const + { + float value = 0.f; + const auto keyAxisBindRange = KeyAxisBinds[static_cast(player)].equal_range(name); + for (auto keyAxisBind = keyAxisBindRange.first; keyAxisBind != keyAxisBindRange.second; ++keyAxisBind) { + if (IsKeyboardButtonHeld(keyAxisBind->second.first)) { + value += 1.0f * keyAxisBind->second.second; + } + } + + const auto controllerAxisBindRange = ControllerAxisBinds[static_cast(player)].equal_range(name); + for (auto controllerAxisBind = controllerAxisBindRange.first; controllerAxisBind != controllerAxisBindRange.second; ++controllerAxisBind) { + value += GetControllerAxis(controllerAxisBind->second.Controller, controllerAxisBind->second.Axis) * controllerAxisBind->second.Scale; + } + return value; + } + bool KInput::IsKeyboardButtonHeld(const Uint8 scanCode) const { if (scanCode > KeyboardInputs.size()) diff --git a/2dgk_7/2dgk_7/KInput.h b/2dgk_7/2dgk_7/KInput.h index 37abf8a..5d9db5b 100644 --- a/2dgk_7/2dgk_7/KInput.h +++ b/2dgk_7/2dgk_7/KInput.h @@ -5,8 +5,16 @@ #include "GamePad.h" #include "KActionBind.h" +#include "KPlayer.h" namespace KapitanGame { + struct KControllerAxisMapping { + KControllerAxisMapping(Controllers controller, SDL_GameControllerAxis axis, float scale) : Controller(controller), Axis(axis), Scale(scale) {} + Controllers Controller; + SDL_GameControllerAxis Axis; + float Scale; + }; + class KInput { std::vector ConnectedControllers; std::vector ControllerInputs; @@ -15,8 +23,10 @@ namespace KapitanGame { std::vector LastKeyboardInputs; std::vector Actions; std::vector Axes; - std::unordered_map KeyBinds[static_cast(Controllers::Controller4) + 1]; - std::unordered_map ButtonBinds[static_cast(Controllers::Controller4) + 1]; + std::unordered_multimap KeyBinds[static_cast(KPlayer::Player2) + 1]; + std::unordered_multimap> ButtonBinds[static_cast(KPlayer::Player2) + 1]; + std::unordered_multimap ControllerAxisBinds[static_cast(KPlayer::Player2) + 1]; + std::unordered_multimap> KeyAxisBinds[static_cast(KPlayer::Player2) + 1]; int GamePadsCount; bool Initialized; @@ -27,6 +37,9 @@ namespace KapitanGame { bool IsKeyboardButtonHeld(Uint8 scanCode) const; bool IsKeyboardButtonPressed(Uint8 scanCode) const; bool IsKeyboardButtonReleased(Uint8 scanCode) const; + float GetAxisValue(const std::string& name, const KPlayer& player) const; + void ProcessActions(); + void ProcessAxes(); public: KInput(); void Init(); @@ -34,11 +47,12 @@ namespace KapitanGame { void HandleInputPreEvents(); void HandleInputPostEvents(); void HandleEvent(const SDL_Event& event); - void BindAction(const std::string& name, InputState expectedInputState, KPlayerController* controllerObject, KPlayerCommand command, Controllers - controller); - void BindAxis(const std::string& name, KPlayerController* controllerObject, KPlayerAxisCommand command, Controllers controller); - bool CheckAction(const std::string& name, InputState expectedInputState, Controllers controller); - void ProcessActions(); + void BindAction(const std::string& name, InputState expectedInputState, KPlayerController* controllerObject, KPlayerCommand command, KPlayer player); + void BindAxis(const std::string& name, KPlayerController* controllerObject, KPlayerAxisCommand command, KPlayer player); + bool CheckAction(const std::string& name, InputState expectedInputState, KPlayer player); + + void AddAxisMapping(const std::string& name, const float& scale, const std::string& key, const KPlayer& player); + void AddActionMapping(const std::string& name, const std::string& key, const KPlayer& player); }; } diff --git a/2dgk_7/2dgk_7/KPlayer.h b/2dgk_7/2dgk_7/KPlayer.h new file mode 100644 index 0000000..e9713c0 --- /dev/null +++ b/2dgk_7/2dgk_7/KPlayer.h @@ -0,0 +1,7 @@ +#pragma once +namespace KapitanGame { + enum class KPlayer : int { + Player1, + Player2 + }; +} \ No newline at end of file diff --git a/2dgk_7/2dgk_7/KPlayerController.cpp b/2dgk_7/2dgk_7/KPlayerController.cpp index 30d918a..28f1f27 100644 --- a/2dgk_7/2dgk_7/KPlayerController.cpp +++ b/2dgk_7/2dgk_7/KPlayerController.cpp @@ -5,8 +5,8 @@ namespace KapitanGame { void KPlayerController::SetupInputBindings(KInput& input) { - input.BindAxis("MoveYAxis", this, &KPlayerController::MoveYAxis, Controller); - input.BindAxis("MoveXAxis", this, &KPlayerController::MoveXAxis, Controller); + input.BindAxis("MoveYAxis", this, &KPlayerController::MoveYAxis, Player); + input.BindAxis("MoveXAxis", this, &KPlayerController::MoveXAxis, Player); } void KPlayerController::MoveYAxis(const float axis) diff --git a/2dgk_7/2dgk_7/KPlayerController.h b/2dgk_7/2dgk_7/KPlayerController.h index 632ef1a..ac83916 100644 --- a/2dgk_7/2dgk_7/KPlayerController.h +++ b/2dgk_7/2dgk_7/KPlayerController.h @@ -1,5 +1,6 @@ #pragma once #include "Controllers.h" +#include "KPlayer.h" #include "KShape.h" #include "KVector2d.h" @@ -9,7 +10,7 @@ namespace KapitanGame { class KPlayerController { public: - explicit KPlayerController(const Controllers controller) : Input(0.f, 0.f), Controller(controller) + KPlayerController(const KPlayer player) : Input(0.f, 0.f), Player(player) { } @@ -19,8 +20,8 @@ namespace KapitanGame { void Update(float deltaTime); private: KVector2D Input; - Controllers Controller; - KPawn Pawn; + KPlayer Player; + KShape* Pawn; }; typedef void (KPlayerController::* KPlayerCommand)(); typedef void (KPlayerController::* KPlayerAxisCommand)(float input); diff --git a/2dgk_7/2dgk_7/KShape.cpp b/2dgk_7/2dgk_7/KShape.cpp index b2a847f..d0a9a6b 100644 --- a/2dgk_7/2dgk_7/KShape.cpp +++ b/2dgk_7/2dgk_7/KShape.cpp @@ -5,6 +5,8 @@ #include #include +#include "Constants.h" + namespace KapitanGame { std::atomic KShape::IdCounter{ 0 }; @@ -76,4 +78,8 @@ namespace KapitanGame { KVector2D KShape::GetPosition() const { return Position; } + + void KShape::AddMovementInput(const KVector2D& input) { + Velocity = input * Constants::SPEED * (1 - Constants::SMOOTH) + Velocity * Constants::SMOOTH; + } } diff --git a/2dgk_7/2dgk_7/KShape.h b/2dgk_7/2dgk_7/KShape.h index 743f9f5..0455ff3 100644 --- a/2dgk_7/2dgk_7/KShape.h +++ b/2dgk_7/2dgk_7/KShape.h @@ -27,6 +27,7 @@ namespace KapitanGame { void Render(SDL_Renderer* renderer) const; virtual void CollisionDetectionWithMapStep(const SDL_Rect& map) = 0; KVector2D GetPosition() const; + void AddMovementInput(const KVector2D& input); const int Id; static std::atomic IdCounter; protected: diff --git a/2dgk_7/2dgk_7/KTile.h b/2dgk_7/2dgk_7/KTile.h index 0f60ea3..1c25567 100644 --- a/2dgk_7/2dgk_7/KTile.h +++ b/2dgk_7/2dgk_7/KTile.h @@ -9,9 +9,7 @@ namespace KapitanGame enum class TileType : std::uint32_t { Default = 0, - HorizontalWall = 1, - VerticalWall = 2, - Dot = 3 + Wall = 1 }; class KTile { public: diff --git a/2dgk_7/2dgk_7/Utils.h b/2dgk_7/2dgk_7/Utils.h index dc16e7f..54aed2a 100644 --- a/2dgk_7/2dgk_7/Utils.h +++ b/2dgk_7/2dgk_7/Utils.h @@ -3,6 +3,7 @@ #include #include #include +#include "KPlayer.h" namespace KapitanGame { namespace Utils { @@ -49,5 +50,14 @@ namespace KapitanGame { } double RandomNumber(); + + const KPlayer GetPlayerFromString(const std::string& str) { + static std::unordered_map const table = { {"Player1",KPlayer::Player1},{"Player2",KPlayer::Player2} }; + auto it = table.find(str); + if (it != table.end()) { + return it->second; + } + return KPlayer::Player1; + } } } \ No newline at end of file diff --git a/2dgk_7/2dgk_7/assets/levels/level1.txt b/2dgk_7/2dgk_7/assets/levels/level1.txt new file mode 100644 index 0000000..fee3295 --- /dev/null +++ b/2dgk_7/2dgk_7/assets/levels/level1.txt @@ -0,0 +1,33 @@ +################################# +# # # # # # # +# ######### # # ### # # ### ### # +# # # # # # # # +### ### ### ### # ### # # # ##### +# # # # # # # # # # # +# # ### # # # # ####### # # ### # +# # # # # # # # # # # # +####### ### ### # ####### ### # # +# # # # # # # # # # +# # # ### ### # # # # ### # ##### +# # # # # # # # # # +# # ### # ### # # ### # # ### # # +# # # # # # # # # # # +# # # ### ### # ### ### ### # # # +# # # # # # # # # # # # +# ### ##### ##### # ######### ### +# # # # # # # +##### ### # ### ####### # ##### # +# # # # # # +# ######### # # ####### ##### ### +# # # # # # # # # +### ### ### ########### ### # ### +# # # # # # # +# # ### # ### # ##### ### ### # # +# # # # # # # # # +# # ##### ### ### ### # ### # ### +# # # # # # # # # # +# ##### # # ##### # # ##### ##### +# # # # # # # # # # # # # +# # ### ##### ####### # # # ### # +# # # # # # +################################# \ No newline at end of file diff --git a/2dgk_7/2dgk_7/assets/levels/level2.txt b/2dgk_7/2dgk_7/assets/levels/level2.txt new file mode 100644 index 0000000..1c71b6b --- /dev/null +++ b/2dgk_7/2dgk_7/assets/levels/level2.txt @@ -0,0 +1,37 @@ +##################################### +# # # # # # # +# ### ### # # # ######### # ##### # # +# # # # # # # # # # +### # ### # ####### # # ##### # ### # +# # # # # # # # # +### ########### # ### # # # # ### ### +# # # # # # # # # # # # +# # ### ### # ### ### # ######### # # +# # # # # # # # # +# # ### # # ### # # # ### ######### # +# # # # # # # # # # # # # # +# ##### # # # # ####### ### ##### # # +# # # # # # # # +# ##### # # # ##### ####### ### # ### +# # # # # # # # # # +####### ### ### # # # # ### ####### # +# # # # # # # # # # # # +# ##### # # ##### ### # ### # # ### # +# # # # # # # # # # # # # # +# # # ### ### ### ### # ### ##### ### +# # # # # # # # # +# ####### ##### # ### ####### ####### +# # # # # # # +# # ### ##### ############# ### ##### +# # # # # # # # # # +### # # ######### # # # # ### # ### # +# # # # # # # # # # +# ##### ### ### # # ### # ### ##### # +# # # # # # # # # # # # +# # ### ### # # # # ##### # # # # # # +# # # # # # # # # # # # # # +# ####### ### ######### ######### # # +# # # # # # # # # # # +# # ######### # # # ##### # # # # # # +# # # # # +##################################### \ No newline at end of file diff --git a/2dgk_7/2dgk_7/assets/levels/level3.txt b/2dgk_7/2dgk_7/assets/levels/level3.txt new file mode 100644 index 0000000..96e2dfb --- /dev/null +++ b/2dgk_7/2dgk_7/assets/levels/level3.txt @@ -0,0 +1,41 @@ +######################################### +# # # # # # # # +# # ### # # ####### ### ####### ####### # +# # # # # # # # # # # +# # # # # ##### ####### # ### # ### ##### +# # # # # # # # # # +# # ### # ##### ##### ### ### # ##### # # +# # # # # # # # # # +### ######### ##### ####### ### ##### # # +# # # # # # # # # # # +# ### # ### ### ##### # # ### ### # ### # +# # # # # # # # # # # # +### ### ####### # # # ####### # # # # # # +# # # # # # # # # # # # # # # +# ### # # ### ### # ### # # ### ##### ### +# # # # # # # # # # # # +# # # ### ##### ##### # ##### # # ### ### +# # # # # # # # +# ####### ### ### # # ######### # ####### +# # # # # # # # +# ### ##### ### # ########### ######### # +# # # # # # # # # # # # +# ##### # # ### ### ### ### # # # # ### # +# # # # # # # # # # # # # +# # ### # ### # ### # ##### ##### # # ### +# # # # # # # # # # # # +# ##### ####### ####### ### ##### # # # # +# # # # # # # # # # # # # +### ### ### ### # # ### ##### ####### # # +# # # # # # # # # +### ##### ##### ### ##### # ### ### # # # +# # # # # # # # # # # +# ##### # ### ##### # # # ### ### ### # # +# # # # # # # # # # # # +##### # ### ##### ### # # # ### # # # ### +# # # # # # # # # # # +# ##### ####### ####### # ##### ### # ### +# # # # # # # # # # # +# # # # ### ### # ### # ##### ### # # # # +# # # # # # # # # # # # +######################################### \ No newline at end of file diff --git a/2dgk_7/2dgk_7/assets/textures/P1.bmp b/2dgk_7/2dgk_7/assets/textures/P1.bmp new file mode 100644 index 0000000..f83e1fe --- /dev/null +++ b/2dgk_7/2dgk_7/assets/textures/P1.bmp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b30a0d9f2b72be79604b33f38401c7991fb300fee9747786d51defe88800a071 +size 1782 diff --git a/2dgk_7/2dgk_7/assets/textures/P2.bmp b/2dgk_7/2dgk_7/assets/textures/P2.bmp new file mode 100644 index 0000000..61045f0 --- /dev/null +++ b/2dgk_7/2dgk_7/assets/textures/P2.bmp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10e48bd872907ed9efe67269f21862a33948c31c53aa303b0a738e4317e03275 +size 1782 diff --git a/2dgk_7/2dgk_7/assets/textures/exit.bmp b/2dgk_7/2dgk_7/assets/textures/exit.bmp new file mode 100644 index 0000000..45b5912 --- /dev/null +++ b/2dgk_7/2dgk_7/assets/textures/exit.bmp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e75171d7751468d4c0042916a2650f82cb3c4989973452805d3e73cd3843a44f +size 3126 diff --git a/2dgk_7/2dgk_7/assets/textures/wall.bmp b/2dgk_7/2dgk_7/assets/textures/wall.bmp new file mode 100644 index 0000000..dc1e5eb --- /dev/null +++ b/2dgk_7/2dgk_7/assets/textures/wall.bmp @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fce8eb3cb3ca774fe68a04a8f16f28c889d9e0809ca21a0b1d39edbc796d786 +size 3126 diff --git a/2dgk_7/2dgk_7/config.default.ini b/2dgk_7/2dgk_7/config.default.ini new file mode 100644 index 0000000..ff1fd5a --- /dev/null +++ b/2dgk_7/2dgk_7/config.default.ini @@ -0,0 +1,15 @@ +[Input] +[.Player1] +AxisMappings=(AxisName="MoveY",Scale=-1.000000,Key=W) +AxisMappings=(AxisName="MoveY",Scale=1.000000,Key=S) +AxisMappings=(AxisName="MoveX",Scale=1.000000,Key=Gamepad1_LeftX) +AxisMappings=(AxisName="MoveX",Scale=1.000000,Key=D) +AxisMappings=(AxisName="MoveX",Scale=-1.000000,Key=A) +AxisMappings=(AxisName="MoveY",Scale=1.000000,Key=Gamepad1_LeftY) +[.Player2] +AxisMappings=(AxisName="MoveY",Scale=-1.000000,Key=I) +AxisMappings=(AxisName="MoveY",Scale=1.000000,Key=K) +AxisMappings=(AxisName="MoveX",Scale=1.000000,Key=L) +AxisMappings=(AxisName="MoveX",Scale=-1.000000,Key=J) +AxisMappings=(AxisName="MoveY",Scale=1.000000,Key=Gamepad2_LeftY) +AxisMappings=(AxisName="MoveX",Scale=1.000000,Key=Gamepad2_LeftX) diff --git a/2dgk_7/2dgk_7/config.json b/2dgk_7/2dgk_7/config.json new file mode 100644 index 0000000..e57f294 --- /dev/null +++ b/2dgk_7/2dgk_7/config.json @@ -0,0 +1,74 @@ +{ + "Input": { + "Player1": { + "AxisMappings": [ + { + "AxisName": "MoveY", + "Scale": -1.000000, + "Key": "W" + }, + { + "AxisName": "MoveY", + "Scale": 1.000000, + "Key": "S" + }, + { + "AxisName": "MoveX", + "Scale": 1.000000, + "Key": "D" + }, + { + "AxisName": "MoveX", + "Scale": -1.000000, + "Key": "A" + }, + { + "AxisName": "MoveY", + "Scale": -1.000000, + "Key": "Gamepad1_LeftY" + }, + { + "AxisName": "MoveX", + "Scale": 1.000000, + "Key": "Gamepad1_LeftX" + } + ], + "ActionMappings": [] + }, + "Player2": { + "AxisMappings": [ + { + "AxisName": "MoveY", + "Scale": -1.000000, + "Key": "I" + }, + { + "AxisName": "MoveY", + "Scale": 1.000000, + "Key": "K" + }, + { + "AxisName": "MoveX", + "Scale": 1.000000, + "Key": "J" + }, + { + "AxisName": "MoveX", + "Scale": -1.000000, + "Key": "L" + }, + { + "AxisName": "MoveY", + "Scale": -1.000000, + "Key": "Gamepad2_LeftY" + }, + { + "AxisName": "MoveX", + "Scale": 1.000000, + "Key": "Gamepad2_LeftX" + } + ], + "ActionMappings": [] + } + } +} \ No newline at end of file diff --git a/2dgk_7/2dgk_7/textures/00.bmp b/2dgk_7/2dgk_7/textures/00.bmp deleted file mode 100644 index 7ffe609..0000000 --- a/2dgk_7/2dgk_7/textures/00.bmp +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1dbb92f9be017b00038388d19298e8ee9b4da1cd54577c2b22b6b7ab8d81734a -size 3126 diff --git a/2dgk_7/2dgk_7/vcpkg.json b/2dgk_7/2dgk_7/vcpkg.json index bb1cfbc..e59b4ad 100644 --- a/2dgk_7/2dgk_7/vcpkg.json +++ b/2dgk_7/2dgk_7/vcpkg.json @@ -3,6 +3,7 @@ "name": "dgk-7", "version": "0.1.0", "dependencies": [ - "sdl2" + "sdl2", + "nlohmann-json" ] } \ No newline at end of file