mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Add flicker effect to chrome (replaces zooms)
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
#include "RectUtils.h"
|
#include "RectUtils.h"
|
||||||
#include "Room.h"
|
#include "Room.h"
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
#include "WindowDef.h"
|
||||||
|
#include "WindowManager.h"
|
||||||
|
|
||||||
|
|
||||||
#define kBannerPageTopPICT 1993
|
#define kBannerPageTopPICT 1993
|
||||||
@@ -196,23 +198,32 @@ void BringUpBanner (void)
|
|||||||
// in a house. It comes up when the player gets a star (the game is paused<65>
|
// in a house. It comes up when the player gets a star (the game is paused<65>
|
||||||
// and the user informed as to how many remain).
|
// and the user informed as to how many remain).
|
||||||
|
|
||||||
void DisplayStarsRemaining (void)
|
void DisplayStarsRemaining(void)
|
||||||
{
|
{
|
||||||
Rect src, bounds;
|
Rect src, bounds;
|
||||||
Str255 theStr;
|
Str255 theStr;
|
||||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
|
||||||
|
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||||
|
|
||||||
QSetRect(&bounds, 0, 0, 256, 64);
|
QSetRect(&bounds, 0, 0, 256, 64);
|
||||||
CenterRectInRect(&bounds, &thisMac.fullScreen);
|
CenterRectInRect(&bounds, &thisMac.fullScreen);
|
||||||
QOffsetRect(&bounds, -thisMac.fullScreen.left, -thisMac.fullScreen.top);
|
QOffsetRect(&bounds, -thisMac.fullScreen.left, -thisMac.fullScreen.top);
|
||||||
src = bounds;
|
QOffsetRect(&bounds, 0, -20);
|
||||||
InsetRect(&src, 64, 32);
|
|
||||||
|
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(bounds, 0, true, 0, 0, PSTR(""));
|
||||||
|
|
||||||
|
// Zero out
|
||||||
|
QOffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||||
|
|
||||||
|
Window *starsWindow = wm->CreateWindow(wdef);
|
||||||
|
wm->PutWindowBehind(starsWindow, wm->GetPutInFrontSentinel());
|
||||||
|
|
||||||
|
DrawSurface *surface = starsWindow->GetDrawSurface();
|
||||||
|
|
||||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||||
|
|
||||||
NumToString((long)numStarsRemaining, theStr);
|
NumToString((long)numStarsRemaining, theStr);
|
||||||
|
|
||||||
QOffsetRect(&bounds, 0, -20);
|
|
||||||
if (numStarsRemaining < 2)
|
if (numStarsRemaining < 2)
|
||||||
LoadScaledGraphic(surface, kStarRemainingPICT, &bounds);
|
LoadScaledGraphic(surface, kStarRemainingPICT, &bounds);
|
||||||
else
|
else
|
||||||
@@ -221,10 +232,16 @@ void DisplayStarsRemaining (void)
|
|||||||
const Point textPoint = Point::Create(bounds.left + 102 - (surface->MeasureString(theStr) / 2), bounds.top + 23);
|
const Point textPoint = Point::Create(bounds.left + 102 - (surface->MeasureString(theStr) / 2), bounds.top + 23);
|
||||||
ColorText(surface, textPoint, theStr, 4L);
|
ColorText(surface, textPoint, theStr, 4L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doZooms)
|
||||||
|
wm->FlickerWindowIn(starsWindow, 32);
|
||||||
|
|
||||||
DelayTicks(60);
|
DelayTicks(60);
|
||||||
if (WaitForInputEvent(30))
|
WaitForInputEvent(30);
|
||||||
RestoreEntireGameScreen();
|
|
||||||
CopyRectWorkToMain(&bounds);
|
if (doZooms)
|
||||||
|
wm->FlickerWindowOut(starsWindow, 32);
|
||||||
|
|
||||||
|
wm->DestroyWindow(starsWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
#include "PLTimeTaggedVOSEvent.h"
|
#include "PLTimeTaggedVOSEvent.h"
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
#include "WindowManager.h"
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
@@ -506,6 +507,8 @@ void GetHighScoreName (short place)
|
|||||||
Str255 scoreStr, placeStr, tempStr;
|
Str255 scoreStr, placeStr, tempStr;
|
||||||
short item;
|
short item;
|
||||||
Boolean leaving;
|
Boolean leaving;
|
||||||
|
|
||||||
|
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||||
|
|
||||||
InitCursor();
|
InitCursor();
|
||||||
NumToString(theScore, scoreStr);
|
NumToString(theScore, scoreStr);
|
||||||
@@ -522,6 +525,12 @@ void GetHighScoreName (short place)
|
|||||||
|
|
||||||
UpdateNameDialog(theDial);
|
UpdateNameDialog(theDial);
|
||||||
|
|
||||||
|
//Window *exclStack = theDial->GetWindow();
|
||||||
|
//wm->SwapExclusiveWindow(exclStack); // Push exclusive window for zooms
|
||||||
|
|
||||||
|
if (doZooms)
|
||||||
|
wm->FlickerWindowIn(theDial->GetWindow(), 64);
|
||||||
|
|
||||||
while (!leaving)
|
while (!leaving)
|
||||||
{
|
{
|
||||||
item = theDial->ExecuteModal(NameFilter);
|
item = theDial->ExecuteModal(NameFilter);
|
||||||
@@ -533,6 +542,9 @@ void GetHighScoreName (short place)
|
|||||||
leaving = true;
|
leaving = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doZooms)
|
||||||
|
wm->FlickerWindowOut(theDial->GetWindow(), 64);
|
||||||
|
|
||||||
theDial->Destroy();
|
theDial->Destroy();
|
||||||
}
|
}
|
||||||
@@ -610,6 +622,8 @@ void GetHighScoreBanner (void)
|
|||||||
Str255 tempStr;
|
Str255 tempStr;
|
||||||
short item;
|
short item;
|
||||||
Boolean leaving;
|
Boolean leaving;
|
||||||
|
|
||||||
|
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||||
|
|
||||||
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
PlayPrioritySound(kEnergizeSound, kEnergizePriority);
|
||||||
BringUpDialog(&theDial, kHighBannerDialogID, nullptr);
|
BringUpDialog(&theDial, kHighBannerDialogID, nullptr);
|
||||||
@@ -618,7 +632,10 @@ void GetHighScoreBanner (void)
|
|||||||
leaving = false;
|
leaving = false;
|
||||||
|
|
||||||
UpdateBannerDialog(theDial);
|
UpdateBannerDialog(theDial);
|
||||||
|
|
||||||
|
if (doZooms)
|
||||||
|
wm->FlickerWindowIn(theDial->GetWindow(), 64);
|
||||||
|
|
||||||
while (!leaving)
|
while (!leaving)
|
||||||
{
|
{
|
||||||
item = theDial->ExecuteModal(BannerFilter);
|
item = theDial->ExecuteModal(BannerFilter);
|
||||||
@@ -630,6 +647,9 @@ void GetHighScoreBanner (void)
|
|||||||
leaving = true;
|
leaving = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doZooms)
|
||||||
|
wm->FlickerWindowOut(theDial->GetWindow(), 64);
|
||||||
|
|
||||||
theDial->Destroy();
|
theDial->Destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,9 @@ void OpenMessageWindow (const PLPasStr &title)
|
|||||||
mssgWindowExclusiveStack = mssgWindow;
|
mssgWindowExclusiveStack = mssgWindow;
|
||||||
|
|
||||||
wm->SwapExclusiveWindow(mssgWindowExclusiveStack); // Push exclusive window
|
wm->SwapExclusiveWindow(mssgWindowExclusiveStack); // Push exclusive window
|
||||||
|
|
||||||
|
if (doZooms)
|
||||||
|
wm->FlickerWindowIn(mssgWindow, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- SetMessageWindowMessage
|
//-------------------------------------------------------------- SetMessageWindowMessage
|
||||||
@@ -166,7 +169,12 @@ void SetMessageWindowMessage (StringPtr message, const PortabilityLayer::RGBACol
|
|||||||
|
|
||||||
void CloseMessageWindow (void)
|
void CloseMessageWindow (void)
|
||||||
{
|
{
|
||||||
PortabilityLayer::WindowManager::GetInstance()->SwapExclusiveWindow(mssgWindowExclusiveStack); // Pop exclusive window
|
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||||
|
|
||||||
|
if (doZooms)
|
||||||
|
wm->FlickerWindowOut(mssgWindow, 32);
|
||||||
|
|
||||||
|
wm->SwapExclusiveWindow(mssgWindowExclusiveStack); // Pop exclusive window
|
||||||
assert(mssgWindowExclusiveStack == mssgWindow);
|
assert(mssgWindowExclusiveStack == mssgWindow);
|
||||||
|
|
||||||
mssgWindowExclusiveStack = nullptr;
|
mssgWindowExclusiveStack = nullptr;
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ struct GpDisplayDriverSurfaceEffects
|
|||||||
GpDisplayDriverSurfaceEffects();
|
GpDisplayDriverSurfaceEffects();
|
||||||
|
|
||||||
bool m_darken;
|
bool m_darken;
|
||||||
|
bool m_flicker;
|
||||||
|
int32_t m_flickerAxisX;
|
||||||
|
int32_t m_flickerAxisY;
|
||||||
|
int32_t m_flickerStartThreshold;
|
||||||
|
int32_t m_flickerEndThreshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display drivers are responsible for timing and calling the game tick function.
|
// Display drivers are responsible for timing and calling the game tick function.
|
||||||
@@ -38,5 +43,10 @@ public:
|
|||||||
|
|
||||||
inline GpDisplayDriverSurfaceEffects::GpDisplayDriverSurfaceEffects()
|
inline GpDisplayDriverSurfaceEffects::GpDisplayDriverSurfaceEffects()
|
||||||
: m_darken(false)
|
: m_darken(false)
|
||||||
{
|
, m_flicker(false)
|
||||||
|
, m_flickerAxisX(0)
|
||||||
|
, m_flickerAxisY(0)
|
||||||
|
, m_flickerStartThreshold(0)
|
||||||
|
, m_flickerEndThreshold(0)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
static unsigned char gs_shaderData[] = {
|
static unsigned char gs_shaderData[] = {
|
||||||
68, 88, 66, 67, 162, 86, 191, 155, 118, 151, 0, 3, 108, 83, 21,
|
68, 88, 66, 67, 16, 112, 155, 167, 152, 216, 111, 160, 194, 37, 151,
|
||||||
32, 68, 243, 178, 112, 1, 0, 0, 0, 176, 3, 0, 0, 5, 0,
|
206, 26, 38, 150, 132, 1, 0, 0, 0, 140, 5, 0, 0, 5, 0,
|
||||||
0, 0, 52, 0, 0, 0, 112, 1, 0, 0, 200, 1, 0, 0, 252,
|
0, 0, 52, 0, 0, 0, 48, 2, 0, 0, 136, 2, 0, 0, 188,
|
||||||
1, 0, 0, 52, 3, 0, 0, 82, 68, 69, 70, 52, 1, 0, 0,
|
2, 0, 0, 16, 5, 0, 0, 82, 68, 69, 70, 244, 1, 0, 0,
|
||||||
1, 0, 0, 0, 180, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0,
|
1, 0, 0, 0, 180, 0, 0, 0, 3, 0, 0, 0, 28, 0, 0,
|
||||||
0, 0, 4, 255, 255, 0, 137, 0, 0, 12, 1, 0, 0, 124, 0,
|
0, 0, 4, 255, 255, 0, 137, 0, 0, 202, 1, 0, 0, 124, 0,
|
||||||
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
|
0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 255,
|
||||||
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
|
255, 255, 255, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
|
||||||
139, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 2, 0, 0,
|
139, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 2, 0, 0,
|
||||||
@@ -15,53 +15,85 @@ static unsigned char gs_shaderData[] = {
|
|||||||
117, 114, 101, 0, 112, 97, 108, 101, 116, 116, 101, 84, 101, 120, 116,
|
117, 114, 101, 0, 112, 97, 108, 101, 116, 116, 101, 84, 101, 120, 116,
|
||||||
117, 114, 101, 0, 83, 68, 114, 97, 119, 81, 117, 97, 100, 80, 105,
|
117, 114, 101, 0, 83, 68, 114, 97, 119, 81, 117, 97, 100, 80, 105,
|
||||||
120, 101, 108, 67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 171, 171,
|
120, 101, 108, 67, 111, 110, 115, 116, 97, 110, 116, 115, 0, 171, 171,
|
||||||
154, 0, 0, 0, 1, 0, 0, 0, 204, 0, 0, 0, 16, 0, 0,
|
154, 0, 0, 0, 4, 0, 0, 0, 204, 0, 0, 0, 32, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 228, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 1, 0, 0, 0, 0,
|
||||||
0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 252, 0, 0, 0, 0,
|
0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 68, 1, 0, 0, 0,
|
||||||
0, 0, 0, 99, 111, 110, 115, 116, 97, 110, 116, 115, 95, 77, 111,
|
0, 0, 0, 84, 1, 0, 0, 16, 0, 0, 0, 8, 0, 0, 0,
|
||||||
100, 117, 108, 97, 116, 105, 111, 110, 0, 171, 171, 171, 1, 0, 3,
|
2, 0, 0, 0, 108, 1, 0, 0, 0, 0, 0, 0, 124, 1, 0,
|
||||||
0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 105,
|
0, 24, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 156, 1,
|
||||||
99, 114, 111, 115, 111, 102, 116, 32, 40, 82, 41, 32, 72, 76, 83,
|
0, 0, 0, 0, 0, 0, 172, 1, 0, 0, 28, 0, 0, 0, 4,
|
||||||
76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108,
|
0, 0, 0, 2, 0, 0, 0, 156, 1, 0, 0, 0, 0, 0, 0,
|
||||||
101, 114, 32, 49, 48, 46, 49, 0, 73, 83, 71, 78, 80, 0, 0,
|
99, 111, 110, 115, 116, 97, 110, 116, 115, 95, 77, 111, 100, 117, 108,
|
||||||
0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0,
|
97, 116, 105, 111, 110, 0, 171, 171, 171, 1, 0, 3, 0, 1, 0,
|
||||||
0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15,
|
4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115, 116,
|
||||||
0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
97, 110, 116, 115, 95, 70, 108, 105, 99, 107, 101, 114, 65, 120, 105,
|
||||||
3, 0, 0, 0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95,
|
115, 0, 171, 171, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0,
|
||||||
80, 79, 83, 73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79,
|
0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110, 116, 115, 95,
|
||||||
82, 68, 0, 171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1,
|
70, 108, 105, 99, 107, 101, 114, 83, 116, 97, 114, 116, 84, 104, 114,
|
||||||
0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
|
101, 115, 104, 111, 108, 100, 0, 0, 0, 2, 0, 1, 0, 1, 0,
|
||||||
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 99, 111, 110, 115, 116, 97, 110,
|
||||||
0, 83, 86, 95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72,
|
116, 115, 95, 70, 108, 105, 99, 107, 101, 114, 69, 110, 100, 84, 104,
|
||||||
68, 82, 48, 1, 0, 0, 64, 0, 0, 0, 76, 0, 0, 0, 89,
|
114, 101, 115, 104, 111, 108, 100, 0, 77, 105, 99, 114, 111, 115, 111,
|
||||||
0, 0, 4, 70, 142, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0,
|
102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
|
||||||
88, 24, 0, 4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0,
|
100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48,
|
||||||
0, 88, 16, 0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 85, 85,
|
46, 49, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0,
|
||||||
0, 0, 98, 16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101,
|
0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 1,
|
||||||
0, 0, 3, 242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2,
|
0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0,
|
||||||
1, 0, 0, 0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0,
|
68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
|
||||||
0, 70, 16, 16, 0, 1, 0, 0, 0, 27, 0, 0, 5, 50, 0,
|
0, 1, 0, 0, 0, 3, 3, 0, 0, 83, 86, 95, 80, 79, 83,
|
||||||
16, 0, 0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54,
|
73, 84, 73, 79, 78, 0, 84, 69, 88, 67, 79, 79, 82, 68, 0,
|
||||||
0, 0, 8, 194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
|
171, 171, 171, 79, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0,
|
||||||
|
8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 3, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 83, 86,
|
||||||
|
95, 84, 65, 82, 71, 69, 84, 0, 171, 171, 83, 72, 68, 82, 76,
|
||||||
|
2, 0, 0, 64, 0, 0, 0, 147, 0, 0, 0, 89, 0, 0, 4,
|
||||||
|
70, 142, 32, 0, 0, 0, 0, 0, 2, 0, 0, 0, 88, 24, 0,
|
||||||
|
4, 0, 112, 16, 0, 0, 0, 0, 0, 68, 68, 0, 0, 88, 16,
|
||||||
|
0, 4, 0, 112, 16, 0, 1, 0, 0, 0, 85, 85, 0, 0, 98,
|
||||||
|
16, 0, 3, 50, 16, 16, 0, 1, 0, 0, 0, 101, 0, 0, 3,
|
||||||
|
242, 32, 16, 0, 0, 0, 0, 0, 104, 0, 0, 2, 2, 0, 0,
|
||||||
|
0, 65, 0, 0, 5, 50, 0, 16, 0, 0, 0, 0, 0, 70, 16,
|
||||||
|
16, 0, 1, 0, 0, 0, 27, 0, 0, 5, 50, 0, 16, 0, 0,
|
||||||
|
0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8,
|
||||||
|
194, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0,
|
||||||
|
0, 7, 242, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 0,
|
||||||
|
0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 54, 0, 0, 8,
|
||||||
|
226, 0, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0,
|
||||||
|
0, 7, 242, 0, 16, 0, 1, 0, 0, 0, 70, 14, 16, 0, 1,
|
||||||
|
0, 0, 0, 70, 126, 16, 0, 1, 0, 0, 0, 54, 0, 0, 5,
|
||||||
|
130, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, 0, 0, 128,
|
||||||
|
63, 56, 0, 0, 8, 242, 0, 16, 0, 1, 0, 0, 0, 70, 14,
|
||||||
|
16, 0, 1, 0, 0, 0, 70, 142, 32, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 38, 0, 0, 9, 0, 208, 0, 0, 50, 0, 16, 0,
|
||||||
|
0, 0, 0, 0, 70, 0, 16, 0, 0, 0, 0, 0, 70, 128, 32,
|
||||||
|
0, 0, 0, 0, 0, 1, 0, 0, 0, 30, 0, 0, 7, 18, 0,
|
||||||
|
16, 0, 0, 0, 0, 0, 26, 0, 16, 0, 0, 0, 0, 0, 10,
|
||||||
|
0, 16, 0, 0, 0, 0, 0, 34, 0, 0, 8, 34, 0, 16, 0,
|
||||||
|
0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 42, 128, 32,
|
||||||
|
0, 0, 0, 0, 0, 1, 0, 0, 0, 33, 0, 0, 8, 18, 0,
|
||||||
|
16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 58,
|
||||||
|
128, 32, 0, 0, 0, 0, 0, 1, 0, 0, 0, 55, 0, 0, 12,
|
||||||
|
242, 0, 16, 0, 1, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0,
|
||||||
|
0, 70, 14, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0, 0, 0,
|
||||||
|
128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 55,
|
||||||
|
0, 0, 12, 242, 0, 16, 0, 0, 0, 0, 0, 86, 5, 16, 0,
|
||||||
|
0, 0, 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 14, 16, 0, 1, 0,
|
||||||
|
0, 0, 29, 0, 0, 7, 18, 0, 16, 0, 1, 0, 0, 0, 1,
|
||||||
|
64, 0, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0,
|
||||||
|
13, 0, 4, 3, 10, 0, 16, 0, 1, 0, 0, 0, 54, 0, 0,
|
||||||
|
5, 242, 32, 16, 0, 0, 0, 0, 0, 70, 14, 16, 0, 0, 0,
|
||||||
|
0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116, 0, 0, 0, 18,
|
||||||
|
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
|
||||||
|
3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 45, 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
|
||||||
16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 54,
|
|
||||||
0, 0, 8, 226, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 45, 0, 0, 7, 242, 0, 16, 0, 0, 0, 0, 0, 70, 14,
|
4, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
|
||||||
16, 0, 0, 0, 0, 0, 70, 126, 16, 0, 1, 0, 0, 0, 54,
|
|
||||||
0, 0, 5, 130, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0,
|
|
||||||
0, 0, 128, 63, 56, 0, 0, 8, 242, 32, 16, 0, 0, 0, 0,
|
|
||||||
0, 70, 14, 16, 0, 0, 0, 0, 0, 70, 142, 32, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 62, 0, 0, 1, 83, 84, 65, 84, 116,
|
|
||||||
0, 0, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace GpBinarizedShaders
|
namespace GpBinarizedShaders
|
||||||
|
|||||||
@@ -1078,6 +1078,20 @@ void GpDisplayDriverD3D11::DrawSurface(IGpDisplayDriverSurface *surface, int32_t
|
|||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
pConstantsData.m_modulation[i] = 1.0f;
|
pConstantsData.m_modulation[i] = 1.0f;
|
||||||
|
|
||||||
|
if (effects->m_flicker)
|
||||||
|
{
|
||||||
|
pConstantsData.m_flickerAxis[0] = effects->m_flickerAxisX;
|
||||||
|
pConstantsData.m_flickerAxis[1] = effects->m_flickerAxisY;
|
||||||
|
pConstantsData.m_flickerStart = effects->m_flickerStartThreshold;
|
||||||
|
pConstantsData.m_flickerEnd = effects->m_flickerEndThreshold;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pConstantsData.m_flickerAxis[0] = pConstantsData.m_flickerAxis[1] = 0;
|
||||||
|
pConstantsData.m_flickerEnd = -1;
|
||||||
|
pConstantsData.m_flickerStart = -2;
|
||||||
|
}
|
||||||
|
|
||||||
if (effects->m_darken)
|
if (effects->m_darken)
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
pConstantsData.m_modulation[i] = 0.5f;
|
pConstantsData.m_modulation[i] = 0.5f;
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ private:
|
|||||||
struct DrawQuadPixelConstants
|
struct DrawQuadPixelConstants
|
||||||
{
|
{
|
||||||
float m_modulation[4];
|
float m_modulation[4];
|
||||||
|
|
||||||
|
int32_t m_flickerAxis[2];
|
||||||
|
int32_t m_flickerStart;
|
||||||
|
int32_t m_flickerEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScaleQuadPixelConstants
|
struct ScaleQuadPixelConstants
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "PLCore.h"
|
#include "PLCore.h"
|
||||||
#include "PLEventQueue.h"
|
#include "PLEventQueue.h"
|
||||||
#include "PLStandardColors.h"
|
#include "PLStandardColors.h"
|
||||||
|
#include "PLSysCalls.h"
|
||||||
#include "FontFamily.h"
|
#include "FontFamily.h"
|
||||||
#include "MemoryManager.h"
|
#include "MemoryManager.h"
|
||||||
#include "MenuManager.h"
|
#include "MenuManager.h"
|
||||||
@@ -168,6 +169,9 @@ namespace PortabilityLayer
|
|||||||
bool GetWindowChromeInteractionZone(Window *window, const Vec2i &point, RegionID_t &outRegion) const override;
|
bool GetWindowChromeInteractionZone(Window *window, const Vec2i &point, RegionID_t &outRegion) const override;
|
||||||
void SwapExclusiveWindow(Window *& windowRef) override;
|
void SwapExclusiveWindow(Window *& windowRef) override;
|
||||||
|
|
||||||
|
void FlickerWindowIn(Window *window, int32_t velocity) override;
|
||||||
|
void FlickerWindowOut(Window *window, int32_t velocity) override;
|
||||||
|
|
||||||
void SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size) override;
|
void SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size) override;
|
||||||
void ClearResizeInProgress() override;
|
void ClearResizeInProgress() override;
|
||||||
|
|
||||||
@@ -185,11 +189,20 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
void ResetResizeInProgressSurfaces();
|
void ResetResizeInProgressSurfaces();
|
||||||
|
|
||||||
|
void ComputeFlickerEffects(const Vec2i &windowUpperLeft, int32_t offset, GpDisplayDriverSurfaceEffects &effects) const;
|
||||||
|
|
||||||
WindowImpl *m_windowStackTop;
|
WindowImpl *m_windowStackTop;
|
||||||
WindowImpl *m_windowStackBottom;
|
WindowImpl *m_windowStackBottom;
|
||||||
|
|
||||||
WindowImpl *m_exclusiveWindow;
|
WindowImpl *m_exclusiveWindow;
|
||||||
|
|
||||||
|
WindowImpl *m_flickerWindow;
|
||||||
|
Vec2i m_flickerBasisCoordinate;
|
||||||
|
Vec2i m_flickerAxis;
|
||||||
|
int32_t m_flickerZoneSize;
|
||||||
|
int32_t m_flickerBasisCoordinateDistance;
|
||||||
|
int32_t m_flickerChromeDistanceOffset;
|
||||||
|
|
||||||
Rect2i m_resizeInProgressRect;
|
Rect2i m_resizeInProgressRect;
|
||||||
DrawSurface m_resizeInProgressHorizontalBar;
|
DrawSurface m_resizeInProgressHorizontalBar;
|
||||||
DrawSurface m_resizeInProgressVerticalBar;
|
DrawSurface m_resizeInProgressVerticalBar;
|
||||||
@@ -941,6 +954,12 @@ namespace PortabilityLayer
|
|||||||
, m_resizeInProgressRect(Rect2i(0, 0, 0, 0))
|
, m_resizeInProgressRect(Rect2i(0, 0, 0, 0))
|
||||||
, m_isResizeInProgress(false)
|
, m_isResizeInProgress(false)
|
||||||
, m_exclusiveWindow(nullptr)
|
, m_exclusiveWindow(nullptr)
|
||||||
|
, m_flickerWindow(nullptr)
|
||||||
|
, m_flickerBasisCoordinate(0, 0)
|
||||||
|
, m_flickerAxis(0, 0)
|
||||||
|
, m_flickerZoneSize(0)
|
||||||
|
, m_flickerBasisCoordinateDistance(0)
|
||||||
|
, m_flickerChromeDistanceOffset(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1214,6 +1233,64 @@ namespace PortabilityLayer
|
|||||||
windowRef = temp;
|
windowRef = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManagerImpl::FlickerWindowIn(Window *window, int32_t velocity)
|
||||||
|
{
|
||||||
|
m_flickerWindow = static_cast<WindowImpl*>(window);
|
||||||
|
|
||||||
|
int32_t chromeLead = 64;
|
||||||
|
int32_t flickerZoneSize = 128;
|
||||||
|
|
||||||
|
const Rect windowRect = window->GetDrawSurface()->m_port.GetRect();
|
||||||
|
|
||||||
|
Vec2i topLeft = Vec2i(m_flickerWindow->m_wmX, m_flickerWindow->m_wmY);
|
||||||
|
Vec2i dimensions = Vec2i(windowRect.Width(), windowRect.Height());
|
||||||
|
|
||||||
|
m_flickerAxis = Vec2i(1, 1);
|
||||||
|
m_flickerZoneSize = flickerZoneSize;
|
||||||
|
m_flickerBasisCoordinate = topLeft + dimensions;
|
||||||
|
m_flickerBasisCoordinateDistance = -chromeLead;
|
||||||
|
m_flickerChromeDistanceOffset = chromeLead;
|
||||||
|
|
||||||
|
int32_t axisLength = m_flickerAxis.m_x * dimensions.m_x + m_flickerAxis.m_y * dimensions.m_y;
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < axisLength + chromeLead + flickerZoneSize; i += velocity)
|
||||||
|
{
|
||||||
|
m_flickerBasisCoordinateDistance += velocity;
|
||||||
|
PLSysCalls::Sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_flickerWindow = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowManagerImpl::FlickerWindowOut(Window *window, int32_t velocity)
|
||||||
|
{
|
||||||
|
m_flickerWindow = static_cast<WindowImpl*>(window);
|
||||||
|
|
||||||
|
int32_t chromeLead = 64;
|
||||||
|
int32_t flickerZoneSize = 128;
|
||||||
|
|
||||||
|
const Rect windowRect = window->GetDrawSurface()->m_port.GetRect();
|
||||||
|
|
||||||
|
Vec2i topLeft = Vec2i(m_flickerWindow->m_wmX, m_flickerWindow->m_wmY);
|
||||||
|
Vec2i dimensions = Vec2i(windowRect.Width(), windowRect.Height());
|
||||||
|
|
||||||
|
m_flickerAxis = Vec2i(-1, -1);
|
||||||
|
m_flickerZoneSize = 128;
|
||||||
|
m_flickerBasisCoordinate = topLeft + dimensions;
|
||||||
|
m_flickerBasisCoordinateDistance = flickerZoneSize;
|
||||||
|
m_flickerChromeDistanceOffset = chromeLead;
|
||||||
|
|
||||||
|
int32_t axisLength = -(m_flickerAxis.m_x * dimensions.m_x + m_flickerAxis.m_y * dimensions.m_y);
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < axisLength + chromeLead + flickerZoneSize; i += velocity)
|
||||||
|
{
|
||||||
|
m_flickerBasisCoordinateDistance -= velocity;
|
||||||
|
PLSysCalls::Sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_flickerWindow = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManagerImpl::SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size)
|
void WindowManagerImpl::SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size)
|
||||||
{
|
{
|
||||||
ResetResizeInProgressSurfaces();
|
ResetResizeInProgressSurfaces();
|
||||||
@@ -1367,6 +1444,22 @@ namespace PortabilityLayer
|
|||||||
new (&m_resizeInProgressVerticalBar) DrawSurface();
|
new (&m_resizeInProgressVerticalBar) DrawSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManagerImpl::ComputeFlickerEffects(const Vec2i &windowUpperLeft, int32_t offset, GpDisplayDriverSurfaceEffects &effects) const
|
||||||
|
{
|
||||||
|
int32_t upperLeftCoord = windowUpperLeft.m_x * m_flickerAxis.m_x + windowUpperLeft.m_y * m_flickerAxis.m_y;
|
||||||
|
int32_t baselineDist = m_flickerBasisCoordinate.m_x * m_flickerAxis.m_x + m_flickerBasisCoordinate.m_y * m_flickerAxis.m_y;
|
||||||
|
int32_t distanceFromBaseline = upperLeftCoord - baselineDist;
|
||||||
|
|
||||||
|
int32_t startThreshold = -(m_flickerBasisCoordinateDistance + offset + distanceFromBaseline);
|
||||||
|
int32_t endThreshold = startThreshold + m_flickerZoneSize;
|
||||||
|
|
||||||
|
effects.m_flicker = true;
|
||||||
|
effects.m_flickerAxisX = m_flickerAxis.m_x;
|
||||||
|
effects.m_flickerAxisY = m_flickerAxis.m_y;
|
||||||
|
effects.m_flickerStartThreshold = startThreshold;
|
||||||
|
effects.m_flickerEndThreshold = endThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
Window *WindowManagerImpl::GetPutInFrontSentinel() const
|
Window *WindowManagerImpl::GetPutInFrontSentinel() const
|
||||||
{
|
{
|
||||||
return reinterpret_cast<Window*>(&ms_putInFrontSentinel);
|
return reinterpret_cast<Window*>(&ms_putInFrontSentinel);
|
||||||
@@ -1382,6 +1475,8 @@ namespace PortabilityLayer
|
|||||||
if (m_exclusiveWindow != nullptr && m_exclusiveWindow != window)
|
if (m_exclusiveWindow != nullptr && m_exclusiveWindow != window)
|
||||||
effects.m_darken = true;
|
effects.m_darken = true;
|
||||||
|
|
||||||
|
bool hasFlicker = (m_flickerWindow == window);
|
||||||
|
|
||||||
DrawSurface &graf = window->m_surface;
|
DrawSurface &graf = window->m_surface;
|
||||||
|
|
||||||
graf.PushToDDSurface(displayDriver);
|
graf.PushToDDSurface(displayDriver);
|
||||||
@@ -1389,6 +1484,10 @@ namespace PortabilityLayer
|
|||||||
const PixMap *pixMap = *graf.m_port.GetPixMap();
|
const PixMap *pixMap = *graf.m_port.GetPixMap();
|
||||||
const uint16_t width = pixMap->m_rect.Width();
|
const uint16_t width = pixMap->m_rect.Width();
|
||||||
const uint16_t height = pixMap->m_rect.Height();
|
const uint16_t height = pixMap->m_rect.Height();
|
||||||
|
|
||||||
|
if (hasFlicker)
|
||||||
|
ComputeFlickerEffects(Vec2i(window->m_wmX, window->m_wmY), 0, effects);
|
||||||
|
|
||||||
displayDriver->DrawSurface(graf.m_ddSurface, window->m_wmX, window->m_wmY, width, height, &effects);
|
displayDriver->DrawSurface(graf.m_ddSurface, window->m_wmX, window->m_wmY, width, height, &effects);
|
||||||
|
|
||||||
if (!window->IsBorderless())
|
if (!window->IsBorderless())
|
||||||
@@ -1414,6 +1513,9 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
chromeSurface->PushToDDSurface(displayDriver);
|
chromeSurface->PushToDDSurface(displayDriver);
|
||||||
|
|
||||||
|
if (hasFlicker)
|
||||||
|
ComputeFlickerEffects(Vec2i(chromeOrigins[i].m_x, chromeOrigins[i].m_y), m_flickerChromeDistanceOffset, effects);
|
||||||
|
|
||||||
displayDriver->DrawSurface(chromeSurface->m_ddSurface, chromeOrigins[i].m_x, chromeOrigins[i].m_y, chromeDimensions[i].m_x, chromeDimensions[i].m_y, &effects);
|
displayDriver->DrawSurface(chromeSurface->m_ddSurface, chromeOrigins[i].m_x, chromeOrigins[i].m_y, chromeDimensions[i].m_x, chromeDimensions[i].m_y, &effects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ namespace PortabilityLayer
|
|||||||
virtual bool GetWindowChromeInteractionZone(Window *window, const Vec2i &point, RegionID_t &outRegion) const = 0;
|
virtual bool GetWindowChromeInteractionZone(Window *window, const Vec2i &point, RegionID_t &outRegion) const = 0;
|
||||||
virtual void SwapExclusiveWindow(Window *& windowRef) = 0;
|
virtual void SwapExclusiveWindow(Window *& windowRef) = 0;
|
||||||
|
|
||||||
|
virtual void FlickerWindowIn(Window *window, int32_t velocity) = 0;
|
||||||
|
virtual void FlickerWindowOut(Window *window, int32_t velocity) = 0;
|
||||||
|
|
||||||
virtual void SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size) = 0;
|
virtual void SetResizeInProgress(Window *window, const PortabilityLayer::Vec2i &size) = 0;
|
||||||
virtual void ClearResizeInProgress() = 0;
|
virtual void ClearResizeInProgress() = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ float3 SamplePixel(int2 texCoord)
|
|||||||
SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
|
SDrawQuadPixelOutput PSMain(SDrawQuadPixelInput input)
|
||||||
{
|
{
|
||||||
SDrawQuadPixelOutput result;
|
SDrawQuadPixelOutput result;
|
||||||
result.color = float4(SamplePixel(int2(floor(input.texCoord.xy))), 1.0) * constants_Modulation;
|
int2 pixelCoordinate = int2(floor(input.texCoord.xy));
|
||||||
|
result.color = ApplyFlicker(pixelCoordinate, float4(SamplePixel(int2(floor(input.texCoord.xy))), 1.0) * constants_Modulation);
|
||||||
|
|
||||||
|
if (result.color.a <= 0.0)
|
||||||
|
discard;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,19 @@
|
|||||||
cbuffer SDrawQuadPixelConstants : register(b0)
|
cbuffer SDrawQuadPixelConstants : register(b0)
|
||||||
{
|
{
|
||||||
float4 constants_Modulation;
|
float4 constants_Modulation;
|
||||||
|
|
||||||
|
int2 constants_FlickerAxis;
|
||||||
|
int constants_FlickerStartThreshold;
|
||||||
|
int constants_FlickerEndThreshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
float4 ApplyFlicker(int2 coordinate, float4 color)
|
||||||
|
{
|
||||||
|
int flickerTotal = dot(constants_FlickerAxis, coordinate);
|
||||||
|
if (flickerTotal < constants_FlickerStartThreshold)
|
||||||
|
return float4(0, 0, 0, 0);
|
||||||
|
else if (flickerTotal >= constants_FlickerEndThreshold)
|
||||||
|
return color;
|
||||||
|
else
|
||||||
|
return float4(1, 1, 1, 1);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user