48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
// Copyright (c) 2023 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "util/XmlParser.hpp"
|
|
#include "util/CodeGen.hpp"
|
|
|
|
namespace Dawn {
|
|
struct PauseEventInfo {
|
|
std::string duration;
|
|
std::string include;
|
|
};
|
|
|
|
class PauseEventParser : public XmlParser<struct PauseEventInfo> {
|
|
protected:
|
|
std::vector<std::string> getRequiredAttributes() {
|
|
return std::vector<std::string>{ "duration" };
|
|
}
|
|
|
|
std::map<std::string, std::string> getOptionalAttributes() {
|
|
return std::map<std::string, std::string>();
|
|
}
|
|
|
|
int32_t onParse(
|
|
Xml *node,
|
|
std::map<std::string, std::string> values,
|
|
struct PauseEventInfo *out,
|
|
std::string *error
|
|
) {
|
|
out->duration = parseDuration(values["duration"]);
|
|
out->include = "visualnovel/events/timing/VisualNovelPauseEvent.hpp";
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
class PauseEventGen : public CodeGen {
|
|
public:
|
|
static void generate(
|
|
std::vector<std::string> *out,
|
|
struct PauseEventInfo *info,
|
|
std::string tabs = ""
|
|
) {
|
|
line(out, "new VisualNovelPauseEvent(vnManager, " + info->duration + ")", tabs);
|
|
}
|
|
};
|
|
} |