BGE: New API method getDisplayDimensions

This patch adds a new API function to get the actual display dimensions in pixels.

Reviewers: dfelinto, sybren, lordloki, moguri

Reviewed By: lordloki, moguri

Differential Revision: https://developer.blender.org/D648
This commit is contained in:
2015-04-07 18:32:25 +02:00
parent f9f3c29a3a
commit e36b0cb8f3
8 changed files with 47 additions and 0 deletions

View File

@@ -1403,6 +1403,20 @@ static PyObject *gPyClearDebugList(PyObject *)
Py_RETURN_NONE;
}
static PyObject *gPyGetDisplayDimensions(PyObject *)
{
PyObject *list = PyList_New(0);
int width;
int height;
gp_Canvas->GetDisplayDimensions(width, height);
PyList_Append(list, PyLong_FromLong(width));
PyList_Append(list, PyLong_FromLong(height));
return list;
}
PyDoc_STRVAR(Rasterizer_module_documentation,
"This is the Python API for the game engine of Rasterizer"
);
@@ -1446,6 +1460,8 @@ static struct PyMethodDef rasterizer_methods[] = {
{"setWindowSize", (PyCFunction) gPySetWindowSize, METH_VARARGS, ""},
{"setFullScreen", (PyCFunction) gPySetFullScreen, METH_O, ""},
{"getFullScreen", (PyCFunction) gPyGetFullScreen, METH_NOARGS, ""},
{"getDisplayDimensions", (PyCFunction) gPyGetDisplayDimensions, METH_NOARGS,
"Get the actual dimensions, in pixels, of the physical display (e.g., the monitor)."},
{"setMipmapping", (PyCFunction) gPySetMipmapping, METH_VARARGS, ""},
{"getMipmapping", (PyCFunction) gPyGetMipmapping, METH_NOARGS, ""},
{"setVsync", (PyCFunction) gPySetVsync, METH_VARARGS, ""},