示例#1
0
	/**
	 * Moves the window so #newtop is new 'top' coordinate. Makes screen dirty where needed.
	 * @param newtop new top coordinate
	 */
	void SetWindowTop(int newtop)
	{
		if (this->top == newtop) return;

		int mintop = min(newtop, this->top);
		int maxtop = max(newtop, this->top);
		if (this->viewport != NULL) this->viewport->top += newtop - this->top;
		this->top = newtop;

		SetDirtyBlocks(this->left, mintop, this->left + this->width, maxtop + this->height);
	}
示例#2
0
	virtual void OnTick()
	{
		/* Scroll up newsmessages from the bottom in steps of 4 pixels */
		int y = max(this->top - 4, _screen.height - this->height - this->status_height - this->chat_height);
		if (y == this->top) return;

		if (this->viewport != NULL) this->viewport->top += y - this->top;

		int diff = Delta(this->top, y);
		this->top = y;

		SetDirtyBlocks(this->left, this->top, this->left + this->width, this->top + this->height + diff);
	}
示例#3
0
/**
 * Show build confirmation window under the mouse cursor
*/
void ShowBuildConfirmationWindow()
{
	HideBuildConfirmationWindow();

	if (!_settings_client.gui.build_confirmation || _shift_pressed) {
		ConfirmPlacingObject();
		ToolbarSelectLastTool();
		return;
	}

	BuildConfirmationWindow *w = new BuildConfirmationWindow(&_build_confirmation_desc);

	int old_left = w->left;
	int old_top = w->top;
	w->left = _cursor.pos.x - w->width / 2;
	w->top = _cursor.pos.y - w->height / 4;
	w->viewport->left += w->left - old_left;
	w->viewport->top += w->top - old_top;
	w->SetDirty();
	SetDirtyBlocks(0, 0, _screen.width, _screen.height); // I don't know what does this do, but it looks important
}