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:
authorCampbell Barton <ideasman42@gmail.com>2009-06-14 00:58:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-14 00:58:43 +0400
commit646d4041e2c3461f4494be126172cf10472914b7 (patch)
tree413a687276b3893dd22b788824c14a077067ff74 /source/gameengine/BlenderRoutines
parent611e2f484c1d3c1c07abbe289a23623e714c700f (diff)
BGE events, not sure every event works as it should but keyboard looking and mouse focus seems to work ok.
Tested some basic logic brick blend files that use key input which run properly.
Diffstat (limited to 'source/gameengine/BlenderRoutines')
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp61
1 files changed, 45 insertions, 16 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 5f1437b8699..44678cb73eb 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -66,16 +66,18 @@
#include "SYS_System.h"
/***/
-
#include "DNA_view3d_types.h"
#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
#include "BKE_global.h"
#include "BKE_report.h"
+
#include "BKE_utildefines.h"
//XXX #include "BIF_screen.h"
//XXX #include "BIF_scrarea.h"
-#include "BKE_main.h"
+#include "BKE_main.h"
+//#include "BKE_context.h"
#include "BLI_blenlib.h"
#include "BLO_readfile.h"
#include "DNA_scene_types.h"
@@ -84,10 +86,15 @@
#include "GPU_extensions.h"
#include "Value.h"
+
+
#ifdef __cplusplus
extern "C" {
#endif
//XXX #include "BSE_headerbuttons.h"
+#include "../../blender/windowmanager/WM_types.h"
+#include "../../blender/windowmanager/wm_window.h"
+#include "../../blender/windowmanager/wm_event_system.h"
#ifdef __cplusplus
}
#endif
@@ -111,13 +118,24 @@ static BlendFileData *load_game_data(char *filename)
return bfd;
}
-extern "C" void StartKetsjiShell(struct wmWindow *win,
- struct ScrArea *area,
- struct ARegion *ar,
- Scene *scene,
- struct Main* maggie1,
- int always_use_expand_framing)
+
+/* screw it, BKE_context.h is complaining! */
+extern "C" struct wmWindow *CTX_wm_window(const bContext *C);
+extern "C" struct ScrArea *CTX_wm_area(const bContext *C);
+extern "C" struct ARegion *CTX_wm_region(const bContext *C);
+extern "C" struct Scene *CTX_data_scene(const bContext *C);
+extern "C" struct Main *CTX_data_main(const bContext *C);
+
+extern "C" void StartKetsjiShell(struct bContext *C, int always_use_expand_framing)
{
+ /* context values */
+ struct wmWindow *win= CTX_wm_window(C);
+ struct ScrArea *area= CTX_wm_area(C); // curarea
+ struct ARegion *ar= CTX_wm_region(C);
+ struct Scene *scene= CTX_data_scene(C);
+ struct Main* maggie1= CTX_data_main(C);
+
+
int exitrequested = KX_EXIT_REQUEST_NO_REQUEST;
Main* blenderdata = maggie1;
@@ -431,26 +449,37 @@ extern "C" void StartKetsjiShell(struct wmWindow *win,
ketsjiengine->Render();
}
+ wm_window_process_events_nosleep(C);
+
// test for the ESC key
- while (0) //XXX while (qtest())
+ //XXX while (qtest())
+ while(wmEvent *event= (wmEvent *)win->queue.first)
{
short val = 0;
- unsigned short event = 0; //XXX extern_qread(&val);
+ //unsigned short event = 0; //XXX extern_qread(&val);
- if (keyboarddevice->ConvertBlenderEvent(event,val))
+ if (keyboarddevice->ConvertBlenderEvent(event->type,event->val))
exitrequested = KX_EXIT_REQUEST_BLENDER_ESC;
/* Coordinate conversion... where
* should this really be?
*/
- if (event==MOUSEX) {
- val = val - ar->winrct.xmin;
- } else if (event==MOUSEY) {
- val = ar->winy - (val - ar->winrct.ymin) - 1;
+ if (event->type==MOUSEMOVE) {
+ /* Note nice! XXX 2.5 event hack */
+ val = event->x - ar->winrct.xmin;
+ mousedevice->ConvertBlenderEvent(MOUSEX, val);
+
+ val = ar->winy - (event->y - ar->winrct.ymin) - 1;
+ mousedevice->ConvertBlenderEvent(MOUSEY, val);
+ }
+ else {
+ mousedevice->ConvertBlenderEvent(event->type,event->val);
}
- mousedevice->ConvertBlenderEvent(event,val);
+ BLI_remlink(&win->queue, event);
+ wm_event_free(event);
}
+
}
printf("\nBlender Game Engine Finished\n\n");
exitstring = ketsjiengine->GetExitString();