mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
Add color fade
This commit is contained in:
@@ -503,12 +503,6 @@ void GetMouse(Window *window, Point *point)
|
||||
point->v = relativePos.m_y;
|
||||
}
|
||||
|
||||
Boolean Button()
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return false;
|
||||
}
|
||||
|
||||
Boolean StillDown()
|
||||
{
|
||||
return PortabilityLayer::InputManager::GetInstance()->GetKeys()->m_mouse.Get(GpMouseButtons::kLeft);
|
||||
|
@@ -110,6 +110,13 @@ namespace PortabilityLayer
|
||||
static const RGBAColor kLightColor;
|
||||
};
|
||||
|
||||
struct WindowEffects
|
||||
{
|
||||
WindowEffects();
|
||||
|
||||
float m_desaturationLevel;
|
||||
};
|
||||
|
||||
class WindowImpl final : public Window
|
||||
{
|
||||
public:
|
||||
@@ -140,7 +147,12 @@ namespace PortabilityLayer
|
||||
void SetTitle(const PLPasStr &str);
|
||||
const PascalStr<255> &GetTitle() const;
|
||||
|
||||
WindowEffects &GetEffects();
|
||||
const WindowEffects &GetEffects() const;
|
||||
|
||||
private:
|
||||
WindowEffects m_effects;
|
||||
|
||||
WindowImpl *m_windowAbove;
|
||||
WindowImpl *m_windowBelow;
|
||||
|
||||
@@ -175,6 +187,8 @@ namespace PortabilityLayer
|
||||
void FlickerWindowIn(Window *window, int32_t velocity) override;
|
||||
void FlickerWindowOut(Window *window, int32_t velocity) override;
|
||||
|
||||
void SetWindowDesaturation(Window *window, float desaturationLevel) override;
|
||||
|
||||
void SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size) override;
|
||||
void ClearResizeInProgress() override;
|
||||
|
||||
@@ -786,6 +800,12 @@ namespace PortabilityLayer
|
||||
surface->FillRect(Rect::Create(rect.top, rect.right - 4, rect.bottom, rect.right - 2), midColor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
WindowEffects::WindowEffects()
|
||||
: m_desaturationLevel(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
WindowImpl::WindowImpl()
|
||||
: m_windowAbove(nullptr)
|
||||
@@ -974,6 +994,18 @@ namespace PortabilityLayer
|
||||
return m_title;
|
||||
}
|
||||
|
||||
WindowEffects &WindowImpl::GetEffects()
|
||||
{
|
||||
return m_effects;
|
||||
}
|
||||
|
||||
const WindowEffects &WindowImpl::GetEffects() const
|
||||
{
|
||||
return m_effects;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WindowManagerImpl::WindowManagerImpl()
|
||||
: m_windowStackTop(nullptr)
|
||||
, m_windowStackBottom(nullptr)
|
||||
@@ -1318,6 +1350,12 @@ namespace PortabilityLayer
|
||||
m_flickerWindow = nullptr;
|
||||
}
|
||||
|
||||
|
||||
void WindowManagerImpl::SetWindowDesaturation(Window *window, float desaturationLevel)
|
||||
{
|
||||
static_cast<WindowImpl*>(window)->GetEffects().m_desaturationLevel = desaturationLevel;
|
||||
}
|
||||
|
||||
void WindowManagerImpl::SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size)
|
||||
{
|
||||
ResolveCachingColor blackColor = StdColors::Black();
|
||||
@@ -1500,6 +1538,8 @@ namespace PortabilityLayer
|
||||
if (m_exclusiveWindow != nullptr && m_exclusiveWindow != window)
|
||||
effects.m_darken = true;
|
||||
|
||||
effects.m_desaturation = window->GetEffects().m_desaturationLevel;
|
||||
|
||||
bool hasFlicker = (m_flickerWindow == window);
|
||||
|
||||
DrawSurface &graf = *window->GetDrawSurface();
|
||||
|
@@ -41,6 +41,8 @@ namespace PortabilityLayer
|
||||
virtual void FlickerWindowIn(Window *window, int32_t velocity) = 0;
|
||||
virtual void FlickerWindowOut(Window *window, int32_t velocity) = 0;
|
||||
|
||||
virtual void SetWindowDesaturation(Window *window, float desaturationLevel) = 0;
|
||||
|
||||
virtual void SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size) = 0;
|
||||
virtual void ClearResizeInProgress() = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user