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

Fix fullscreen toggle #25

Merged
merged 1 commit into from
Jan 8, 2020
Merged
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
5 changes: 3 additions & 2 deletions assignments/hw3/src/flat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,8 @@ void KeyCallback(GLFWwindow *Window, int Key, int ScanCode, int Action, int Mods
ON_KEY(X) TheState.ResetSpeed();
ON_KEY(I) TheState.ResetPositionAndCamera();

if (glfwGetKey(Window, GLFW_KEY_P) == GLFW_PRESS && !TheState.Window.FullScreenKeyDown) {
auto KeyState = glfwGetKey(Window, GLFW_KEY_P);
if (KeyState == GLFW_PRESS && !TheState.Window.FullScreenKeyDown) {
TheState.Window.FullScreenKeyDown = true;

if (!TheState.Window.IsFullScreen) {
Expand Down Expand Up @@ -408,7 +409,7 @@ void KeyCallback(GLFWwindow *Window, int Key, int ScanCode, int Action, int Mods
TheState.Window.IsFullScreen = false;
}

} else if (Key == GLFW_RELEASE && TheState.Window.FullScreenKeyDown) {
} else if (KeyState == GLFW_RELEASE && TheState.Window.FullScreenKeyDown) {
TheState.Window.FullScreenKeyDown = false;
}

Expand Down