mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-15 20:42:40 +00:00
Add some comments to GfxMode / CurrentGfxModeGuard.
This commit is contained in:
parent
955ec830cc
commit
7a099e23f9
@ -19,6 +19,7 @@
|
||||
#ifndef GFXMODE_H_INCLUDED
|
||||
#define GFXMODE_H_INCLUDED
|
||||
|
||||
// Holds settings about a graphics mode.
|
||||
class GfxMode
|
||||
{
|
||||
public:
|
||||
@ -46,19 +47,40 @@ private:
|
||||
int m_scaling;
|
||||
};
|
||||
|
||||
// Tries a new graphics mode, and restores it back in the
|
||||
// destructor. If the keep() method is used, the mode is not
|
||||
// restored.
|
||||
class CurrentGfxModeGuard
|
||||
{
|
||||
public:
|
||||
// Saves the current graphics mode as "the original" one.
|
||||
CurrentGfxModeGuard();
|
||||
|
||||
// Restores the graphics mode to its original in case we have used
|
||||
// tryGfxMode() and we did not call keep(). After calling keep(),
|
||||
// this destructor will do just nothing.
|
||||
~CurrentGfxModeGuard();
|
||||
|
||||
// Changes the current graphics mode. Returns true if the mode was
|
||||
// changed successfully. If the function cannot change the new mode
|
||||
// and cannot restore the original one, it finishes the program
|
||||
// (with exit()).
|
||||
bool tryGfxMode(const GfxMode& newMode);
|
||||
|
||||
// Keeps the last graphics mode set with tryGfxMode(). Indicates
|
||||
// that the destructor should not restore the graphics mode to the
|
||||
// original one.
|
||||
void keep();
|
||||
|
||||
// It is the original graphics mode configured when the constructor
|
||||
// of this class was called.
|
||||
const GfxMode& getOriginal() const;
|
||||
|
||||
private:
|
||||
// The original gfx mode.
|
||||
GfxMode m_oldMode;
|
||||
|
||||
// True if we should keep any mode set with tryGfxMode() method.
|
||||
bool m_keep;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user