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="KGame.h" />
<ClInclude Include="KInput.h" />
<ClInclude Include="KPlayer.h" />
<ClInclude Include="KPlayerController.h" />
<ClInclude Include="KRect.h" />
<ClInclude Include="KShape.h" />

View File

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

View File

@ -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;
};
}

View File

@ -1,5 +1,6 @@
#include "KGame.h"
#include "SDL.h"
#include <nlohmann/json.hpp>
#include <cstdio>
#include <cmath>
#include <string>
@ -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<int>(TileType::Default); i <= static_cast<int>(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);
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<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();
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);
}

View File

@ -2,6 +2,7 @@
#include "Constants.h"
#include <SDL.h>
#include <algorithm>
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<Uint8>(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<int>(controller)].find(name);
const auto buttonBind = ButtonBinds[static_cast<int>(controller)].find(name);
bool KInput::CheckAction(const std::string& name, const InputState expectedInputState, KPlayer player) {
const auto keyBindRange = KeyBinds[static_cast<int>(player)].equal_range(name);
for (auto keyBind = keyBindRange.first; keyBind != keyBindRange.second; ++keyBind) {
switch (expectedInputState) {
case InputState::Pressed:
if (keyBind != KeyBinds[static_cast<int>(controller)].end()) {
if (IsKeyboardButtonPressed(keyBind->second)) {
return true;
}
}
if (buttonBind != ButtonBinds[static_cast<int>(controller)].end()) {
if (IsControllerButtonPressed(controller, buttonBind->second)) {
return true;
}
}
return false;
break;
case InputState::Released:
if (keyBind != KeyBinds[static_cast<int>(controller)].end()) {
if (IsKeyboardButtonReleased(keyBind->second)) {
return true;
}
}
if (buttonBind != ButtonBinds[static_cast<int>(controller)].end()) {
if (IsControllerButtonReleased(controller, buttonBind->second)) {
return true;
}
}
return false;
break;
case InputState::Hold:
if (keyBind != KeyBinds[static_cast<int>(controller)].end()) {
if (IsKeyboardButtonHeld(keyBind->second)) {
return true;
}
break;
}
}
if (buttonBind != ButtonBinds[static_cast<int>(controller)].end()) {
if (IsControllerButtonHeld(controller, buttonBind->second)) {
const auto buttonBindRange = ButtonBinds[static_cast<int>(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)) {
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<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
{
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];
}
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
{
if (scanCode > KeyboardInputs.size())

View File

@ -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<SDL_GameController*> ConnectedControllers;
std::vector<GamePad> ControllerInputs;
@ -15,8 +23,10 @@ namespace KapitanGame {
std::vector<Uint8> LastKeyboardInputs;
std::vector<KActionBind> Actions;
std::vector<KAxisBind> Axes;
std::unordered_map<std::string, Uint8> KeyBinds[static_cast<int>(Controllers::Controller4) + 1];
std::unordered_map<std::string, SDL_GameControllerButton> ButtonBinds[static_cast<int>(Controllers::Controller4) + 1];
std::unordered_multimap<std::string, Uint8> KeyBinds[static_cast<int>(KPlayer::Player2) + 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;
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);
};
}

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

View File

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

View File

@ -5,6 +5,8 @@
#include <stdexcept>
#include <typeinfo>
#include "Constants.h"
namespace KapitanGame {
std::atomic<int> 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;
}
}

View File

@ -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<int> IdCounter;
protected:

View File

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

View File

@ -3,6 +3,7 @@
#include <string>
#include <stdexcept>
#include <random>
#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<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",
"version": "0.1.0",
"dependencies": [
"sdl2"
"sdl2",
"nlohmann-json"
]
}