Skip to content

Commit 65a897b

Browse files
committed
Use F1 to toggle fullscreen.
1 parent 5f93431 commit 65a897b

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎src/ag.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ int winGame = 0;
137137

138138
int letterSpeed = LETTER_FAST;
139139

140+
int fullscreen = 0;
141+
SDL_Window *window;
142+
140143
/* Graphics cache */
141144
SDL_Texture* backgroundTex = NULL;
142145
SDL_Texture* letterBank = NULL;
@@ -635,7 +638,7 @@ handleKeyboardEvent(SDL_Event *event, struct node* head,
635638
struct sprite** letters)
636639
{
637640
struct sprite* current = *letters;
638-
char keyedLetter;
641+
int keyedLetter;
639642
int maxIndex = 0;
640643

641644
keyedLetter = event->key.keysym.sym;
@@ -649,6 +652,14 @@ handleKeyboardEvent(SDL_Event *event, struct node* head,
649652
clearGuess = 1;
650653
break;
651654

655+
case SDLK_F1:
656+
if (fullscreen == 0)
657+
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
658+
else
659+
SDL_SetWindowFullscreen(window, 0);
660+
fullscreen = !fullscreen;
661+
break;
662+
652663
case SDLK_BACKSPACE:
653664
while (current!=NULL&&current->box!=CONTROLS){
654665
if (current->box == ANSWER && current->index > maxIndex) maxIndex = current->index;
@@ -1840,7 +1851,6 @@ main(int argc, char *argv[])
18401851
{
18411852
struct node* head = NULL;
18421853
struct dlb_node* dlbHead = NULL;
1843-
SDL_Window *window;
18441854
struct sprite* letters = NULL;
18451855

18461856
/* buffer sounds */

0 commit comments

Comments
 (0)