Tetris: make playable on macOS

This commit is contained in:
zv0n 2020-10-20 11:04:07 +02:00
parent 13d18d071f
commit 5ec4182519
2 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
CXX ?= g++
CFLAGS ?= -O2 -Wall -Wextra
CFLAGS ?= -O2 -Wall -Wextra -std=c++14
PREFIX ?= /usr/local/bin
LDFLAGS ?= -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -pthread

View File

@ -389,7 +389,8 @@ void handleKeyUpMain( SDL_Keycode key ) {
void pollEventsMain( SDLPP::Scene &scene ) {
SDL_Event event;
while ( SDL_PollEvent( &event ) != 0 ) {
while ( SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 ) {
SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
switch ( event.type ) {
case SDL_QUIT:
quitGame();
@ -501,7 +502,8 @@ void handleKeyDownMenu( SDL_Keycode key ) {
void pollEventsMenu() {
SDL_Event event;
while ( SDL_PollEvent( &event ) != 0 ) {
while ( SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 ) {
SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
switch ( event.type ) {
case SDL_QUIT:
quitGame();
@ -566,7 +568,8 @@ void handleKeyDownGameOver( SDL_Keycode key ) {
void pollEventsGameOver() {
SDL_Event event;
while ( SDL_PollEvent( &event ) != 0 ) {
while ( SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 ) {
SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
switch ( event.type ) {
case SDL_QUIT:
quitGame();
@ -689,7 +692,8 @@ void handleKeyDownOptions( SDL_Keycode key ) {
void pollEventsOptions() {
SDL_Event event;
while ( SDL_PollEvent( &event ) != 0 ) {
while ( SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1 ) {
SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT);
switch ( event.type ) {
case SDL_QUIT:
quitGame();