mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
obcured and game crash on window resize fix
This commit is contained in:
parent
1609ba8eb0
commit
e9b8d4e16f
5 changed files with 19 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ include(FindPackageHandleStandardArgs)
|
|||
|
||||
# Options
|
||||
option(STEAM "Build for Steam" OFF)
|
||||
option(DEBUG "Debug mode" OFF)
|
||||
option(DEBUG "Debug mode" ON)
|
||||
option(NATIVE "Use native instructions(for local use only)" OFF)
|
||||
#x86, arm64, ia-64
|
||||
option(CPU_ARCH "Enter here your target arch" "x86")
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ bool EventThread::eventFilter(void *data, SDL_Event *event){
|
|||
rtData.ethread->winX = event->window.data1;
|
||||
rtData.ethread->winY = event->window.data2;
|
||||
shState->windowSignals.moved.Emit(event->window.data1, event->window.data2);
|
||||
shState->graphics().update(false);
|
||||
//shState->graphics().update(false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -906,6 +906,15 @@ void Graphics::resizeScreen(int width, int height, bool emitSignal){
|
|||
|
||||
glState.scissorBox.set(IntRect(0, 0, width, height));
|
||||
shState->eThread().requestWindowResize(width, height);
|
||||
|
||||
TEX::del(p->obscuredTex);
|
||||
p->obscuredTex = TEX::gen();
|
||||
TEX::bind(p->obscuredTex);
|
||||
TEX::setRepeat(false);
|
||||
TEX::setSmooth(false);
|
||||
gl.TexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8, p->scRes.x, p->scRes.y, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0);
|
||||
shState->oneshot().updateObscuredSize(size.x, size.y);
|
||||
|
||||
if (emitSignal)
|
||||
shState->graphicsSignals.resized.Emit(width, height);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title)
|
|||
|
||||
// Show messagebox
|
||||
#ifdef _WIN32
|
||||
PlaySoundW((LPCWSTR)sound, NULL, SND_ALIAS_ID | SND_ASYNC);
|
||||
PlaySoundW(MAKEINTRESOURCEW(sound), NULL, SND_ALIAS_ID | SND_ASYNC);
|
||||
#endif
|
||||
int button;
|
||||
|
||||
|
|
@ -588,6 +588,12 @@ void Oneshot::setObscuredUpdating(bool enabled){
|
|||
p->obscuredNeedToUpdate = enabled;
|
||||
}
|
||||
|
||||
void Oneshot::updateObscuredSize(int winW, int winH){
|
||||
p->winW = winW;
|
||||
p->winH = winH;
|
||||
p->obscuredMap.resize(p->winW * p->winH, 255);
|
||||
}
|
||||
|
||||
void Oneshot::updateObscured(int winX, int winY)
|
||||
{
|
||||
SDL_LockMutex(p->winMutex);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public:
|
|||
void setExiting(bool exiting);
|
||||
void setAllowExit(bool allowExit);
|
||||
void setObscuredUpdating(bool enabled);
|
||||
void updateObscuredSize(int winW, int winH);
|
||||
void updateObscured(int winX, int winY);
|
||||
void resetObscured();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue