-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: persistence of search options and editor level
- Loading branch information
1 parent
773a8e7
commit 585196b
Showing
6 changed files
with
132 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "context.hpp" | ||
|
||
context::context() | ||
: m_editor_level(32, 32), | ||
m_query({ .cursor = -1, .query = "", .matchTitle = true, .matchDescription = true, .sortBy = "id", .order = "desc" }) { | ||
} | ||
|
||
level& context::editor_level() { | ||
return m_editor_level; | ||
} | ||
|
||
const level& context::editor_level() const { | ||
return m_editor_level; | ||
} | ||
|
||
api::search_query& context::search_query() { | ||
return m_query; | ||
} | ||
|
||
const api::search_query& context::search_query() const { | ||
return m_query; | ||
} | ||
|
||
context& context::get() { | ||
static context instance; | ||
return instance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include "api.hpp" | ||
#include "level.hpp" | ||
#include "tilemap.hpp" | ||
|
||
/* manages app context / global state */ | ||
class context { | ||
public: | ||
static context& get(); | ||
|
||
// level currently in the editor | ||
level& editor_level(); | ||
const level& editor_level() const; | ||
|
||
api::search_query& search_query(); | ||
const api::search_query& search_query() const; | ||
|
||
private: | ||
context(); | ||
context(const context&) = delete; | ||
context(context&&) = delete; | ||
|
||
level m_editor_level; | ||
api::search_query m_query; | ||
}; |
Oops, something went wrong.