本文整理汇总了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();
}
示例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;
}
示例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;
}