Named the game mode fullscreen window after the mode string.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37891 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2010-08-04 00:14:40 +00:00
parent 9f11a87e65
commit 90bff7f0ed
+15 -4
View File
@@ -7,10 +7,13 @@
*/ */
#include <GL/glut.h> #include "glutGameMode.h"
#include "glutint.h" #include "glutint.h"
#include "glutState.h" #include "glutState.h"
#include "glutBlocker.h" // #include "glutBlocker.h"
#include <GL/glut.h>
#include <String.h>
#include <stdio.h> #include <stdio.h>
@@ -110,14 +113,22 @@ GlutGameMode::Enter()
screen.GetMode(fGameModeWorkspace, &fCurrentMode); screen.GetMode(fGameModeWorkspace, &fCurrentMode);
// create a new window in full screen // create a new window in full screen
glutCreateWindow("glutGameMode"); BString name;
name << "Game Mode " << fCurrentMode.virtual_width
<< "x" << fCurrentMode.virtual_height
<< ":" << _GetModePixelDepth(&fCurrentMode)
<< "@" << _GetModeRefreshRate(&fCurrentMode);
glutCreateWindow(name.String());
BDirectWindow *directWindow BDirectWindow *directWindow
= dynamic_cast<BDirectWindow*>(gState.currentWindow->Window()); = dynamic_cast<BDirectWindow*>(gState.currentWindow->Window());
if (directWindow == NULL) if (directWindow == NULL)
// Hum?! // Hum?!
return B_ERROR; return B_ERROR;
directWindow->Lock();
directWindow->SetFullScreen(true); directWindow->SetFullScreen(true);
directWindow->Unlock();
fDisplayChanged = true; fDisplayChanged = true;
fActive = true; fActive = true;
@@ -160,7 +171,7 @@ GlutGameMode::_FindMatchingMode()
// Lazy retrieval of supported modes... // Lazy retrieval of supported modes...
BScreen screen; BScreen screen;
if (screen.GetModeList(&fModesList, &fModesCount) == B_OK) { if (screen.GetModeList(&fModesList, &fModesCount) == B_OK) {
// sort modes // sort modes in decrease order (resolution, depth, frequency)
qsort(fModesList, fModesCount, sizeof(display_mode), _CompareModes); qsort(fModesList, fModesCount, sizeof(display_mode), _CompareModes);
} else { } else {
// bad luck, no modes can be retrieved! // bad luck, no modes can be retrieved!