BGE: Adding a render.setFullScreen() and a render.getFullScreen() to allow fulscreening games via Python.
This commit is contained in:
parent
81cfbaacb0
commit
dbf4328f3f
@ -86,6 +86,17 @@ Functions
|
|||||||
:type width: integer
|
:type width: integer
|
||||||
:type height: 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)
|
.. function:: makeScreenshot(filename)
|
||||||
|
|
||||||
|
@ -70,6 +70,17 @@ void KX_BlenderCanvas::ResizeWindow(int width, int height)
|
|||||||
// Not implemented for the embedded player
|
// 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()
|
void KX_BlenderCanvas::BeginFrame()
|
||||||
{
|
{
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
@ -85,6 +85,14 @@ public:
|
|||||||
int height
|
int height
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void
|
||||||
|
SetFullScreen(
|
||||||
|
bool enable
|
||||||
|
);
|
||||||
|
|
||||||
|
bool
|
||||||
|
GetFullScreen();
|
||||||
|
|
||||||
void
|
void
|
||||||
BeginFrame(
|
BeginFrame(
|
||||||
);
|
);
|
||||||
|
@ -128,6 +128,19 @@ void GPG_Canvas::ResizeWindow(int width, int height)
|
|||||||
Resize(width, 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)
|
float GPG_Canvas::GetMouseNormalizedX(int x)
|
||||||
{
|
{
|
||||||
return float(x)/this->GetWidth();
|
return float(x)/this->GetWidth();
|
||||||
|
@ -61,6 +61,8 @@ public:
|
|||||||
virtual float GetMouseNormalizedY(int y);
|
virtual float GetMouseNormalizedY(int y);
|
||||||
|
|
||||||
virtual void ResizeWindow(int width, int height);
|
virtual void ResizeWindow(int width, int height);
|
||||||
|
virtual void SetFullScreen(bool enable);
|
||||||
|
virtual bool GetFullScreen();
|
||||||
|
|
||||||
bool BeginDraw() { return true; }
|
bool BeginDraw() { return true; }
|
||||||
void EndDraw() {};
|
void EndDraw() {};
|
||||||
|
@ -1327,6 +1327,17 @@ static PyObject *gPySetWindowSize(PyObject *, PyObject *args)
|
|||||||
Py_RETURN_NONE;
|
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[] = {
|
static struct PyMethodDef rasterizer_methods[] = {
|
||||||
{"getWindowWidth",(PyCFunction) gPyGetWindowWidth,
|
{"getWindowWidth",(PyCFunction) gPyGetWindowWidth,
|
||||||
METH_VARARGS, "getWindowWidth doc"},
|
METH_VARARGS, "getWindowWidth doc"},
|
||||||
@ -1368,6 +1379,8 @@ static struct PyMethodDef rasterizer_methods[] = {
|
|||||||
{"drawLine", (PyCFunction) gPyDrawLine,
|
{"drawLine", (PyCFunction) gPyDrawLine,
|
||||||
METH_VARARGS, "draw a line on the screen"},
|
METH_VARARGS, "draw a line on the screen"},
|
||||||
{"setWindowSize", (PyCFunction) gPySetWindowSize, METH_VARARGS, ""},
|
{"setWindowSize", (PyCFunction) gPySetWindowSize, METH_VARARGS, ""},
|
||||||
|
{"setFullScreen", (PyCFunction) gPySetFullScreen, METH_O, ""},
|
||||||
|
{"getFullScreen", (PyCFunction) gPyGetFullScreen, METH_NOARGS, ""},
|
||||||
{ NULL, (PyCFunction) NULL, 0, NULL }
|
{ NULL, (PyCFunction) NULL, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -232,6 +232,16 @@ public:
|
|||||||
int height
|
int height
|
||||||
)=0;
|
)=0;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
void
|
||||||
|
SetFullScreen(
|
||||||
|
bool enable
|
||||||
|
)=0;
|
||||||
|
|
||||||
|
virtual
|
||||||
|
bool
|
||||||
|
GetFullScreen()=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user