当前位置: 首页>>代码示例>>C++>>正文


C++ CClipboard::GetContents方法代码示例

本文整理汇总了C++中CClipboard::GetContents方法的典型用法代码示例。如果您正苦于以下问题:C++ CClipboard::GetContents方法的具体用法?C++ CClipboard::GetContents怎么用?C++ CClipboard::GetContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CClipboard的用法示例。


在下文中一共展示了CClipboard::GetContents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PasteClipboard

void CGameController::PasteClipboard()
{
	CClipboard clipboard;
	const std::string text = clipboard.GetContents();
	userInput.insert(writingPos, text);
	writingPos += text.length();
}
开发者ID:Mocahteam,项目名称:SpringPP,代码行数:7,代码来源:GameController.cpp

示例2: KeyPressed

int CPreGame::KeyPressed(unsigned short k,bool isRepeat)
{
	if (k == SDLK_ESCAPE){
		if(keys[SDLK_LSHIFT]){
			logOutput.Print("User exited");
			globalQuit=true;
		} else
			logOutput.Print("Use shift-esc to quit");
	}
	if(showList){					//are we currently showing a list?
		showList->KeyPressed(k, isRepeat);
		return 0;
	}

	if (userWriting){
		keys[k] = true;
		if (k == SDLK_v && keys[SDLK_LCTRL]){
			CClipboard clipboard;
			userInput += clipboard.GetContents();
			return 0;
		}
		if(k == SDLK_BACKSPACE){ //backspace
			if(userInput.size()!=0)
				userInput.erase(userInput.size()-1,1);
			return 0;
		}
		if(k == SDLK_RETURN){
			userWriting=false;
			return 0;
		}
		return 0;
	}

	return 0;
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:35,代码来源:PreGame.cpp

示例3: KeyPressed

int CPreGame::KeyPressed(unsigned short k,bool isRepeat)
{
    if (k == SDLK_ESCAPE) {
        if(keys[SDLK_LSHIFT]) {
            logOutput.Print("User exited");
            globalQuit=true;
        } else
            logOutput.Print("Use shift-esc to quit");
    }
    if(showList) {					//are we currently showing a list?
        showList->KeyPressed(k, isRepeat);
        return 0;
    }

    if (userWriting) {
        keys[k] = true;
        if (k == SDLK_v && keys[SDLK_LCTRL]) {
            CClipboard clipboard;
            const string text = clipboard.GetContents();
            userInput.insert(writingPos, text);
            writingPos += text.length();
            return 0;
        }
        if(k == SDLK_BACKSPACE) {
            if (!userInput.empty() && (writingPos > 0)) {
                userInput.erase(writingPos - 1, 1);
                writingPos--;
            }
            return 0;
        }
        if(k == SDLK_DELETE) {
            if (!userInput.empty() && (writingPos < (int)userInput.size())) {
                userInput.erase(writingPos, 1);
            }
            return 0;
        }
        else if(k==SDLK_LEFT) {
            writingPos = max(0, min((int)userInput.length(), writingPos - 1));
        }
        else if(k==SDLK_RIGHT) {
            writingPos = max(0, min((int)userInput.length(), writingPos + 1));
        }
        else if(k==SDLK_HOME) {
            writingPos = 0;
        }
        else if(k==SDLK_END) {
            writingPos = (int)userInput.length();
        }
        if(k == SDLK_RETURN) {
            userWriting=false;
            return 0;
        }
        return 0;
    }

    return 0;
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:57,代码来源:PreGame.cpp


注:本文中的CClipboard::GetContents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。