BGE: Adding a render.setFullScreen() and a render.getFullScreen() to allow fulscreeni...
authorMitchell Stokes <mogurijin@gmail.com>
Sat, 13 Apr 2013 21:09:02 +0000 (21:09 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Sat, 13 Apr 2013 21:09:02 +0000 (21:09 +0000)
doc/python_api/rst/bge.render.rst
source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
source/gameengine/GamePlayer/ghost/GPG_Canvas.h
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Rasterizer/RAS_ICanvas.h

index e203826d318d5cecaf8c7b05a9c8b2cc768078c6..fbf20eeccaf147e76f82b547e4a15a0cfbd829ef 100644 (file)
@@ -86,6 +86,17 @@ Functions
    :type width: integer
    :type height: integer
 
+.. function:: setFullScreen(enable)
+
+   Set whether or not the window should be fullscreen.
+   
+   :type enable: bool
+
+.. function:: getFullScreen()
+
+   Returns whether or not the window is fullscreen.
+   
+   :rtype: bool
 
 .. function:: makeScreenshot(filename)
 
index e15b8ac942fcc0624d03a1e32497448efd57c2c8..b6c41064282e1019c79a22f3814d1cb907161d59 100644 (file)
@@ -70,6 +70,17 @@ void KX_BlenderCanvas::ResizeWindow(int width, int height)
        // Not implemented for the embedded player
 }
 
+void KX_BlenderCanvas::SetFullScreen(bool enable)
+{
+       // Not implemented for the embedded player
+}
+
+bool KX_BlenderCanvas::GetFullScreen()
+{
+       // Not implemented for the embedded player
+       return false;
+}
+
 void KX_BlenderCanvas::BeginFrame()
 {
        glEnable(GL_DEPTH_TEST);
index 430f956bc7f32b08dc3d59ea9b5f40439edc69bc..bc487504eeb0d4fb746911fa942704700c9c01d6 100644 (file)
@@ -85,6 +85,14 @@ public:
                int height
        );
 
+               void
+       SetFullScreen(
+               bool enable
+       );
+
+               bool
+       GetFullScreen();
+
                void
        BeginFrame(
        );
index 9b01cb5786f3523bd49342175e20e2665be129e5..c438dcdd4a6e4be0433e6fb7dc8f0d1634c04577 100644 (file)
@@ -128,6 +128,19 @@ void GPG_Canvas::ResizeWindow(int width, int height)
        Resize(width, height);
 }
 
+void GPG_Canvas::SetFullScreen(bool enable)
+{
+       if (enable)
+               m_window->setState(GHOST_kWindowStateFullScreen);
+       else
+               m_window->setState(GHOST_kWindowStateNormal);
+}
+
+bool GPG_Canvas::GetFullScreen()
+{
+       return m_window->getState() == GHOST_kWindowStateFullScreen;
+}
+
 float GPG_Canvas::GetMouseNormalizedX(int x)
 {
        return float(x)/this->GetWidth();
index 440fd2bba27f1bdc5bc1780b504ff91fe4c33bec..6168d96b3371cade1e64dce91e9abcf01514fad2 100644 (file)
@@ -61,6 +61,8 @@ public:
        virtual float GetMouseNormalizedY(int y);
 
        virtual void ResizeWindow(int width, int height);
+       virtual void SetFullScreen(bool enable);
+       virtual bool GetFullScreen();
 
        bool BeginDraw() { return true; }
        void EndDraw() {};
index 0bdf08bc25f40f10732c81a61c05eaff33b05c16..af6297369bde45fe1bee014edf85274e0f16feea 100644 (file)
@@ -1327,6 +1327,17 @@ static PyObject *gPySetWindowSize(PyObject *, PyObject *args)
        Py_RETURN_NONE;
 }
 
+static PyObject *gPySetFullScreen(PyObject *, PyObject *value)
+{
+       gp_Canvas->SetFullScreen(PyObject_IsTrue(value));
+       Py_RETURN_NONE;
+}
+
+static PyObject *gPyGetFullScreen(PyObject *)
+{
+       return PyBool_FromLong(gp_Canvas->GetFullScreen());
+}
+
 static struct PyMethodDef rasterizer_methods[] = {
        {"getWindowWidth",(PyCFunction) gPyGetWindowWidth,
         METH_VARARGS, "getWindowWidth doc"},
@@ -1368,6 +1379,8 @@ static struct PyMethodDef rasterizer_methods[] = {
        {"drawLine", (PyCFunction) gPyDrawLine,
         METH_VARARGS, "draw a line on the screen"},
        {"setWindowSize", (PyCFunction) gPySetWindowSize, METH_VARARGS, ""},
+       {"setFullScreen", (PyCFunction) gPySetFullScreen, METH_O, ""},
+       {"getFullScreen", (PyCFunction) gPyGetFullScreen, METH_NOARGS, ""},
        { NULL, (PyCFunction) NULL, 0, NULL }
 };
 
index 63ad7892aa5bbfc4b095528fa9be8e464b63084b..1b1e43a52572ed0b9009f76f8f20005405c94ab2 100644 (file)
@@ -232,6 +232,16 @@ public:
                int height
        )=0;
 
+       virtual
+               void
+       SetFullScreen(
+               bool enable
+       )=0;
+
+       virtual
+               bool
+       GetFullScreen()=0;
+
                
        
 protected: