talking carrot + super arguments
This commit is contained in:
parent
c8787846c3
commit
8b664a26ef
6 changed files with 98 additions and 7 deletions
34
SimpleGame/src/Include/Arguments.hpp
Normal file
34
SimpleGame/src/Include/Arguments.hpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
// Pour un projet propre, faire un parser .txt ou .json
|
||||
|
||||
static std::vector<std::string> BAD_ARGUMENTS = {
|
||||
"JE HAIS LES BROCOLLIS,\nFUCK L'AGRICULTURE",
|
||||
"L'agriculture c'est\nun truc de bobo vegan",
|
||||
"Agriculture = nature = bio\n paix et amour.",
|
||||
"Les tracteurs c'est cool!\nJ'ai pas raison la team ?",
|
||||
"De tout temps l'homme...",
|
||||
"Pas d'agriculture, pas de frites...",
|
||||
"Sans l'Agriculture, pas de C++\nAttends du coup c'est bien ou pas ??",
|
||||
"Y'a pas de bonheur sans beurre",
|
||||
};
|
||||
|
||||
static std::vector<std::string> NEUTRAL_ARGUMENTS = {
|
||||
"L'agriculture a permis les villages,\ndonc c'est un progres, non?",
|
||||
"Ok y'a des guerres pour les terres,\nmais ca fait parti du jeu",
|
||||
"Au moins, maintenant on peut\nmanger des fraises en hiver",
|
||||
"C'est vrai qu'on est plus nombreux,\nmais plus on est nombreux plus on rit",
|
||||
"Ok mais sans ble, pas de biere,\npas de pain, la vie est triste"};
|
||||
|
||||
static std::vector<std::string> GOOD_ARGUMENTS = {
|
||||
"On est passe de la liberte nomade\n a l'esclavage des recoltes",
|
||||
"Avant l'agricultre on bossait 4h par jour.\nMaintenant ? 40h/semaine",
|
||||
"L'Agriculture a permis la naissances\ndes sciences, des arts et de l'ecriture",
|
||||
"La revolution agricole,\nc'est aussi la revolution des inegalites.",
|
||||
"Sans agriculture,\npas de retraite pour Mr Simatic !",
|
||||
};
|
||||
|
||||
// clang-format on
|
|
@ -1,5 +1,8 @@
|
|||
#include "AnimatedSprite.hpp"
|
||||
#include <SFML/Graphics/Color.hpp>
|
||||
#include <SFML/Graphics/Font.hpp>
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <SFML/Graphics/Text.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -13,15 +16,29 @@ private:
|
|||
AnimatedSprite angryAnimation;
|
||||
CarrotState carrotState;
|
||||
|
||||
std::vector<std::string> goodArguments;
|
||||
std::vector<std::string> neutralArguments;
|
||||
std::vector<std::string> badArguments;
|
||||
|
||||
sf::Text carrotText;
|
||||
float timePerText = 4;
|
||||
float timeBuffer = 0;
|
||||
|
||||
public:
|
||||
Carrot(const std::vector<std::string> &angry_paths,
|
||||
const std::vector<std::string> &neutral_paths,
|
||||
const std::vector<std::string> &happy_paths);
|
||||
const std::vector<std::string> &happy_paths, sf::Font &mFont);
|
||||
|
||||
void draw(sf::RenderWindow &RenderWindow, float dtime);
|
||||
void setPosition(sf::Vector2f);
|
||||
// clang-format off
|
||||
void setTextPosition(sf::Vector2f textPos) {carrotText.setPosition(textPos);};
|
||||
void setTextCharacterSize(unsigned int chrSize) {carrotText.setCharacterSize(chrSize);}
|
||||
void setTextFillColor(sf::Color textColor){carrotText.setFillColor(textColor);};
|
||||
// clang-format on
|
||||
void setScale(sf::Vector2f);
|
||||
void changeState(CarrotState new_state);
|
||||
void handleText(sf::RenderWindow &RenderWindow, float dtime);
|
||||
|
||||
CarrotState getState() const { return carrotState; };
|
||||
};
|
||||
|
|
|
@ -17,6 +17,10 @@ static constexpr unsigned int FLOWER_SIZE = SCREEN_WIDTH * 0.05;
|
|||
static const sf::Vector2f CARROT_POS =
|
||||
sf::Vector2f(SCREEN_WIDTH * 9 / 20, SCREEN_HEIGHT * 0.4);
|
||||
|
||||
static const sf::Vector2f CARROT_TEXT_POS = sf::Vector2f(
|
||||
CARROT_POS.x + SCREEN_WIDTH * 0.05f, CARROT_POS.y - SCREEN_HEIGHT * 0.2f);
|
||||
/*CARROT_POS + sf::Vector2f(0, -SCREEN_HEIGHT * 0.4);*/
|
||||
|
||||
// Texture2D seems big export I don't want to include it
|
||||
namespace sf {
|
||||
class Texture;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue