示例#1
0
void KstJS::doShow(bool show) {
  if (show) {
    showConsole();
  } else {
    hideConsole();
  }
}
示例#2
0
void DBConsole::init() {
	//Init Vars
	firstTimeMillis = getSystemCurrTimeMillis();

	//Init KeyStates
	for(int p = 0; p < (sizeof(currKeyStates)/sizeof(bool)); p++) {
		currKeyStates[p] = false;
	}

	// Init Arrays
	for (int x = 0; x < BUFFER_W; x++) {
		for (int y = 0; y < BUFFER_H; y++) {
			buffer[x][y] = ' ';
			display[x][y] = ' ';
		}
	}

	// Hide Cursor
	showConsoleCursor(false);

	// Set Size
	setDimensions(BUFFER_W, BUFFER_H);

	//Show Console
	if (! SHOWCONSOLE) {
		hideConsole();
	}
}
示例#3
0
	// -----------------------------------
	void GUIService::onShowConsole(const InputEventMsg& iem) {
		if (mConsole && mConsole->isActive()) {
			hideConsole();
		} else {
			showConsole();
		}
	}
示例#4
0
文件: Logger.c 项目: gullz/TestLog
void main( int arg, char * argz[] )
{
  hideConsole();
  CheckPara( arg, argz );
  CreateLog( argz[1] );
  AddStamp();
  CreateThread(NULL,0,&runServer,NULL,0,NULL);
  saveActiveWindow();
}
示例#5
0
	// -----------------------------------
	void GUIService::setVisible(bool visible) {
		mVisible = visible;

		if (!mVisible) {
			if (mConsole->isActive())
				hideConsole();

			setActive(false);
		}

	}
示例#6
0
void GameConsole::virtualKeyCallBack(USHORT vKey)
{
	if (!showChat && !showConsole)
	{
		if (GetAsyncKeyState(VK_TAB) & 0x8000)
		{
			return;
		}

		if (vKey == VK_RETURN)
		{
			displayChat(false);
		}

		if (vKey == VK_OEM_3 || vKey == VK_OEM_8) // ` key for US and UK (todo: only use one or the other, since VK_OEM_3 is @ on UK keyboards)
		{
			displayChat(true);
		}

		// TODO: TEMP: remove
		if (vKey == VK_F11)
		{
			Menu::Instance().menuEnabled = !Menu::Instance().menuEnabled;
		}
		return;
	}

	switch (vKey)
	{
	case VK_RETURN:
		if (!currentInput.currentInput.empty())
		{
			selectedQueue->unchangingBacklog.push_back(currentInput.currentInput);
			selectedQueue->pushLineFromKeyboardToGame(currentInput.currentInput);
			selectedQueue->startIndexForScrolling = 0;
		}
		hideConsole();
		break;

	case VK_ESCAPE:
		hideConsole();
		break;

	case VK_BACK:
		if (!currentInput.currentInput.empty())
		{
			currentInput.backspace();
		}
		break;

	case VK_DELETE:
		if (!currentInput.currentInput.empty())
		{
			currentInput.del();
		}
		break;

	case VK_CAPITAL:
		capsLockToggled = !capsLockToggled;
		break;

	case VK_PRIOR: // PAGE UP
		if (selectedQueue->startIndexForScrolling < selectedQueue->numOfLinesBuffer - selectedQueue->numOfLinesToShow)
		{
			selectedQueue->startIndexForScrolling++;
		}
		break;

	case VK_NEXT: // PAGE DOWN
		if (selectedQueue->startIndexForScrolling > 0)
		{
			selectedQueue->startIndexForScrolling--;
		}
		break;

	case VK_UP:
		currentBacklogIndex++;
		if (currentBacklogIndex > (int)selectedQueue->unchangingBacklog.size() - 1)
		{
			currentBacklogIndex--;
		}
		if (currentBacklogIndex >= 0)
		{
			currentInput.currentInput = selectedQueue->unchangingBacklog.at(selectedQueue->unchangingBacklog.size() - currentBacklogIndex - 1);
		}
		break;

	case VK_DOWN:
		currentBacklogIndex--;
		if (currentBacklogIndex < 0)
		{
			currentBacklogIndex = -1;
			currentInput.currentInput = "";
		}
		else
		{
			currentInput.currentInput = selectedQueue->unchangingBacklog.at(selectedQueue->unchangingBacklog.size() - currentBacklogIndex - 1);
		}
		break;

	case VK_LEFT:
		currentInput.left();
		break;

	case VK_RIGHT:
		currentInput.right();
		break;

	case VK_TAB:
		if (showChat)
		{
			if (selectedQueue == &globalChatQueue)
			{
				SwitchToGameChat();
				break;
			}
			else if (selectedQueue == &gameChatQueue)
			{
				SwitchToGlobalChat();
				break;
			}
		}
		
		if (currentInput.currentInput.find_first_of(" ") == std::string::npos && currentInput.currentInput.length() > 0)
		{
			if (tabHitLast)
			{
				if (currentCommandList.size() > 0)
				{
					currentInput.set(currentCommandList.at((++tryCount) % currentCommandList.size()));
				}
			}
			else
			{
				tryCount = 0;
				currentCommandList.clear();
				commandPriorComplete = currentInput.currentInput;

				auto currentLine = currentInput.currentInput;
				std::transform(currentLine.begin(), currentLine.end(), currentLine.begin(), ::tolower);

				for (auto cmd : Modules::CommandMap::Instance().Commands)
				{
					auto commandName = cmd.Name;
					std::transform(commandName.begin(), commandName.end(), commandName.begin(), ::tolower);

					if (commandName.compare(0, currentLine.length(), currentLine) == 0)
					{
						currentCommandList.push_back(commandName);
					}
				}
				consoleQueue.pushLineFromGameToUI(std::to_string(currentCommandList.size()) + " commands found starting with \"" + currentLine + ".\"");
				consoleQueue.pushLineFromGameToUI("Press tab to go through them.");
			}
		}
		break;

	case 'V':
		if (GetAsyncKeyState(VK_LCONTROL) & 0x8000 || GetAsyncKeyState(VK_RCONTROL) & 0x8000) // CTRL+V pasting
		{
			if (OpenClipboard(nullptr))
			{
				HANDLE hData = GetClipboardData(CF_TEXT);
				if (hData)
				{
					char* textPointer = static_cast<char*>(GlobalLock(hData));
					std::string text(textPointer);
					std::string newInputLine = currentInput.currentInput + text;

					for(char c : text) {
						if (currentInput.currentInput.size() <= INPUT_MAX_CHARS)
						{
							currentInput.type(c);
						}
					}

					GlobalUnlock(hData);
				}
				CloseClipboard();
			}
		}
		else
		{
			handleDefaultKeyInput(vKey);
		}
		break;

	default:
		handleDefaultKeyInput(vKey);
		break;
	}

	tabHitLast = vKey == VK_TAB;
}