mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-21 12:06:49 +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
|
static bool ermInteractiveMode = false; //structurize when time is right
|
||||||
void processCommand(const std::string &message);
|
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 dispose();
|
||||||
void playIntro();
|
void playIntro();
|
||||||
static void listenForEvents();
|
static void listenForEvents();
|
||||||
@ -574,7 +574,7 @@ void dispose()
|
|||||||
delete logfile;
|
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
|
// VCMI will only work with 2, 3 or 4 bytes per pixel
|
||||||
vstd::amax(bpp, 16);
|
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;
|
tlog2 << "Warning: SDL says that " << bpp << "bpp is wrong and suggests " << suggestedBpp << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(screen) //screen has been already initialized
|
//For some reason changing fullscreen via config window checkbox result in SDL_Quit event
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
if (resetVideo)
|
||||||
|
{
|
||||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
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)
|
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;
|
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()
|
static void listenForEvents()
|
||||||
{
|
{
|
||||||
|
SettingsListener resChanged = settings.listen["video"]["fullscreen"];
|
||||||
|
resChanged(fullScreenChanged);
|
||||||
|
|
||||||
while(1) //main SDL events loop
|
while(1) //main SDL events loop
|
||||||
{
|
{
|
||||||
SDL_Event *ev = new SDL_Event();
|
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)
|
else if(LOCPLINT && ev->type == SDL_KEYDOWN && ev->key.keysym.sym==SDLK_F4)
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::recursive_mutex> lock(*LOCPLINT->pim);
|
Settings full = settings.write["video"]["fullscreen"];
|
||||||
bool full = !(screen->flags&SDL_FULLSCREEN);
|
full->Bool() = !full->Bool();
|
||||||
const JsonNode& video = settings["video"];
|
|
||||||
const JsonNode& res = video["screenRes"];
|
|
||||||
setScreenRes(res["width"].Float(), res["height"].Float(), video["bitsPerPixel"].Float(), full);
|
|
||||||
GH.totalRedraw();
|
|
||||||
delete ev;
|
delete ev;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -426,10 +426,12 @@ void CHighlightableButton::clickLeft(tribool down, bool previousState)
|
|||||||
setState(PRESSED);
|
setState(PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(previousState && down == false && getState() == PRESSED)
|
if(previousState)//mouse up
|
||||||
{
|
{
|
||||||
//if(!onlyOn || !isHighlighted())
|
if(down == false && getState() == PRESSED)
|
||||||
select(!selected);
|
select(!selected);
|
||||||
|
else
|
||||||
|
setState(selected?HIGHLIGHTED:NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,11 +74,19 @@
|
|||||||
"soundfile": "PROTECTE.wav",
|
"soundfile": "PROTECTE.wav",
|
||||||
"name": "protection from earth"
|
"name": "protection from earth"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": 34,
|
||||||
|
"soundfile": "ANIMDEAD.wav",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": 35,
|
"id": 35,
|
||||||
"soundfile": "DISPELL.wav",
|
"soundfile": "DISPELL.wav",
|
||||||
"name": "dispell"
|
"name": "dispell"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": 39,
|
||||||
|
"soundfile": "ANIMDEAD.wav",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": 41,
|
"id": 41,
|
||||||
"soundfile": "BLESS.wav",
|
"soundfile": "BLESS.wav",
|
||||||
@ -159,11 +167,20 @@
|
|||||||
"soundfile": "FRENZY.wav",
|
"soundfile": "FRENZY.wav",
|
||||||
"name": "frenzy"
|
"name": "frenzy"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": 60,
|
||||||
|
"soundfile": "HYPNOTIZ.wav",
|
||||||
|
"name": "forgetfulness"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": 61,
|
"id": 61,
|
||||||
"soundfile": "FORGET.wav",
|
"soundfile": "FORGET.wav",
|
||||||
"name": "forgetfulness"
|
"name": "forgetfulness"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": 62,
|
||||||
|
"soundfile": "BLIND.wav",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": 70,
|
"id": 70,
|
||||||
"soundfile": "PARALYZE.wav",
|
"soundfile": "PARALYZE.wav",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user