mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Keep track of focus position
This commit is contained in:
1 parent
f9f893f3fc
commit
ecab31ef8b
4 files changed
+33
-15
No files matched your search
@@ -24,7 +24,6 @@ static std::mutex eventMutex_;
|
|||||||
static std::function<void(UISound)> soundCallback;
|
static std::function<void(UISound)> soundCallback;
|
||||||
static bool soundEnabled = true;
|
static bool soundEnabled = true;
|
||||||
|
|
||||||
|
|
||||||
struct DispatchQueueItem {
|
struct DispatchQueueItem {
|
||||||
Event *e;
|
Event *e;
|
||||||
EventParams params;
|
EventParams params;
|
||||||
|
|||||||
@@ -191,6 +191,13 @@ void ScreenManager::render() {
|
|||||||
processFinishDialog();
|
processFinishDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenManager::getFocusPosition(float &x, float &y, float &z) {
|
||||||
|
UI::View *v = UI::GetFocusedView();
|
||||||
|
x = v ? v->GetBounds().x : 0;
|
||||||
|
y = v ? v->GetBounds().y : 0;
|
||||||
|
z = stack_.size();
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenManager::sendMessage(const char *msg, const char *value) {
|
void ScreenManager::sendMessage(const char *msg, const char *value) {
|
||||||
if (!strcmp(msg, "recreateviews"))
|
if (!strcmp(msg, "recreateviews"))
|
||||||
RecreateAllViews();
|
RecreateAllViews();
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ public:
|
|||||||
|
|
||||||
Screen *topScreen() const;
|
Screen *topScreen() const;
|
||||||
|
|
||||||
|
void getFocusPosition(float &x, float &y, float &z);
|
||||||
|
|
||||||
std::recursive_mutex inputLock_;
|
std::recursive_mutex inputLock_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
+24
-14
@@ -76,12 +76,12 @@ static std::unique_ptr<ManagedTexture> bgTexture;
|
|||||||
class Animation {
|
class Animation {
|
||||||
public:
|
public:
|
||||||
virtual ~Animation() {}
|
virtual ~Animation() {}
|
||||||
virtual void Draw(UIContext &dc, double t, float alpha) = 0;
|
virtual void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaveAnimation : public Animation {
|
class WaveAnimation : public Animation {
|
||||||
public:
|
public:
|
||||||
void Draw(UIContext &dc, double t, float alpha) override {
|
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
|
||||||
const uint32_t color = colorAlpha(0xFFFFFFFF, alpha * 0.2f);
|
const uint32_t color = colorAlpha(0xFFFFFFFF, alpha * 0.2f);
|
||||||
const float speed = 1.0;
|
const float speed = 1.0;
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
class FloatingSymbolsAnimation : public Animation {
|
class FloatingSymbolsAnimation : public Animation {
|
||||||
public:
|
public:
|
||||||
~FloatingSymbolsAnimation() override {}
|
~FloatingSymbolsAnimation() override {}
|
||||||
void Draw(UIContext &dc, double t, float alpha) override {
|
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
|
||||||
float xres = dc.GetBounds().w;
|
float xres = dc.GetBounds().w;
|
||||||
float yres = dc.GetBounds().h;
|
float yres = dc.GetBounds().h;
|
||||||
if (last_xres != xres || last_yres != yres) {
|
if (last_xres != xres || last_yres != yres) {
|
||||||
@@ -150,7 +150,7 @@ private:
|
|||||||
class RecentGamesAnimation : public Animation {
|
class RecentGamesAnimation : public Animation {
|
||||||
public:
|
public:
|
||||||
~RecentGamesAnimation() override {}
|
~RecentGamesAnimation() override {}
|
||||||
void Draw(UIContext &dc, double t, float alpha) override {
|
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
|
||||||
if (lastIndex_ == nextIndex_) {
|
if (lastIndex_ == nextIndex_) {
|
||||||
CheckNext(dc, t);
|
CheckNext(dc, t);
|
||||||
} else if (t > nextT_) {
|
} else if (t > nextT_) {
|
||||||
@@ -250,7 +250,7 @@ void UIBackgroundShutdown() {
|
|||||||
bgTextureInited = false;
|
bgTextureInited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawBackground(UIContext &dc, float alpha) {
|
void DrawBackground(UIContext &dc, float alpha, float x, float y, float z) {
|
||||||
if (!bgTextureInited) {
|
if (!bgTextureInited) {
|
||||||
UIBackgroundInit(dc);
|
UIBackgroundInit(dc);
|
||||||
bgTextureInited = true;
|
bgTextureInited = true;
|
||||||
@@ -298,11 +298,11 @@ void DrawBackground(UIContext &dc, float alpha) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_Animation) {
|
if (g_Animation) {
|
||||||
g_Animation->Draw(dc, t, alpha);
|
g_Animation->Draw(dc, t, alpha, x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawGameBackground(UIContext &dc, const Path &gamePath) {
|
void DrawGameBackground(UIContext &dc, const Path &gamePath, float x, float y, float z) {
|
||||||
std::shared_ptr<GameInfo> ginfo;
|
std::shared_ptr<GameInfo> ginfo;
|
||||||
if (!gamePath.empty())
|
if (!gamePath.empty())
|
||||||
ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath, GAMEINFO_WANTBG);
|
ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath, GAMEINFO_WANTBG);
|
||||||
@@ -318,7 +318,7 @@ void DrawGameBackground(UIContext &dc, const Path &gamePath) {
|
|||||||
dc.Flush();
|
dc.Flush();
|
||||||
dc.RebindTexture();
|
dc.RebindTexture();
|
||||||
} else {
|
} else {
|
||||||
::DrawBackground(dc, 1.0f);
|
::DrawBackground(dc, 1.0f, x, y, z);
|
||||||
dc.RebindTexture();
|
dc.RebindTexture();
|
||||||
dc.Flush();
|
dc.Flush();
|
||||||
}
|
}
|
||||||
@@ -364,15 +364,19 @@ void HandleCommonMessages(const char *message, const char *value, ScreenManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UIScreenWithBackground::DrawBackground(UIContext &dc) {
|
void UIScreenWithBackground::DrawBackground(UIContext &dc) {
|
||||||
::DrawBackground(dc, 1.0f);
|
float x, y, z;
|
||||||
|
screenManager()->getFocusPosition(x, y, z);
|
||||||
|
::DrawBackground(dc, 1.0f, x, y, z);
|
||||||
dc.Flush();
|
dc.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScreenWithGameBackground::DrawBackground(UIContext &dc) {
|
void UIScreenWithGameBackground::DrawBackground(UIContext &dc) {
|
||||||
|
float x, y, z;
|
||||||
|
screenManager()->getFocusPosition(x, y, z);
|
||||||
if (!gamePath_.empty()) {
|
if (!gamePath_.empty()) {
|
||||||
DrawGameBackground(dc, gamePath_);
|
DrawGameBackground(dc, gamePath_, x, y, z);
|
||||||
} else {
|
} else {
|
||||||
::DrawBackground(dc, 1.0f);
|
::DrawBackground(dc, 1.0f, x, y, z);
|
||||||
dc.Flush();
|
dc.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -386,7 +390,9 @@ void UIScreenWithGameBackground::sendMessage(const char *message, const char *va
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UIDialogScreenWithGameBackground::DrawBackground(UIContext &dc) {
|
void UIDialogScreenWithGameBackground::DrawBackground(UIContext &dc) {
|
||||||
DrawGameBackground(dc, gamePath_);
|
float x, y, z;
|
||||||
|
screenManager()->getFocusPosition(x, y, z);
|
||||||
|
DrawGameBackground(dc, gamePath_, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIDialogScreenWithGameBackground::sendMessage(const char *message, const char *value) {
|
void UIDialogScreenWithGameBackground::sendMessage(const char *message, const char *value) {
|
||||||
@@ -402,7 +408,9 @@ void UIScreenWithBackground::sendMessage(const char *message, const char *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UIDialogScreenWithBackground::DrawBackground(UIContext &dc) {
|
void UIDialogScreenWithBackground::DrawBackground(UIContext &dc) {
|
||||||
::DrawBackground(dc, 1.0f);
|
float x, y, z;
|
||||||
|
screenManager()->getFocusPosition(x, y, z);
|
||||||
|
::DrawBackground(dc, 1.0f, x, y, z);
|
||||||
dc.Flush();
|
dc.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,7 +694,9 @@ void LogoScreen::render() {
|
|||||||
alphaText = 3.0f - t;
|
alphaText = 3.0f - t;
|
||||||
uint32_t textColor = colorAlpha(dc.theme->infoStyle.fgColor, alphaText);
|
uint32_t textColor = colorAlpha(dc.theme->infoStyle.fgColor, alphaText);
|
||||||
|
|
||||||
::DrawBackground(dc, alpha);
|
float x, y, z;
|
||||||
|
screenManager()->getFocusPosition(x, y, z);
|
||||||
|
::DrawBackground(dc, alpha, x, y, z);
|
||||||
|
|
||||||
auto cr = GetI18NCategory("PSPCredits");
|
auto cr = GetI18NCategory("PSPCredits");
|
||||||
auto gr = GetI18NCategory("Graphics");
|
auto gr = GetI18NCategory("Graphics");
|
||||||
|
|||||||
Reference in new issue
Block a user