Zad 2 final wip

This commit is contained in:
Michał Leśniak 2021-12-09 12:15:49 +01:00
parent 93afaeb4b3
commit 7faaf63fb5
24 changed files with 413 additions and 81 deletions

View File

@ -175,6 +175,7 @@
<ClInclude Include="KCircle.h" /> <ClInclude Include="KCircle.h" />
<ClInclude Include="KGame.h" /> <ClInclude Include="KGame.h" />
<ClInclude Include="KInput.h" /> <ClInclude Include="KInput.h" />
<ClInclude Include="KPlayer.h" />
<ClInclude Include="KPlayerController.h" /> <ClInclude Include="KPlayerController.h" />
<ClInclude Include="KRect.h" /> <ClInclude Include="KRect.h" />
<ClInclude Include="KShape.h" /> <ClInclude Include="KShape.h" />

View File

@ -86,5 +86,8 @@
<ClInclude Include="Controllers.h"> <ClInclude Include="Controllers.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="KPlayer.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "Controllers.h" #include "KPlayer.h"
#include "KPlayerController.h" #include "KPlayerController.h"
namespace KapitanGame { namespace KapitanGame {
@ -10,22 +10,22 @@ namespace KapitanGame {
Hold Hold
}; };
struct KActionBind { struct KActionBind {
KActionBind(std::string name, const InputState expectedInputState, KPlayerController* controllerObject, const KPlayerCommand command, const Controllers 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), Controller(controller) {} Name(std::move(name)), ExpectedInputState(expectedInputState), ControllerObject(controllerObject), Command(command), Player(player) {}
std::string Name; std::string Name;
InputState ExpectedInputState; InputState ExpectedInputState;
KPlayerController* ControllerObject; KPlayerController* ControllerObject;
KPlayerCommand Command; KPlayerCommand Command;
Controllers Controller; KPlayer Player;
}; };
struct KAxisBind struct KAxisBind
{ {
KAxisBind(std::string name, KPlayerController* controllerObject, const KPlayerAxisCommand command, const Controllers controller) : KAxisBind(std::string name, KPlayerController* controllerObject, const KPlayerAxisCommand command, const KPlayer player) :
Name(std::move(name)), ControllerObject(controllerObject), AxisCommand(command), Controller(controller) {} Name(std::move(name)), ControllerObject(controllerObject), AxisCommand(command), Player(player) {}
std::string Name; std::string Name;
KPlayerController* ControllerObject; KPlayerController* ControllerObject;
KPlayerAxisCommand AxisCommand; KPlayerAxisCommand AxisCommand;
Controllers Controller; KPlayer Player;
}; };
} }

View File

@ -1,5 +1,6 @@
#include "KGame.h" #include "KGame.h"
#include "SDL.h" #include "SDL.h"
#include <nlohmann/json.hpp>
#include <cstdio> #include <cstdio>
#include <cmath> #include <cmath>
#include <string> #include <string>
@ -65,32 +66,53 @@ namespace KapitanGame {
//Loading success flag //Loading success flag
bool success = true; 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"); printf("Failed to load player texture image!\n");
success = false; 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"); printf("Failed to load player texture image!\n");
success = false; 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<int>(TileType::Default); i <= static_cast<int>(TileType::Dot); ++i) std::ifstream configFile("config.json");
{ if (configFile.fail()) {
if (!TileTextures[i].LoadFromFile("textures/0" + std::to_string(i) + ".bmp", Renderer)) printf("Failed to load config.json!\n");
{ success = false;
printf("Failed to load 0%d texture image!\n", i); }
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<std::string>(), axisMapping["Scale"].get<float>(), axisMapping["Key"].get<std::string>(), playerEnum);
}
for (auto& actionMapping : player.value()["ActionMappings"]) {
Input.AddActionMapping(actionMapping["ActionName"].get<std::string>(), actionMapping["Key"].get<std::string>(), playerEnum);
}
} }
} }
Tiles.clear(); Tiles.clear();
std::ifstream levelFile; std::ifstream levelFile;
levelFile.open("level.txt"); levelFile.open("assets/level1.txt");
if (levelFile.fail()) if (levelFile.fail())
{ {
printf("Failed to load level.txt!\n"); printf("Failed to load assets/level1.txt!\n");
success = false; success = false;
} }
else else
@ -104,16 +126,11 @@ namespace KapitanGame {
auto type = TileType::Default; auto type = TileType::Default;
switch (line[i]) switch (line[i])
{ {
case '|': case '#':
type = TileType::VerticalWall; type = TileType::Wall;
break; break;
case '-': default:
type = TileType::HorizontalWall; continue;
break;
case '.':
type = TileType::Dot;
break;
default:;
} }
Tiles.emplace_back(i * Constants::TILE_WIDTH, y * Constants::TILE_HEIGHT, type); Tiles.emplace_back(i * Constants::TILE_WIDTH, y * Constants::TILE_HEIGHT, type);
} }

View File

@ -2,6 +2,7 @@
#include "Constants.h" #include "Constants.h"
#include <SDL.h> #include <SDL.h>
#include <algorithm>
namespace KapitanGame { namespace KapitanGame {
KInput::KInput() : GamePadsCount(0), Initialized(false) KInput::KInput() : GamePadsCount(0), Initialized(false)
@ -77,6 +78,8 @@ namespace KapitanGame {
int size = 0; int size = 0;
const Uint8* currentKeyStates = SDL_GetKeyboardState(&size); const Uint8* currentKeyStates = SDL_GetKeyboardState(&size);
KeyboardInputs = std::vector<Uint8>(currentKeyStates, currentKeyStates + size); KeyboardInputs = std::vector<Uint8>(currentKeyStates, currentKeyStates + size);
ProcessActions();
ProcessAxes();
} }
void KInput::HandleEvent(const SDL_Event& event) { void KInput::HandleEvent(const SDL_Event& event) {
switch (event.type) { switch (event.type) {
@ -119,71 +122,115 @@ namespace KapitanGame {
} }
} }
void KInput::BindAction(const std::string& name, InputState expectedInputState, KPlayerController* controllerObject, void KInput::BindAction(const std::string& name, InputState expectedInputState,
KPlayerCommand command, Controllers controller) { KPlayerController* controllerObject,
Actions.emplace_back(name, expectedInputState, controllerObject, command, controller); 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) { bool KInput::CheckAction(const std::string& name, const InputState expectedInputState, KPlayer player) {
const auto keyBind = KeyBinds[static_cast<int>(controller)].find(name); const auto keyBindRange = KeyBinds[static_cast<int>(player)].equal_range(name);
const auto buttonBind = ButtonBinds[static_cast<int>(controller)].find(name); for (auto keyBind = keyBindRange.first; keyBind != keyBindRange.second; ++keyBind) {
switch (expectedInputState) { switch (expectedInputState) {
case InputState::Pressed: case InputState::Pressed:
if (keyBind != KeyBinds[static_cast<int>(controller)].end()) {
if (IsKeyboardButtonPressed(keyBind->second)) { if (IsKeyboardButtonPressed(keyBind->second)) {
return true; return true;
} }
} break;
case InputState::Released:
if (buttonBind != ButtonBinds[static_cast<int>(controller)].end()) {
if (IsControllerButtonPressed(controller, buttonBind->second)) {
return true;
}
}
return false;
case InputState::Released:
if (keyBind != KeyBinds[static_cast<int>(controller)].end()) {
if (IsKeyboardButtonReleased(keyBind->second)) { if (IsKeyboardButtonReleased(keyBind->second)) {
return true; return true;
} }
} break;
case InputState::Hold:
if (buttonBind != ButtonBinds[static_cast<int>(controller)].end()) {
if (IsControllerButtonReleased(controller, buttonBind->second)) {
return true;
}
}
return false;
case InputState::Hold:
if (keyBind != KeyBinds[static_cast<int>(controller)].end()) {
if (IsKeyboardButtonHeld(keyBind->second)) { if (IsKeyboardButtonHeld(keyBind->second)) {
return true; return true;
} }
break;
} }
}
if (buttonBind != ButtonBinds[static_cast<int>(controller)].end()) { const auto buttonBindRange = ButtonBinds[static_cast<int>(player)].equal_range(name);
if (IsControllerButtonHeld(controller, buttonBind->second)) { for (auto buttonBind = buttonBindRange.first; buttonBind != buttonBindRange.second; ++buttonBind) {
switch (expectedInputState) {
case InputState::Pressed:
if (IsControllerButtonPressed(buttonBind->second.first, buttonBind->second.second)) {
return true; 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; return false;
} }
void KInput::ProcessActions() { void KInput::ProcessActions() {
for (auto &action : Actions) { for (auto& action : Actions) {
if (CheckAction(action.Name, action.ExpectedInputState, action.Controller)) { if (CheckAction(action.Name, action.ExpectedInputState, action.Player)) {
std::invoke(action.Command, action.ControllerObject); 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<Controllers>(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<int>(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<int>(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<Controllers>(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<int>(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<int>(player)].emplace(name, scanCode);
}
}
}
bool KInput::IsControllerButtonPressed(const Controllers controllerId, const SDL_GameControllerButton button) const bool KInput::IsControllerButtonPressed(const Controllers controllerId, const SDL_GameControllerButton button) const
{ {
if (controllerId < Controllers::Controller1 || controllerId > static_cast<Controllers>(GamePadsCount - 1)) return false; if (controllerId < Controllers::Controller1 || controllerId > static_cast<Controllers>(GamePadsCount - 1)) return false;
@ -228,6 +275,23 @@ namespace KapitanGame {
return !KeyboardInputs[scanCode] && KeyboardInputs[scanCode] != LastKeyboardInputs[scanCode]; 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<int>(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<int>(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 bool KInput::IsKeyboardButtonHeld(const Uint8 scanCode) const
{ {
if (scanCode > KeyboardInputs.size()) if (scanCode > KeyboardInputs.size())

View File

@ -5,8 +5,16 @@
#include "GamePad.h" #include "GamePad.h"
#include "KActionBind.h" #include "KActionBind.h"
#include "KPlayer.h"
namespace KapitanGame { 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 { class KInput {
std::vector<SDL_GameController*> ConnectedControllers; std::vector<SDL_GameController*> ConnectedControllers;
std::vector<GamePad> ControllerInputs; std::vector<GamePad> ControllerInputs;
@ -15,8 +23,10 @@ namespace KapitanGame {
std::vector<Uint8> LastKeyboardInputs; std::vector<Uint8> LastKeyboardInputs;
std::vector<KActionBind> Actions; std::vector<KActionBind> Actions;
std::vector<KAxisBind> Axes; std::vector<KAxisBind> Axes;
std::unordered_map<std::string, Uint8> KeyBinds[static_cast<int>(Controllers::Controller4) + 1]; std::unordered_multimap<std::string, Uint8> KeyBinds[static_cast<int>(KPlayer::Player2) + 1];
std::unordered_map<std::string, SDL_GameControllerButton> ButtonBinds[static_cast<int>(Controllers::Controller4) + 1]; std::unordered_multimap<std::string, std::pair<Controllers, SDL_GameControllerButton>> ButtonBinds[static_cast<int>(KPlayer::Player2) + 1];
std::unordered_multimap<std::string, KControllerAxisMapping> ControllerAxisBinds[static_cast<int>(KPlayer::Player2) + 1];
std::unordered_multimap<std::string, std::pair<Uint8, float>> KeyAxisBinds[static_cast<int>(KPlayer::Player2) + 1];
int GamePadsCount; int GamePadsCount;
bool Initialized; bool Initialized;
@ -27,6 +37,9 @@ namespace KapitanGame {
bool IsKeyboardButtonHeld(Uint8 scanCode) const; bool IsKeyboardButtonHeld(Uint8 scanCode) const;
bool IsKeyboardButtonPressed(Uint8 scanCode) const; bool IsKeyboardButtonPressed(Uint8 scanCode) const;
bool IsKeyboardButtonReleased(Uint8 scanCode) const; bool IsKeyboardButtonReleased(Uint8 scanCode) const;
float GetAxisValue(const std::string& name, const KPlayer& player) const;
void ProcessActions();
void ProcessAxes();
public: public:
KInput(); KInput();
void Init(); void Init();
@ -34,11 +47,12 @@ namespace KapitanGame {
void HandleInputPreEvents(); void HandleInputPreEvents();
void HandleInputPostEvents(); void HandleInputPostEvents();
void HandleEvent(const SDL_Event& event); void HandleEvent(const SDL_Event& event);
void BindAction(const std::string& name, InputState expectedInputState, KPlayerController* controllerObject, KPlayerCommand command, Controllers void BindAction(const std::string& name, InputState expectedInputState, KPlayerController* controllerObject, KPlayerCommand command, KPlayer player);
controller); void BindAxis(const std::string& name, KPlayerController* controllerObject, KPlayerAxisCommand command, KPlayer player);
void BindAxis(const std::string& name, KPlayerController* controllerObject, KPlayerAxisCommand command, Controllers controller); bool CheckAction(const std::string& name, InputState expectedInputState, KPlayer player);
bool CheckAction(const std::string& name, InputState expectedInputState, Controllers controller);
void ProcessActions(); 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);
}; };
} }

7
2dgk_7/2dgk_7/KPlayer.h Normal file
View File

@ -0,0 +1,7 @@
#pragma once
namespace KapitanGame {
enum class KPlayer : int {
Player1,
Player2
};
}

View File

@ -5,8 +5,8 @@
namespace KapitanGame { namespace KapitanGame {
void KPlayerController::SetupInputBindings(KInput& input) void KPlayerController::SetupInputBindings(KInput& input)
{ {
input.BindAxis("MoveYAxis", this, &KPlayerController::MoveYAxis, Controller); input.BindAxis("MoveYAxis", this, &KPlayerController::MoveYAxis, Player);
input.BindAxis("MoveXAxis", this, &KPlayerController::MoveXAxis, Controller); input.BindAxis("MoveXAxis", this, &KPlayerController::MoveXAxis, Player);
} }
void KPlayerController::MoveYAxis(const float axis) void KPlayerController::MoveYAxis(const float axis)

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "Controllers.h" #include "Controllers.h"
#include "KPlayer.h"
#include "KShape.h" #include "KShape.h"
#include "KVector2d.h" #include "KVector2d.h"
@ -9,7 +10,7 @@ namespace KapitanGame {
class KPlayerController class KPlayerController
{ {
public: 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); void Update(float deltaTime);
private: private:
KVector2D Input; KVector2D Input;
Controllers Controller; KPlayer Player;
KPawn Pawn; KShape* Pawn;
}; };
typedef void (KPlayerController::* KPlayerCommand)(); typedef void (KPlayerController::* KPlayerCommand)();
typedef void (KPlayerController::* KPlayerAxisCommand)(float input); typedef void (KPlayerController::* KPlayerAxisCommand)(float input);

View File

@ -5,6 +5,8 @@
#include <stdexcept> #include <stdexcept>
#include <typeinfo> #include <typeinfo>
#include "Constants.h"
namespace KapitanGame { namespace KapitanGame {
std::atomic<int> KShape::IdCounter{ 0 }; std::atomic<int> KShape::IdCounter{ 0 };
@ -76,4 +78,8 @@ namespace KapitanGame {
KVector2D KShape::GetPosition() const { KVector2D KShape::GetPosition() const {
return Position; return Position;
} }
void KShape::AddMovementInput(const KVector2D& input) {
Velocity = input * Constants::SPEED * (1 - Constants::SMOOTH) + Velocity * Constants::SMOOTH;
}
} }

View File

@ -27,6 +27,7 @@ namespace KapitanGame {
void Render(SDL_Renderer* renderer) const; void Render(SDL_Renderer* renderer) const;
virtual void CollisionDetectionWithMapStep(const SDL_Rect& map) = 0; virtual void CollisionDetectionWithMapStep(const SDL_Rect& map) = 0;
KVector2D GetPosition() const; KVector2D GetPosition() const;
void AddMovementInput(const KVector2D& input);
const int Id; const int Id;
static std::atomic<int> IdCounter; static std::atomic<int> IdCounter;
protected: protected:

View File

@ -9,9 +9,7 @@ namespace KapitanGame
enum class TileType : std::uint32_t { enum class TileType : std::uint32_t {
Default = 0, Default = 0,
HorizontalWall = 1, Wall = 1
VerticalWall = 2,
Dot = 3
}; };
class KTile { class KTile {
public: public:

View File

@ -3,6 +3,7 @@
#include <string> #include <string>
#include <stdexcept> #include <stdexcept>
#include <random> #include <random>
#include "KPlayer.h"
namespace KapitanGame { namespace KapitanGame {
namespace Utils { namespace Utils {
@ -49,5 +50,14 @@ namespace KapitanGame {
} }
double RandomNumber(); double RandomNumber();
const KPlayer GetPlayerFromString(const std::string& str) {
static std::unordered_map<std::string, KPlayer> const table = { {"Player1",KPlayer::Player1},{"Player2",KPlayer::Player2} };
auto it = table.find(str);
if (it != table.end()) {
return it->second;
}
return KPlayer::Player1;
}
} }
} }

View File

@ -0,0 +1,33 @@
#################################
# # # # # # #
# ######### # # ### # # ### ### #
# # # # # # # #
### ### ### ### # ### # # # #####
# # # # # # # # # # #
# # ### # # # # ####### # # ### #
# # # # # # # # # # # #
####### ### ### # ####### ### # #
# # # # # # # # # #
# # # ### ### # # # # ### # #####
# # # # # # # # # #
# # ### # ### # # ### # # ### # #
# # # # # # # # # # #
# # # ### ### # ### ### ### # # #
# # # # # # # # # # # #
# ### ##### ##### # ######### ###
# # # # # # #
##### ### # ### ####### # ##### #
# # # # # #
# ######### # # ####### ##### ###
# # # # # # # # #
### ### ### ########### ### # ###
# # # # # # #
# # ### # ### # ##### ### ### # #
# # # # # # # # #
# # ##### ### ### ### # ### # ###
# # # # # # # # # #
# ##### # # ##### # # ##### #####
# # # # # # # # # # # # #
# # ### ##### ####### # # # ### #
# # # # # #
#################################

View File

@ -0,0 +1,37 @@
#####################################
# # # # # # #
# ### ### # # # ######### # ##### # #
# # # # # # # # # #
### # ### # ####### # # ##### # ### #
# # # # # # # # #
### ########### # ### # # # # ### ###
# # # # # # # # # # # #
# # ### ### # ### ### # ######### # #
# # # # # # # # #
# # ### # # ### # # # ### ######### #
# # # # # # # # # # # # # #
# ##### # # # # ####### ### ##### # #
# # # # # # # #
# ##### # # # ##### ####### ### # ###
# # # # # # # # # #
####### ### ### # # # # ### ####### #
# # # # # # # # # # # #
# ##### # # ##### ### # ### # # ### #
# # # # # # # # # # # # # #
# # # ### ### ### ### # ### ##### ###
# # # # # # # # #
# ####### ##### # ### ####### #######
# # # # # # #
# # ### ##### ############# ### #####
# # # # # # # # # #
### # # ######### # # # # ### # ### #
# # # # # # # # # #
# ##### ### ### # # ### # ### ##### #
# # # # # # # # # # # #
# # ### ### # # # # ##### # # # # # #
# # # # # # # # # # # # # #
# ####### ### ######### ######### # #
# # # # # # # # # # #
# # ######### # # # ##### # # # # # #
# # # # #
#####################################

View File

@ -0,0 +1,41 @@
#########################################
# # # # # # # #
# # ### # # ####### ### ####### ####### #
# # # # # # # # # # #
# # # # # ##### ####### # ### # ### #####
# # # # # # # # # #
# # ### # ##### ##### ### ### # ##### # #
# # # # # # # # # #
### ######### ##### ####### ### ##### # #
# # # # # # # # # # #
# ### # ### ### ##### # # ### ### # ### #
# # # # # # # # # # # #
### ### ####### # # # ####### # # # # # #
# # # # # # # # # # # # # # #
# ### # # ### ### # ### # # ### ##### ###
# # # # # # # # # # # #
# # # ### ##### ##### # ##### # # ### ###
# # # # # # # #
# ####### ### ### # # ######### # #######
# # # # # # # #
# ### ##### ### # ########### ######### #
# # # # # # # # # # # #
# ##### # # ### ### ### ### # # # # ### #
# # # # # # # # # # # # #
# # ### # ### # ### # ##### ##### # # ###
# # # # # # # # # # # #
# ##### ####### ####### ### ##### # # # #
# # # # # # # # # # # # #
### ### ### ### # # ### ##### ####### # #
# # # # # # # # #
### ##### ##### ### ##### # ### ### # # #
# # # # # # # # # # #
# ##### # ### ##### # # # ### ### ### # #
# # # # # # # # # # # #
##### # ### ##### ### # # # ### # # # ###
# # # # # # # # # # #
# ##### ####### ####### # ##### ### # ###
# # # # # # # # # # #
# # # # ### ### # ### # ##### ### # # # #
# # # # # # # # # # # #
#########################################

BIN
2dgk_7/2dgk_7/assets/textures/P1.bmp (Stored with Git LFS) Normal file

Binary file not shown.

BIN
2dgk_7/2dgk_7/assets/textures/P2.bmp (Stored with Git LFS) Normal file

Binary file not shown.

BIN
2dgk_7/2dgk_7/assets/textures/exit.bmp (Stored with Git LFS) Normal file

Binary file not shown.

BIN
2dgk_7/2dgk_7/assets/textures/wall.bmp (Stored with Git LFS) Normal file

Binary file not shown.

View File

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

74
2dgk_7/2dgk_7/config.json Normal file
View File

@ -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": []
}
}
}

BIN
2dgk_7/2dgk_7/textures/00.bmp (Stored with Git LFS)

Binary file not shown.

View File

@ -3,6 +3,7 @@
"name": "dgk-7", "name": "dgk-7",
"version": "0.1.0", "version": "0.1.0",
"dependencies": [ "dependencies": [
"sdl2" "sdl2",
"nlohmann-json"
] ]
} }