Text navigation for visual novel added.

This commit is contained in:
2023-11-28 19:12:31 -06:00
parent a7f13e0077
commit 88bafaec3f
5 changed files with 58 additions and 6 deletions
+23
View File
@@ -39,17 +39,32 @@ SUCH DAMAGE.
class VisualNovel;
namespace CommandType{
enum CommandType{
PAUSE,
DIALOG,
SPEAKER,
BACKGROUND,
RIGHT,
LEFT,
LOCATION
};
}
class Command{
friend class VisualNovel;
virtual void Execute(VisualNovel&vn)=0;
protected:
Command();
public:
virtual CommandType::CommandType GetType()=0;
};
class PauseCommand final:public Command{
public:
void Execute(VisualNovel&vn)override;
PauseCommand();
CommandType::CommandType GetType()final override;
};
class DialogCommand final:public Command{
@@ -57,6 +72,7 @@ class DialogCommand final:public Command{
public:
void Execute(VisualNovel&vn)override;
DialogCommand(std::string dialog);
CommandType::CommandType GetType()final override;
};
class SpeakerCommand final:public Command{
@@ -66,6 +82,7 @@ public:
void Execute(VisualNovel&vn)override;
SpeakerCommand(std::string speaker);
SpeakerCommand(std::string displayedName,std::string speaker);
CommandType::CommandType GetType()final override;
};
class BackgroundCommand final:public Command{
@@ -73,6 +90,7 @@ class BackgroundCommand final:public Command{
public:
void Execute(VisualNovel&vn)override;
BackgroundCommand(std::string backgroundFilename);
CommandType::CommandType GetType()final override;
};
class RightCommand final:public Command{
@@ -80,6 +98,7 @@ class RightCommand final:public Command{
public:
void Execute(VisualNovel&vn)override;
RightCommand(std::vector<std::string>characters);
CommandType::CommandType GetType()final override;
};
class LeftCommand final:public Command{
@@ -87,6 +106,7 @@ class LeftCommand final:public Command{
public:
void Execute(VisualNovel&vn)override;
LeftCommand(std::vector<std::string>characters);
CommandType::CommandType GetType()final override;
};
class LocationCommand final:public Command{
@@ -94,6 +114,7 @@ class LocationCommand final:public Command{
public:
void Execute(VisualNovel&vn)override;
LocationCommand(std::string location);
CommandType::CommandType GetType()final override;
};
class VisualNovel{
@@ -114,6 +135,8 @@ class VisualNovel{
std::vector<std::string>leftCharacters;
std::vector<std::string>rightCharacters;
std::string backgroundFilename;
std::string prevBackgroundFilename;
float transitionTime=0;
std::vector<Command*>commands;
int commandIndex=0;
std::string locationDisplayText="";