Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Szepe <HG1_public@gmx.net>2015-04-07 19:32:25 +0300
committerThomas Szepe <HG1_public@gmx.net>2015-04-07 19:32:25 +0300
commite36b0cb8f32fc4302499c87e5c2b4c1ecc7a6543 (patch)
tree53fcd2ebd7775bebc00f8ca5960a2bd18145e17e /source/gameengine/Ketsji/KX_PythonInit.cpp
parentf9f3c29a3a5b558e09c36076521bdafc91e7e326 (diff)
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
Diffstat (limited to 'source/gameengine/Ketsji/KX_PythonInit.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 18b25d340dd..420e0be8c5d 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -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, ""},