mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-29 21:56:54 +02:00
parent
0daac5f265
commit
4bfc161adc
@ -43,6 +43,7 @@
|
|||||||
#include "../lib/VCMIDirs.h"
|
#include "../lib/VCMIDirs.h"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "../lib/NetPacks.h"
|
#include "../lib/NetPacks.h"
|
||||||
|
#include "SDL_syswm.h"
|
||||||
|
|
||||||
#if __MINGW32__
|
#if __MINGW32__
|
||||||
#undef main
|
#undef main
|
||||||
@ -412,9 +413,6 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen)
|
|||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if((screen = SDL_SetVideoMode(w, h, suggestedBpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0))) == NULL)
|
if((screen = SDL_SetVideoMode(w, h, suggestedBpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0))) == NULL)
|
||||||
{
|
{
|
||||||
@ -431,6 +429,29 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen)
|
|||||||
SDL_WM_SetCaption(NAME.c_str(),""); //set window title
|
SDL_WM_SetCaption(NAME.c_str(),""); //set window title
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
SDL_SysWMinfo wm;
|
||||||
|
SDL_VERSION(&wm.version);
|
||||||
|
int getwm = SDL_GetWMInfo(&wm);
|
||||||
|
if(getwm == 1)
|
||||||
|
{
|
||||||
|
int sw = GetSystemMetrics(SM_CXSCREEN),
|
||||||
|
sh = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
RECT curpos;
|
||||||
|
GetWindowRect(wm.window,&curpos);
|
||||||
|
int ourw = curpos.right - curpos.left,
|
||||||
|
ourh = curpos.bottom - curpos.top;
|
||||||
|
SetWindowPos(wm.window, 0, (sw - ourw)/2, (sh - ourh)/2, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tlog3 << "Something went wrong, getwm=" << getwm << std::endl;
|
||||||
|
tlog3 << "SDL says: " << SDL_GetError() << std::endl;
|
||||||
|
tlog3 << "Window won't be centered.\n";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
//TODO: centering game window on other platforms (or does the environment do their job correctly there?)
|
||||||
|
|
||||||
screenBuf = bufOnScreen ? screen : screen2;
|
screenBuf = bufOnScreen ? screen : screen2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,16 +126,17 @@ void CGPreGame::run()
|
|||||||
{
|
{
|
||||||
GH.handleEvents();
|
GH.handleEvents();
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
CGI->videoh->open("ACREDIT.SMK");
|
|
||||||
#else
|
|
||||||
CGI->videoh->open("ACREDIT.SMK", true, false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while(!terminate)
|
while(!terminate)
|
||||||
{
|
{
|
||||||
if (GH.listInt.size() == 0)
|
if (GH.listInt.size() == 0)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
CGI->videoh->open("ACREDIT.SMK");
|
||||||
|
#else
|
||||||
|
CGI->videoh->open("ACREDIT.SMK", true, false);
|
||||||
|
#endif
|
||||||
GH.pushInt(scrs[mainMenu]);
|
GH.pushInt(scrs[mainMenu]);
|
||||||
|
}
|
||||||
|
|
||||||
CGI->curh->draw1();
|
CGI->curh->draw1();
|
||||||
SDL_Flip(screen);
|
SDL_Flip(screen);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user