Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SDL_WINDOW_FULLSCREEN_DESKTOP in SDL2 builds #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/sdl2/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void initializeVideo(uint8_t fastMode)
exit(1);
}

// TODO: Use SDL_WINDOW_FULLSCREEN_DESKTOP in console ports?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we don't, since there is no concept of Desktop in them 🤔

gWindow = SDL_CreateWindow("OpenSupaplex",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
Expand Down Expand Up @@ -232,7 +233,7 @@ void toggleFullscreen()

void setFullscreenMode(uint8_t fullscreen)
{
SDL_SetWindowFullscreen(gWindow, fullscreen ? SDL_WINDOW_FULLSCREEN : 0);
SDL_SetWindowFullscreen(gWindow, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any consequence of this in scaling or rendering or does it Just Work© in any resolution the user has?

}

uint8_t getFullscreenMode(void)
Expand Down
12 changes: 11 additions & 1 deletion src/supaplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ uint8_t isJoystickEnabled = 0; // byte_50940
uint8_t isMusicEnabled = 0; // byte_59886
uint8_t isFXEnabled = 0; // byte_59885

uint8_t isFullScreenKeyPressed = 0;

uint8_t gIsFlashingBackgroundModeEnabled = 0; // flashingbackgroundon
const float kSpeedTimeFactors[kNumberOfGameSpeeds] = { 3.5, 3.0, 2.5, 2.0, 1.5, 1.0, 0.75, 2.0 / 3.0, 5.0 / 8.0, 3.0 / 5.0, 1.0 / 70.0 };

Expand Down Expand Up @@ -1902,7 +1904,15 @@ void int9handler(uint8_t shouldYieldCpu) // proc far ; DATA XREF: setint9

if (gIsLeftAltPressed && gIsEnterPressed)
{
toggleFullscreen();
if (!isFullScreenKeyPressed)
{
toggleFullscreen();
}
isFullScreenKeyPressed = 1;
}
else
{
isFullScreenKeyPressed = 0;
}

//storeKey: ; CODE XREF: int9handler+2Bj
Expand Down