commit f49a3552
Add a player struct
Changed files
| M | src/saland/Game.cpp before |
| A | src/saland/model/Player.cpp |
| A | src/saland/model/Player.hpp |
diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp
index 2a16d9f..5c33fa9 100644
--- a/src/saland/Game.cpp
+++ b/src/saland/Game.cpp
@@ -33,6 +33,7 @@ https://github.com/sago007/saland
#include "../sago/SagoTextField.hpp"
#include "globals.hpp"
#include "model/placeables.hpp"
+#include "model/Player.hpp"
#include "SDL.h"
#include <SDL2/SDL2_gfxPrimitives.h>
#include <cmath>
@@ -116,6 +117,7 @@ static ResetRegionConsoleCommand rrcc;
struct Game::GameImpl {
GameRegion gameRegion;
std::shared_ptr<Human> human;
+ Player player;
float center_x = 0;
float center_y = 0;
bool drawCollision = true;
@@ -177,11 +179,11 @@ Game::Game() {
data->human.reset(new Human());
data->lastUpdate = SDL_GetTicks();
ResetWorld(0, 0, false);
- data->human->pants = "pants_1";
- data->human->hair = "hair_1";
+ data->human->pants = data->player.get_visible_bottom();
+ data->human->hair = data->player.get_visible_hair();
- data->human->race = "female";
- data->human->top = "sleeveless_shirt_red";
+ data->human->race = data->player.get_visible_race();
+ data->human->top = data->player.get_visible_top();
data->bottomField.SetHolder(globalData.dataHolder);
data->bottomField.SetFontSize(20);
diff --git a/src/saland/model/Player.cpp b/src/saland/model/Player.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/saland/model/Player.cpp
diff --git a/src/saland/model/Player.hpp b/src/saland/model/Player.hpp
new file mode 100644
index 0000000..403ead1
--- /dev/null
+++ b/src/saland/model/Player.hpp
@@ -0,0 +1,40 @@
+/*
+===========================================================================
+ * Saland Adventures
+Copyright (C) 2014-2019 Poul Sander
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see http://www.gnu.org/licenses/
+
+Source information and contacts persons can be found at
+https://github.com/sago007/saland
+===========================================================================
+*/
+
+#ifndef PLAYER_HPP
+#define PLAYER_HPP
+
+#include <string>
+
+struct Player {
+ Player() {};
+ std::string save_name="player1";
+ std::string get_visible_race() {return "female";}
+ std::string get_visible_hair() {return "hair_1";}
+ std::string get_visible_bottom() {return "pants_1";}
+ std::string get_visible_top(){return "pirate_shirt_sky";}
+ std::string get_visibla_hat(){ return "";}
+ std::string get_visible_shoes(){ return "";}
+};
+
+#endif //PLAYER_HPP
\ No newline at end of file