Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5731: Start setting up colour schemes for the texture tool.
Since this is supposed to be switched on a per-texture basis, I won't be tying this to the regular colour schemes used for the rest of the views.
- Loading branch information
1 parent
09d43a7
commit ab075a9
Showing
7 changed files
with
101 additions
and
0 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,42 @@ | ||
#pragma once | ||
|
||
#include "imodule.h" | ||
#include "render/Colour4b.h" | ||
|
||
namespace textool | ||
{ | ||
|
||
enum class ColourScheme | ||
{ | ||
Light, | ||
Dark, | ||
Colourful, | ||
}; | ||
|
||
enum class SchemeElement | ||
{ | ||
MinorGrid, | ||
MajorGrid, | ||
}; | ||
|
||
class IColourSchemeManager : | ||
public RegisterableModule | ||
{ | ||
public: | ||
virtual ~IColourSchemeManager() {} | ||
|
||
// Activates the given scheme | ||
virtual void setActiveScheme(ColourScheme scheme) = 0; | ||
|
||
virtual Colour4b getColour(SchemeElement element) = 0; | ||
}; | ||
|
||
} | ||
|
||
constexpr const char* const MODULE_TEXTOOL_COLOURSCHEME_MANAGER("TextureToolColourSchemeManager"); | ||
|
||
inline textool::IColourSchemeManager& GlobalTextureToolColourSchemeManager() | ||
{ | ||
static module::InstanceReference<textool::IColourSchemeManager> _reference(MODULE_TEXTOOL_COLOURSCHEME_MANAGER); | ||
return _reference; | ||
} |
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
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
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,52 @@ | ||
#include "itexturetoolcolours.h" | ||
|
||
#include <map> | ||
|
||
namespace textool | ||
{ | ||
|
||
class ColourSchemeManager final : | ||
public IColourSchemeManager | ||
{ | ||
private: | ||
using SchemeMap = std::map<SchemeElement, Colour4b>; | ||
std::map<ColourScheme, SchemeMap> _schemes; | ||
|
||
ColourScheme _activeScheme; | ||
|
||
public: | ||
const std::string& getName() const override | ||
{ | ||
static std::string _name(MODULE_TEXTOOL_COLOURSCHEME_MANAGER); | ||
return _name; | ||
} | ||
|
||
const StringSet& getDependencies() const override | ||
{ | ||
static StringSet _dependencies; | ||
return _dependencies; | ||
} | ||
|
||
void initialiseModule(const IApplicationContext& ctx) override | ||
{ | ||
_activeScheme = ColourScheme::Light; | ||
|
||
// Fill in the default scheme values | ||
_schemes[ColourScheme::Dark] = SchemeMap | ||
{ | ||
{ SchemeElement::MajorGrid, { 0, 0, 0, 0 } } | ||
}; | ||
} | ||
|
||
void setActiveScheme(ColourScheme scheme) | ||
{ | ||
_activeScheme = scheme; | ||
} | ||
|
||
Colour4b getColour(SchemeElement element) | ||
{ | ||
return _schemes[_activeScheme][element]; | ||
} | ||
}; | ||
|
||
} |
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
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
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