Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added simple clipboard test
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 8, 2010
1 parent 11ee361 commit 5a5ce0c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/common.c
Expand Up @@ -1050,6 +1050,25 @@ CommonEvent(CommonState * state, SDL_Event * event, int *done)
case SDL_KEYDOWN:
switch (event->key.keysym.sym) {
/* Add hotkeys here */
case SDLK_c:
if (event->key.keysym.mod & KMOD_CTRL) {
/* Ctrl-C copy awesome text! */
SDL_SetClipboardText("SDL rocks!\nYou know it!");
printf("Copied text to clipboard\n");
}
break;
case SDLK_v:
if (event->key.keysym.mod & KMOD_CTRL) {
/* Ctrl-V paste awesome text! */
char *text = SDL_GetClipboardText();
if (*text) {
printf("Clipboard: %s\n", text);
} else {
printf("Clipboard is empty\n");
}
SDL_free(text);
}
break;
case SDLK_g:
if (event->key.keysym.mod & KMOD_CTRL) {
/* Ctrl-G toggle grab */
Expand Down

0 comments on commit 5a5ce0c

Please sign in to comment.