Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
better full screen toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
corwinn committed Apr 13, 2023
1 parent 9397154 commit f4525d6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions snow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/freeglut.h>
#include <GL/freeglut_ext.h>
#ifdef _WIN32
#include <GL/glext.h>
#endif
Expand Down Expand Up @@ -359,21 +360,18 @@ static void glutReshape(GLsizei width, GLsizei height)

static GLvoid glutKeyPressed(unsigned char key, int, int)
{
static int x = 0, y = 0, w = 320, h = 200;
if ('p' == key) paused = ! paused;
else if ('q' == key) exit (0);
//D else if ('a' == key) ry += 1.f;
//D else if ('d' == key) ry -= 1.f;
else if (key == 'f') {
//TODO this doesn't seem to be taking care of NC and decorations
if (!fs) {
x = glutGet (GLUT_WINDOW_X), y = glutGet (GLUT_WINDOW_Y);
w = glutGet (GLUT_WINDOW_WIDTH), h = glutGet (GLUT_WINDOW_HEIGHT);
glutFullScreen ();
fs = true;
glutFullScreenToggle (), fs = true;
mouse_moved = time (0);
} else
glutSetCursor (GLUT_CURSOR_INHERIT),
glutReshapeWindow (w, h), glutPositionWindow (x, y), fs = false;
glutSetCursor (GLUT_CURSOR_INHERIT), glutFullScreenToggle (),
fs = false;
}
}

Expand Down

0 comments on commit f4525d6

Please sign in to comment.