1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-27 00:41:08 +02:00

Obtaining town instance pointer via cb. Plz, don't access gamestate directly from player interface! Everything has to go via callback.

Commented out giving starting artifact - new artifact randomization make it crashing. Please fix it.

New control - CTextBox - for multi-line text with optional slider. Used it for map description and info windows. Related changes. Fixes #22 and #96.
This commit is contained in:
Michał W. Urbańczyk
2010-07-06 02:10:26 +00:00
parent e4fcfd7044
commit d0ff61807d
22 changed files with 568 additions and 390 deletions

View File

@ -637,3 +637,46 @@ void CSlider::setAmount( int to )
positions = to - capacity;
amax(positions, 0);
}
void CSlider::showAll(SDL_Surface * to)
{
SDL_FillRect(to, &pos, 0);
CIntObject::showAll(to);
}
void CSlider::wheelScrolled(bool down, bool in)
{
moveTo(value + 3 * (down ? +1 : -1));
}
void CSlider::keyPressed(const SDL_KeyboardEvent & key)
{
if(key.state != SDL_PRESSED) return;
int moveDest = 0;
switch(key.keysym.sym)
{
case SDLK_UP:
moveDest = value - 1;
break;
case SDLK_DOWN:
moveDest = value + 1;
break;
case SDLK_PAGEUP:
moveDest = value - capacity + 1;
break;
case SDLK_PAGEDOWN:
moveDest = value + capacity - 1;
break;
case SDLK_HOME:
moveDest = 0;
break;
case SDLK_END:
moveDest = amount - capacity;
break;
default:
return;
}
moveTo(moveDest);
}