40 #ifndef _graphicsgamewindow_cpp
41 #define _graphicsgamewindow_cpp
44 #include "Graphics/gamewindow.h"
45 #include "crossplatform.h"
46 #include "Graphics/viewport.h"
48 #include "graphicsmanager.h"
61 #include <Cocoa/Cocoa.h>
65 #include "../src/video/SDL_sysvideo.h"
81 SDL_WindowUserData* WindowData = this->
SDLWindow->data;
89 Ogre::Root::getSingleton().destroyRenderTarget(
OgreWindow);
105 Opts[
"hidden"] =
"true";
109 Opts[
"vsync"] =
"true";
124 Opts[
"border"] =
"resize";
126 Opts[
"border"] =
"none";
128 Opts[
"border"] =
"fixed";
136 Opts[
"macAPI"] =
"cocoa";
142 this->
OgreWindow = Ogre::Root::getSingleton().createRenderWindow(WindowCaption, this->
Settings.
RenderWidth, this->Settings.RenderHeight, this->Settings.Fullscreen, &Opts);
154 this->
OgreWindow->getCustomAttribute(
"WINDOW",&Data);
155 this->
SDLWindow = SDL_CreateWindowFrom((
void*)Data);
156 this->
SDLWindow->data =
new SDL_WindowUserData();
175 SDL_DisplayMode DesktopDisplay;
176 SDL_GetDesktopDisplayMode(0,&DesktopDisplay);
177 if(Width >
Whole(DesktopDisplay.w) || Height >
Whole(DesktopDisplay.h))
179 else if(Width ==
Whole(DesktopDisplay.w) || Height ==
Whole(DesktopDisplay.h))
194 if( (*ViewIt)->GetZOrder() > ZOrder ) {
195 this->
Viewports.insert( ViewIt, NewViewport );
200 this->
Viewports.push_back( NewViewport );
218 if( (*ViewIt)->GetZOrder() == ZOrder ) {
234 if ( ToBeDestroyed == (*ViewIt) ) {
235 delete ToBeDestroyed;
300 SDL_DisplayMode CurrentDisplay;
301 SDL_GetWindowDisplayMode(
SDLWindow,&CurrentDisplay);
302 CurrentDisplay.w = Width;
303 CurrentDisplay.h = Height;
305 if(SDL_SetWindowDisplayMode(
SDLWindow,&CurrentDisplay) == 0)
307 this->
OgreWindow->setFullscreen(
true,Width,Height);
316 Whole ResultWidth, ResultHeight;
318 SDL_SetWindowSize(
SDLWindow,ResultWidth,ResultHeight);
319 this->
OgreWindow->setFullscreen(
false,ResultWidth,ResultHeight);
320 }
else if(Result == 1){
324 SDL_SetWindowSize(
SDLWindow,Width,Height);
325 this->
OgreWindow->setFullscreen(
false,Width,Height);
335 static SDL_DisplayMode FSDisplayMode;
347 Whole ResultWidth, ResultHeight;
357 SDL_SetWindowDisplayMode(
SDLWindow,&FSDisplayMode);
360 if(SDL_SetWindowFullscreen(
SDLWindow, Fullscreen?SDL_TRUE:SDL_FALSE ) == 0) {
393 { this->
OgreWindow->setVSyncEnabled(Enable); }
396 {
return this->
OgreWindow->isVSyncEnabled(); }
426 {
return this->
OgreWindow->getBestFrameTime(); }
429 {
return this->
OgreWindow->getWorstFrameTime(); }