mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-01 07:40:18 -04:00
add clearLogs and virtual destructor to logs
This commit is contained in:
parent
cb3a610407
commit
da998694a0
4 changed files with 13 additions and 2 deletions
loader
|
@ -174,6 +174,8 @@ namespace geode {
|
|||
std::vector<log::Log*> getLogs(
|
||||
std::initializer_list<Severity> severityFilter = {}
|
||||
);
|
||||
|
||||
void clearLogs();
|
||||
|
||||
/**
|
||||
* You shouldn't be calling this manually,
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace geode {
|
|||
std::string generateLogName();
|
||||
|
||||
struct GEODE_DLL ComponentTrait {
|
||||
virtual ~ComponentTrait() = 0;
|
||||
virtual std::string _toString() = 0;
|
||||
};
|
||||
|
||||
|
@ -45,6 +46,7 @@ namespace geode {
|
|||
template <typename T>
|
||||
struct ComponentBase : public ComponentTrait {
|
||||
T m_item;
|
||||
inline ~ComponentBase() override {}
|
||||
inline ComponentBase(T const& item) : m_item(item) {}
|
||||
// specialization must implement
|
||||
inline std::string _toString() override { return parse(m_item); }
|
||||
|
|
|
@ -210,8 +210,7 @@ class $modify(CustomMenuLayer, MenuLayer) {
|
|||
}
|
||||
|
||||
auto y = getChild(bottomMenu, 0)->getPositionY();
|
||||
std::cout << "test: " << "geode-logo-outline-gold.png"_spr << std::endl;
|
||||
|
||||
|
||||
g_geodeButton = SafeCreate<CCSprite>()
|
||||
.with(CircleButtonSprite::createWithSpriteFrameName(
|
||||
"geode-logo-outline-gold.png"_spr,
|
||||
|
|
|
@ -385,6 +385,7 @@ void Loader::popLog(log::Log* log) {
|
|||
}
|
||||
}*/
|
||||
utils::vector::erase(m_logs, *log);
|
||||
delete log;
|
||||
}
|
||||
|
||||
std::vector<log::Log*> Loader::getLogs(
|
||||
|
@ -403,6 +404,13 @@ std::vector<log::Log*> Loader::getLogs(
|
|||
return logs;
|
||||
}
|
||||
|
||||
void Loader::clearLogs() {
|
||||
for (auto log : m_logs) {
|
||||
delete log;
|
||||
}
|
||||
m_logs.clear();
|
||||
}
|
||||
|
||||
void Loader::queueInGDThread(ScheduledFunction func) {
|
||||
InternalLoader::get()->queueInGDThread(func);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue