Exemple #1
0
void Sprite::Draw(int x, int y)
{
	if (!isDefined) return;
	
	// setup various opengl things that we need
	m3d_logo_has_toggled_mode = SetModes(_2D_MODE_);	

	glEnable(GL_TEXTURE_2D);
	glEnable(GL_COLOR_MATERIAL);
	glShadeModel(GL_SMOOTH);
	glColor4fv(color);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

	glBegin(GL_TRIANGLE_STRIP);																	
		// Top Left
		glTexCoord2f(xOffset, yTiling + yOffset);
		glVertex2i(x, y+size[1]);
		// Top Right
		glTexCoord2f(xTiling + xOffset, yTiling + yOffset);
		glVertex2i(x+size[0], y+size[1]);
		// Bottom Left
		glTexCoord2f(xOffset, yOffset);
		glVertex2i(x, y);
		// Bottom Right
		glTexCoord2f(xTiling + xOffset, yOffset);
		glVertex2i(x+size[0], y);
	glEnd();

	glDisable(GL_TEXTURE_2D);
	glDisable(GL_COLOR_MATERIAL);

	if (m3d_logo_has_toggled_mode) SetModes(_3D_MODE_);
}
void SpectatorPanel::ActionSignal(int cmd)
{
	auto pSpectator = GETHUDCLASS( CHudSpectator );

	switch (cmd)
	{
		case SPECTATOR_PANEL_CMD_NONE :			break;

		case SPECTATOR_PANEL_CMD_OPTIONS :		gViewPort->ShowCommandMenu( gViewPort->m_SpectatorOptionsMenu );
												break;

		case SPECTATOR_PANEL_CMD_NEXTPLAYER :	if( pSpectator ) pSpectator->FindNextPlayer(true);
												break;

		case SPECTATOR_PANEL_CMD_PREVPLAYER :	if( pSpectator ) pSpectator->FindNextPlayer(false);
												break;

		case SPECTATOR_PANEL_CMD_PLAYERS :		gViewPort->ShowCommandMenu( gViewPort->m_PlayerMenu );
												break;

		case SPECTATOR_PANEL_CMD_HIDEMENU	:	ShowMenu(false); 
												break;

		case SPECTATOR_PANEL_CMD_CAMERA :		gViewPort->ShowCommandMenu( gViewPort->m_SpectatorCameraMenu );
												break;
		
		case SPECTATOR_PANEL_CMD_TOGGLE_INSET : if( pSpectator ) pSpectator->SetModes( -1,
																					   pSpectator->ToggleInset(false) );
												break;
		

		default : 	gEngfuncs.Con_DPrintf("Unknown SpectatorPanel ActionSingal %i.\n",cmd); break;
	}

}
Exemple #3
0
OTGWTCP::OTGWTCP(const int ID, const std::string IPAddress, const unsigned short usIPPort, const int Mode1, const int Mode2, const int Mode3, const int Mode4, const int Mode5)
{
	m_HwdID=ID;
	m_bDoRestart=false;
#if defined WIN32
	int ret;
	//Init winsock
	WSADATA data;
	WORD version; 

	version = (MAKEWORD(2, 2)); 
	ret = WSAStartup(version, &data); 
	if (ret != 0) 
	{  
		ret = WSAGetLastError(); 

		if (ret == WSANOTINITIALISED) 
		{  
			_log.Log(LOG_ERROR,"OTGW: Winsock could not be initialized!");
		}
	}
#endif
	m_stoprequested=false;
	m_szIPAddress=IPAddress;
	m_usIPPort=usIPPort;
	SetModes(Mode1,Mode2,Mode3,Mode4,Mode5);
}
void LocalEvent::HandleMouseMotionEvent(const SDL_MouseMotionEvent & motion)
{
    mouse_state = motion.state;
    SetModes(MOUSE_MOTION);
    mouse_cu.x = motion.x;
    mouse_cu.y = motion.y;
    if(modes & MOUSE_OFFSET) mouse_cu += mouse_st;
}
Exemple #5
0
//
//Class OTGWSerial
//
OTGWSerial::OTGWSerial(const int ID, const std::string& devname, const unsigned int baud_rate, const int Mode1, const int Mode2, const int Mode3, const int Mode4, const int Mode5)
{
	m_HwdID=ID;
	m_szSerialPort=devname;
	m_iBaudRate=baud_rate;
	m_stoprequestedpoller=false;
	SetModes(Mode1,Mode2,Mode3,Mode4,Mode5);
}
Exemple #6
0
OTGWTCP::OTGWTCP(const int ID, const std::string &IPAddress, const unsigned short usIPPort, const int Mode1, const int Mode2, const int Mode3, const int Mode4, const int Mode5, const int Mode6):
	m_szIPAddress(IPAddress)
{
	m_HwdID=ID;
	m_bDoRestart=false;
	m_stoprequested=false;
	m_usIPPort=usIPPort;
	m_retrycntr = RETRY_DELAY;
	SetModes(Mode1,Mode2,Mode3,Mode4,Mode5,Mode6);
}
void LocalEvent::SetTapMode(bool f)
{
    if(f)
	SetModes(TAP_MODE);
    else
    {
	ResetModes(TAP_MODE);
	ResetModes(CLOCK_ON);
	clock.Stop();
    }
}
Exemple #8
0
void FH2LocalClient::MsgUpdatePlayers(QueueMessage & packet)
{
    PopPlayersInfo(packet);
    Settings::Get().GetPlayers().SetHumanColors(GetPlayersColors(players));
    std::vector<Player>::iterator itp = std::find_if(players.begin(), players.end(), std::bind2nd(std::mem_fun_ref(&Player::isID), id));
    if(itp != players.end())
    {
	color = (*itp).color;
	race = (*itp).race;
	(admin_id == id ? SetModes(ST_ADMIN) : ResetModes(ST_ADMIN));
    }
}
Exemple #9
0
void text_t::Draw(GLint xpos, GLint ypos, const char *s, ...)
{
   va_list	msg;
   char buffer[fontMaxLen] = {'\0'};
   GLint vPort[4];

   va_start (msg, s);
#ifdef _WIN32
   _vsntprintf (buffer, fontMaxLen - 1, s, msg);	
#else /* linux */
   vsnprintf (buffer, fontMaxLen - 1, s, msg);	
#endif
   va_end (msg);

   /* get current viewport */
   glGetIntegerv(GL_VIEWPORT, vPort);
   /* setup various opengl things that we need */
   SetModes(fontGetModes);

   glMatrixMode(GL_PROJECTION);
   glPushMatrix();
   glLoadIdentity();

   glOrtho(0, vPort[2], 0, vPort[3], -1, 1);
   glMatrixMode(GL_MODELVIEW);
   glPushMatrix();
   glLoadIdentity();
   glBindTexture(GL_TEXTURE_2D, texId);

   /* draw the string */
   WalkString(buffer, xpos, ypos, vPort);

   glMatrixMode(GL_PROJECTION);
   glPopMatrix();   
   glMatrixMode(GL_MODELVIEW);
   glPopMatrix();

   SetModes (fontRestoreModes);
   Reset ();
}
Battle::Tower::Tower(const Castle & castle, int twr) : Unit(Troop(Monster::ARCHER, 0), -1, false),
    type(twr), color(castle.GetColor()), bonus(0), valid(true)
{
    count += castle.CountBuildings();
    count += castle.GetLevelMageGuild() - 1;

    if(count > 20) count = 20;
    if(TWR_CENTER != type) count /= 2;
    if(count == 0) count = 1;
    bonus = castle.GetLevelMageGuild();

    SetModes(CAP_TOWER);
}
void LocalEvent::HandleKeyboardEvent(SDL_KeyboardEvent & event)
{
    if(KEY_NONE != GetKeySym(event.keysym.sym))
    {
	(event.type == SDL_KEYDOWN) ? SetModes(KEY_PRESSED) : ResetModes(KEY_PRESSED);

#ifdef WITHOUT_MOUSE
	if(emulate_mouse && EmulateMouseAction(GetKeySym(event.keysym.sym))) return;
#endif

	key_value = GetKeySym(event.keysym.sym);
    }
}
void
KickBan(int ban, char *source, struct Channel *channel, char *nicks, char *reason)

{
  char *mask, *tempnix, **av, *bans;
  char temp[MAXLINE];
  int ac, ii;
  struct Luser *lptr;

  if (!source || !channel || !nicks)
    return;

  tempnix = MyStrdup(nicks);
  ac = SplitBuf(tempnix, &av);

  if (ban)
  {
    bans = (char *) MyMalloc(sizeof(char));
    bans[0] = '\0';
    for (ii = 0; ii < ac; ii++)
    {
      if (!(lptr = FindClient(av[ii])))
        continue;
      mask = HostToMask(lptr->username, lptr->hostname);
      ircsprintf(temp, "*!%s", mask);
      bans = (char *) MyRealloc(bans, strlen(bans)
          + strlen(temp) + (2 * sizeof(char)));
      strcat(bans, temp);
      strcat(bans, " ");
      MyFree(mask);
    }

    SetModes(source, 1, 'b', channel, bans);
    MyFree(bans);
  }

  for (ii = 0; ii < ac; ii++)
  {
    toserv(":%s REMOVE %s %s :%s\n",
      source,
      channel->name,
      av[ii],
      reason ? reason : "");
    RemoveFromChannel(channel, FindClient(av[ii]));
  }

  MyFree(tempnix);
  MyFree(av);
} /* KickBan() */
Exemple #13
0
void Font::BackDraw(int xpos, int ypos, char *s, ...)
{
	va_list	msg;
	char buffer[fontMaxLen] = {'\0'};
	int vtPort[4];
	
	va_start (msg, s);
	_vsntprintf (buffer, fontMaxLen - 1, s, msg);	
	va_end (msg);
	
	/* setup various opengl things that we need */
	m3d_text_has_toggled_mode = SetModes(_2D_MODE_);
	
	charmap.BindTexture();
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
	
	/* draw the string */
	glGetIntegerv(GL_VIEWPORT, vtPort);	
	WalkString(buffer, xpos, ypos, vtPort, -1);
	
	if (m3d_text_has_toggled_mode) SetModes(_3D_MODE_);
	Reset();
}
Exemple #14
0
CThermosmart::CThermosmart(const int ID, const std::string &Username, const std::string &Password, const int Mode1, const int Mode2, const int Mode3, const int Mode4, const int Mode5, const int Mode6)
{
	if ((Password == "secret")|| (Password.empty()))
	{
		_log.Log(LOG_ERROR, "Thermosmart: Please update your username/password!...");
	}
	else
	{
		m_UserName = Username;
		m_Password = Password;
		stdstring_trim(m_UserName);
		stdstring_trim(m_Password);
	}
	m_HwdID=ID;
	m_OutsideTemperatureIdx = 0; //use build in
	m_LastMinute = -1;
	SetModes(Mode1, Mode2, Mode3, Mode4, Mode5, Mode6);
	Init();
}
void LocalEvent::SetMouseOffsetX(s16 x)
{
    SetModes(MOUSE_OFFSET);
    mouse_st.x = x;
}
bool LocalEvent::EmulateMouseAction(KeySym key)
{
    if((key == emulate_mouse_up ||
	key == emulate_mouse_down ||
	key == emulate_mouse_left ||
	key == emulate_mouse_right ||
	key == emulate_press_left ||
	key == emulate_press_right))
    {
	if(emulate_mouse_up == key)
	{
	    mouse_cu.y -= emulate_mouse_step;
	    SetModes(MOUSE_MOTION);
	}
	else
	if(emulate_mouse_down == key)
	{
	    mouse_cu.y += emulate_mouse_step;
	    SetModes(MOUSE_MOTION);
	}
	else
	if(emulate_mouse_left == key)
	{
	    mouse_cu.x -= emulate_mouse_step;
	    SetModes(MOUSE_MOTION);
	}
	else
	if(emulate_mouse_right == key)
	{
	    mouse_cu.x += emulate_mouse_step;
	    SetModes(MOUSE_MOTION);
	}

	if(mouse_cu.x < 0) mouse_cu.x = 0;
	if(mouse_cu.y < 0) mouse_cu.y = 0;
	if(mouse_cu.x > Display::Get().w()) mouse_cu.x = Display::Get().w();
	if(mouse_cu.y > Display::Get().h()) mouse_cu.y = Display::Get().h();

	if(emulate_press_left == key)
	{
	    if(modes & KEY_PRESSED)
	    {
		mouse_pl = mouse_cu;
		SetModes(MOUSE_PRESSED);
		SetModes(CLICK_LEFT);
	    }
	    else
	    {
		mouse_rl = mouse_cu;
		ResetModes(MOUSE_PRESSED);
	    }
	    mouse_button = SDL_BUTTON_LEFT;
	}
	else
	if(emulate_press_right == key)
	{
	    if(modes & KEY_PRESSED)
	    {
		mouse_pr = mouse_cu;
		SetModes(MOUSE_PRESSED);
	    }
	    else
	    {
		mouse_rr = mouse_cu;
		ResetModes(MOUSE_PRESSED);
	    }
	    mouse_button = SDL_BUTTON_RIGHT;
	}

    	if((modes & MOUSE_MOTION) && redraw_cursor_func)
	{
	    if(modes & MOUSE_OFFSET)
    		(*(redraw_cursor_func))(mouse_cu.x + mouse_st.x, mouse_cu.y + mouse_st.y);
    	    else
		(*(redraw_cursor_func))(mouse_cu.x, mouse_cu.y);
	}

	ResetModes(KEY_PRESSED);

	return true;
    }

    return false;
}
void LocalEvent::HandleMouseButtonEvent(const SDL_MouseButtonEvent & button)
{
    button.state == SDL_PRESSED ? SetModes(MOUSE_PRESSED) : ResetModes(MOUSE_PRESSED);
    mouse_button = button.button;

    mouse_cu.x = button.x;
    mouse_cu.y = button.y;
    if(modes & MOUSE_OFFSET) mouse_cu += mouse_st;

    if(modes & MOUSE_PRESSED)
	switch(button.button)
	{
	    case SDL_BUTTON_WHEELDOWN:
	    case SDL_BUTTON_WHEELUP:
		mouse_pm = mouse_cu;
		break;

	    case SDL_BUTTON_LEFT:
		mouse_pl = mouse_cu;
		SetModes(CLICK_LEFT);

		// emulate press right
		if(modes & TAP_MODE){ clock.Start(); SetModes(CLOCK_ON); }
		break;

	    case SDL_BUTTON_MIDDLE:
		mouse_pm = mouse_cu;
		SetModes(CLICK_MIDDLE);
		break;


	    case SDL_BUTTON_RIGHT:
		mouse_pr = mouse_cu;
		SetModes(CLICK_RIGHT);
		break;

	    default:
		break;
	}
    else
	switch(button.button)
	{
	    case SDL_BUTTON_WHEELDOWN:
	    case SDL_BUTTON_WHEELUP:
		mouse_rm = mouse_cu;
		break;

	    case SDL_BUTTON_LEFT:
		mouse_rl = mouse_cu;

		// emulate press right
		if(modes & TAP_MODE){ ResetModes(CLOCK_ON); }
		break;

	    case SDL_BUTTON_MIDDLE:
		mouse_rm = mouse_cu;
		break;


	    case SDL_BUTTON_RIGHT:
		mouse_rr = mouse_cu;
		break;

	    default:
		break;
	}
}
Exemple #18
0
bool
SerialDevice::Service(struct tty *tty, uint32 op, void *buffer, size_t length)
{
	if (tty != fMasterTTY)
		return false;

	switch (op) {
		case TTYENABLE:
		{
			bool enable = *(bool *)buffer;
			TRACE("TTYENABLE: %sable\n", enable ? "en" : "dis");

			gTTYModule->tty_hardware_signal(fSystemTTYCookie, TTYHWDCD, enable);
			gTTYModule->tty_hardware_signal(fSystemTTYCookie, TTYHWCTS, enable);

			fControlOut = enable ? USB_CDC_CONTROL_SIGNAL_STATE_DTR
				| USB_CDC_CONTROL_SIGNAL_STATE_RTS : 0;
			SetControlLineState(fControlOut);
			return true;
		}

		case TTYISTOP:
			fInputStopped = *(bool *)buffer;
			TRACE("TTYISTOP: %sstopped\n", fInputStopped ? "" : "not ");
			gTTYModule->tty_hardware_signal(fSystemTTYCookie, TTYHWCTS,
				!fInputStopped);
			return true;

		case TTYGETSIGNALS:
			TRACE("TTYGETSIGNALS\n");
			gTTYModule->tty_hardware_signal(fSystemTTYCookie, TTYHWDCD,
				(fControlOut & (USB_CDC_CONTROL_SIGNAL_STATE_DTR
					| USB_CDC_CONTROL_SIGNAL_STATE_RTS)) != 0);
			gTTYModule->tty_hardware_signal(fSystemTTYCookie, TTYHWCTS,
				!fInputStopped);
			gTTYModule->tty_hardware_signal(fSystemTTYCookie, TTYHWDSR, false);
			gTTYModule->tty_hardware_signal(fSystemTTYCookie, TTYHWRI, false);
			return true;

		case TTYSETMODES:
			TRACE("TTYSETMODES\n");
			SetModes((struct termios *)buffer);
			return true;

		case TTYSETDTR:
		case TTYSETRTS:
		{
			bool set = *(bool *)buffer;
			uint8 bit = op == TTYSETDTR ? USB_CDC_CONTROL_SIGNAL_STATE_DTR
				: USB_CDC_CONTROL_SIGNAL_STATE_RTS;
			if (set)
				fControlOut |= bit;
			else
				fControlOut &= ~bit;

			SetControlLineState(fControlOut);
			return true;
		}

		case TTYOSTART:
		case TTYOSYNC:
		case TTYSETBREAK:
			TRACE("TTY other\n");
			return true;
	}

	return false;
}
bool LocalEvent::HandleEvents(bool delay)
{
    SDL_Event event;

    ResetModes(MOUSE_MOTION);
    ResetModes(KEY_PRESSED);

    while(SDL_PollEvent(&event))
    {
	switch(event.type)
	{
	    case SDL_ACTIVEEVENT:
		if(event.active.state & SDL_APPACTIVE)
		{
#ifdef WITH_MIXER
		    if(Mixer::isValid())
		    {
			//iconify
			if(0 == event.active.gain)
			{
			    Mixer::Reset();
			    Music::Pause();
			    loop_delay = 100;
			}
			else
			    loop_delay = 1;
		    }
#endif
		}
		break;

	    // keyboard
	    case SDL_KEYDOWN:
	    case SDL_KEYUP:
                HandleKeyboardEvent(event.key);
	    	break;

	    // mouse motion
	    case SDL_MOUSEMOTION:
		HandleMouseMotionEvent(event.motion);
		break;

	    // mouse button
	    case SDL_MOUSEBUTTONDOWN:
	    case SDL_MOUSEBUTTONUP:
		HandleMouseButtonEvent(event.button);
		break;
	
	    // exit
	    case SDL_QUIT:
		Error::Except(__FUNCTION__, "SDL_QUIT");
		return false;

	    default:
		break;
	}

        // need for wheel up/down delay
        if(SDL_BUTTON_WHEELDOWN == event.button.button || SDL_BUTTON_WHEELUP == event.button.button) break;
    }

    // emulate press right
    if((modes & TAP_MODE) && (modes & CLOCK_ON))
    {
	clock.Stop();
	if(clock_delay < clock.Get())
	{
	    ResetModes(CLICK_LEFT);
	    ResetModes(CLOCK_ON);
	    mouse_pr = mouse_cu;
	    SetModes(MOUSE_PRESSED);
	    mouse_button = SDL_BUTTON_RIGHT;
	}
    }

    if(delay) SDL_Delay(loop_delay);

    return true;
}
void LocalEvent::SetMouseOffsetY(s16 y)
{
    SetModes(MOUSE_OFFSET);
    mouse_st.y = y;
}
Exemple #21
0
bool
SerialDevice::Service(struct tty *ptty, struct ddrover *ddr, uint flags)
{
	if (&fTTY != ptty)
		return false;

	if (flags <= TTYGETSIGNALS) {
		switch (flags) {
			case TTYENABLE:
				TRACE("TTYENABLE\n");
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDCD, false);
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, true);
				fControlOut = CLS_LINE_DTR | CLS_LINE_RTS;
				SetControlLineState(fControlOut);
				break;

			case TTYDISABLE:
				TRACE("TTYDISABLE\n");
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDCD, false);
				fControlOut = 0x0;
				SetControlLineState(fControlOut);
				break;

			case TTYISTOP:
				TRACE("TTYISTOP\n");
				fInputStopped = true;
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, false);
				break;

			case TTYIRESUME:
				TRACE("TTYIRESUME\n");
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, true);
				fInputStopped = false;
				break;

			case TTYGETSIGNALS:
				TRACE("TTYGETSIGNALS\n");
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDCD, true);
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, true);
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDSR, false);
				gTTYModule->ttyhwsignal(ptty, ddr, TTYHWRI, false);
				break;

			case TTYSETMODES:
				TRACE("TTYSETMODES\n");
				SetModes();
				break;

			case TTYOSTART:
			case TTYOSYNC:
			case TTYSETBREAK:
			case TTYCLRBREAK:
			case TTYSETDTR:
			case TTYCLRDTR:
				TRACE("TTY other\n");
				break;
		}

		return true;
	}

	return false;
}
void LocalEvent::SetGlobalFilter(bool f)
{
    f ? SetModes(GLOBAL_FILTER) : ResetModes(GLOBAL_FILTER);
}
void Kingdom::OverviewDialog(void)
{
    Display & display = Display::Get();
    Cursor & cursor = Cursor::Get();
    cursor.Hide();
    cursor.SetThemes(cursor.POINTER);

    Dialog::FrameBorder background(Size(640, 480));

    const Point & cur_pt = background.GetArea();
    Point dst_pt(cur_pt);

    AGG::GetICN(ICN::OVERBACK, 0).Blit(dst_pt);

    RedrawIncomeInfo(cur_pt, *this);
    RedrawFundsInfo(cur_pt, *this);

    StatsHeroesList listHeroes(dst_pt, heroes);
    StatsCastlesList listCastles(dst_pt, castles);

    // buttons
    dst_pt.x = cur_pt.x + 540;
    dst_pt.y = cur_pt.y + 360;
    Button buttonHeroes(dst_pt.x, dst_pt.y, ICN::OVERVIEW, 0, 1);

    dst_pt.x = cur_pt.x + 540;
    dst_pt.y = cur_pt.y + 405;
    Button buttonCastle(dst_pt.x, dst_pt.y, ICN::OVERVIEW, 2, 3);

    dst_pt.x = cur_pt.x + 540;
    dst_pt.y = cur_pt.y + 453;
    Button buttonExit(dst_pt.x, dst_pt.y, ICN::OVERVIEW, 4, 5);

    const Rect rectIncome(cur_pt.x + 1, cur_pt.y + 360, 535, 60);

    Interface::ListBasic* listStats = NULL;

    // set state view: castles
    if(Modes(OVERVIEWCSTL))
    {
	buttonCastle.Press();
	buttonHeroes.Release();
	listStats = &listCastles;
    }
    else
    // set state view: heroes
    {
	buttonHeroes.Press();
	buttonCastle.Release();
	listStats = &listHeroes;
    }

    listStats->Redraw();

    buttonHeroes.Draw();
    buttonCastle.Draw();
    buttonExit.Draw();

    cursor.Show();
    display.Flip();

    LocalEvent & le = LocalEvent::Get();

    // dialog menu loop
    while(le.HandleEvents())
    {
	le.MousePressLeft(buttonExit) ? buttonExit.PressDraw() : buttonExit.ReleaseDraw();

	// switch view: heroes/castle
	if(buttonHeroes.isReleased() &&
	    le.MouseClickLeft(buttonHeroes))
	{
	    cursor.Hide();
	    buttonHeroes.Press();
	    buttonCastle.Release();
	    buttonHeroes.Draw();
	    buttonCastle.Draw();
	    listStats = &listHeroes;
	    ResetModes(OVERVIEWCSTL);
	}
	else
	if(buttonCastle.isReleased() &&
	    le.MouseClickLeft(buttonCastle))
	{
	    cursor.Hide();
	    buttonCastle.Press();
	    buttonHeroes.Release();
	    buttonHeroes.Draw();
	    buttonCastle.Draw();
	    listStats = &listCastles;
	    SetModes(OVERVIEWCSTL);
	}

	// exit event
	if(le.MouseClickLeft(buttonExit) ||
	    Game::HotKeyPressEvent(Game::EVENT_DEFAULT_EXIT)) break;

	listStats->QueueEventProcessing();

        if(le.MouseClickLeft(rectIncome))
            Dialog::ResourceInfo("", "income:", GetIncome(INCOME_ALL), Dialog::OK);
        else
        if(le.MousePressRight(rectIncome))
            Dialog::ResourceInfo("", "income:", GetIncome(INCOME_ALL), 0);

	// redraw
	if(! cursor.isVisible())
	{
	    listStats->Redraw();
	    RedrawFundsInfo(cur_pt, *this);
	    cursor.Show();
	    display.Flip();
	}
    }
}