mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- fullscreen config option will take effect immediately
- fixed bug with highlightable buttons - added several missing spells sounds
This commit is contained in:
parent
e7603a1fee
commit
2018fc09a4
@ -79,7 +79,7 @@ static bool setResolution = false; //set by event handling thread after resoluti
|
||||
|
||||
static bool ermInteractiveMode = false; //structurize when time is right
|
||||
void processCommand(const std::string &message);
|
||||
static void setScreenRes(int w, int h, int bpp, bool fullscreen);
|
||||
static void setScreenRes(int w, int h, int bpp, bool fullscreen, bool resetVideo=true);
|
||||
void dispose();
|
||||
void playIntro();
|
||||
static void listenForEvents();
|
||||
@ -574,7 +574,7 @@ void dispose()
|
||||
delete logfile;
|
||||
}
|
||||
|
||||
static void setScreenRes(int w, int h, int bpp, bool fullscreen)
|
||||
static void setScreenRes(int w, int h, int bpp, bool fullscreen, bool resetVideo)
|
||||
{
|
||||
// VCMI will only work with 2, 3 or 4 bytes per pixel
|
||||
vstd::amax(bpp, 16);
|
||||
@ -595,10 +595,13 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen)
|
||||
tlog2 << "Warning: SDL says that " << bpp << "bpp is wrong and suggests " << suggestedBpp << std::endl;
|
||||
}
|
||||
|
||||
if(screen) //screen has been already initialized
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
//For some reason changing fullscreen via config window checkbox result in SDL_Quit event
|
||||
if (resetVideo)
|
||||
{
|
||||
if(screen) //screen has been already initialized
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
}
|
||||
|
||||
if((screen = SDL_SetVideoMode(w, h, suggestedBpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0))) == NULL)
|
||||
{
|
||||
@ -643,8 +646,20 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen)
|
||||
setResolution = true;
|
||||
}
|
||||
|
||||
static void fullScreenChanged(const JsonNode &newState)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> lock(*LOCPLINT->pim);
|
||||
const JsonNode& video = settings["video"];
|
||||
const JsonNode& res = video["screenRes"];
|
||||
setScreenRes(res["width"].Float(), res["height"].Float(), video["bitsPerPixel"].Float(), newState.Bool(), false);
|
||||
GH.totalRedraw();
|
||||
}
|
||||
|
||||
static void listenForEvents()
|
||||
{
|
||||
SettingsListener resChanged = settings.listen["video"]["fullscreen"];
|
||||
resChanged(fullScreenChanged);
|
||||
|
||||
while(1) //main SDL events loop
|
||||
{
|
||||
SDL_Event *ev = new SDL_Event();
|
||||
@ -673,12 +688,8 @@ static void listenForEvents()
|
||||
}
|
||||
else if(LOCPLINT && ev->type == SDL_KEYDOWN && ev->key.keysym.sym==SDLK_F4)
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> lock(*LOCPLINT->pim);
|
||||
bool full = !(screen->flags&SDL_FULLSCREEN);
|
||||
const JsonNode& video = settings["video"];
|
||||
const JsonNode& res = video["screenRes"];
|
||||
setScreenRes(res["width"].Float(), res["height"].Float(), video["bitsPerPixel"].Float(), full);
|
||||
GH.totalRedraw();
|
||||
Settings full = settings.write["video"]["fullscreen"];
|
||||
full->Bool() = !full->Bool();
|
||||
delete ev;
|
||||
continue;
|
||||
}
|
||||
|
@ -426,10 +426,12 @@ void CHighlightableButton::clickLeft(tribool down, bool previousState)
|
||||
setState(PRESSED);
|
||||
}
|
||||
|
||||
if(previousState && down == false && getState() == PRESSED)
|
||||
if(previousState)//mouse up
|
||||
{
|
||||
//if(!onlyOn || !isHighlighted())
|
||||
select(!selected);
|
||||
if(down == false && getState() == PRESSED)
|
||||
select(!selected);
|
||||
else
|
||||
setState(selected?HIGHLIGHTED:NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,11 +74,19 @@
|
||||
"soundfile": "PROTECTE.wav",
|
||||
"name": "protection from earth"
|
||||
},
|
||||
{
|
||||
"id": 34,
|
||||
"soundfile": "ANIMDEAD.wav",
|
||||
},
|
||||
{
|
||||
"id": 35,
|
||||
"soundfile": "DISPELL.wav",
|
||||
"name": "dispell"
|
||||
},
|
||||
{
|
||||
"id": 39,
|
||||
"soundfile": "ANIMDEAD.wav",
|
||||
},
|
||||
{
|
||||
"id": 41,
|
||||
"soundfile": "BLESS.wav",
|
||||
@ -159,11 +167,20 @@
|
||||
"soundfile": "FRENZY.wav",
|
||||
"name": "frenzy"
|
||||
},
|
||||
{
|
||||
"id": 60,
|
||||
"soundfile": "HYPNOTIZ.wav",
|
||||
"name": "forgetfulness"
|
||||
},
|
||||
{
|
||||
"id": 61,
|
||||
"soundfile": "FORGET.wav",
|
||||
"name": "forgetfulness"
|
||||
},
|
||||
{
|
||||
"id": 62,
|
||||
"soundfile": "BLIND.wav",
|
||||
},
|
||||
{
|
||||
"id": 70,
|
||||
"soundfile": "PARALYZE.wav",
|
||||
|
Loading…
Reference in New Issue
Block a user