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-10-11 14:41:38 +0300
committerThomas Szepe <HG1_public@gmx.net>2015-10-11 14:41:38 +0300
commitd1ee195260c3676eb822a0025167ea8a785ccfa5 (patch)
treeff802b3305d64fa02dd85f2f0bca51c2522703f5 /source/gameengine/Ketsji
parent3748bbf2d9e4dfa611e6a94b5497a0a7a376211d (diff)
BGE: Adding a screenshot function to game actuator
Extending the existing game actuator with a screenshot function, to give also non programmers the ability to take screenshots in the BGE. Reviewers: lordloki, campbellbarton, moguri Reviewed By: lordloki, moguri Subscribers: lordloki, Genome36 Projects: #game_engine Differential Revision: https://developer.blender.org/D651
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_GameActuator.h1
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp1
3 files changed, 14 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_GameActuator.cpp b/source/gameengine/Ketsji/KX_GameActuator.cpp
index a23af680104..f1bd253f8b3 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.cpp
+++ b/source/gameengine/Ketsji/KX_GameActuator.cpp
@@ -41,6 +41,7 @@
#include "KX_Scene.h"
#include "KX_KetsjiEngine.h"
#include "KX_PythonInit.h" /* for config load/saving */
+#include "RAS_ICanvas.h"
#include <stdio.h>
#include <stdlib.h>
@@ -204,6 +205,17 @@ bool KX_GameActuator::Update()
break;
#endif // WITH_PYTHON
}
+ case KX_GAME_SCREENSHOT:
+ {
+ RAS_ICanvas *canvas = m_ketsjiengine->GetCanvas();
+ if (canvas) {
+ canvas->MakeScreenShot(m_filename);
+ }
+ else {
+ printf("KX_GAME_SCREENSHOT error: Rasterizer not available");
+ }
+ break;
+ }
default:
; /* do nothing? this is an internal error !!! */
}
diff --git a/source/gameengine/Ketsji/KX_GameActuator.h b/source/gameengine/Ketsji/KX_GameActuator.h
index 0c1c4f0c277..57472836bb2 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.h
+++ b/source/gameengine/Ketsji/KX_GameActuator.h
@@ -59,6 +59,7 @@ protected:
KX_GAME_QUIT,
KX_GAME_SAVECFG,
KX_GAME_LOADCFG,
+ KX_GAME_SCREENSHOT,
KX_GAME_MAX
};
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 2fef74ca33d..48d8be55120 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -1804,6 +1804,7 @@ PyMODINIT_FUNC initGameLogicPythonBinding()
KX_MACRO_addTypesToDict(d, KX_GAME_QUIT, KX_GameActuator::KX_GAME_QUIT);
KX_MACRO_addTypesToDict(d, KX_GAME_SAVECFG, KX_GameActuator::KX_GAME_SAVECFG);
KX_MACRO_addTypesToDict(d, KX_GAME_LOADCFG, KX_GameActuator::KX_GAME_LOADCFG);
+ KX_MACRO_addTypesToDict(d, KX_GAME_SCREENSHOT, KX_GameActuator::KX_GAME_SCREENSHOT);
/* Scene Actuator Modes */
KX_MACRO_addTypesToDict(d, KX_SCENE_RESTART, KX_SceneActuator::KX_SCENE_RESTART);