Skip to content

Commit ab8b581

Browse files
committed
Improved SDL and added hooks to begin processing BlackBerry BPS events (for BBM, sensors, Scoreloop and other OS features)
git-svn-id: https://nekonme.googlecode.com/svn/trunk@2178 1509560c-5e2a-0410-865c-31c25e1cfdef
1 parent 9eb926a commit ab8b581

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

ndll/BlackBerry/libSDL-x86.so

42.1 KB
Binary file not shown.

ndll/BlackBerry/libSDL.so

-66.4 KB
Binary file not shown.

project/blackberry/System.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <sys/platform.h>
88
#include "bps/event.h"
99
#include <string>
10+
#include <stdio.h>
1011

1112

1213
namespace nme {
@@ -90,6 +91,13 @@ namespace nme {
9091
return (result == BPS_SUCCESS);
9192

9293
}
94+
95+
96+
void ProcessBPSEvent (bps_event_t *event) {
97+
98+
printf ("Received BPS event\n");
99+
100+
}
93101

94102

95103
}

project/include/Utils.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
#include <QuickVec.h>
88

99

10+
#ifdef BLACKBERRY
11+
#include <bps/event.h>
12+
#endif
13+
1014
#ifdef ANDROID
1115
#include <android/log.h>
1216

@@ -150,6 +154,10 @@ bool SetUserPreference(const char *inId, const char *inPreference);
150154
std::string GetUserPreference(const char *inId);
151155
bool ClearUserPreference(const char *inId);
152156

157+
#ifdef BLACKBERRY
158+
void ProcessBPSEvent (bps_event_t *event);
159+
#endif
160+
153161
#ifdef HX_WINDOWS
154162
typedef wchar_t OSChar;
155163
#define val_os_string val_wstring

project/sdl/SDLStage.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#include <KeyCodes.h>
77
#include <map>
88

9+
#ifdef BLACKBERRY
10+
#include <SDL_syswm.h>
11+
#include <bps/sensor.h>
12+
#endif
13+
914
#ifdef WEBOS
1015
#include "PDL.h"
1116
#include <syslog.h>
@@ -86,6 +91,20 @@ int initSDL () {
8691
sgJoystickEnabled = true;
8792

8893
}
94+
95+
#ifdef BLACKBERRY
96+
if (err == 0) {
97+
98+
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
99+
100+
}
101+
#endif
102+
103+
sensor_set_rate(SENSOR_TYPE_ACCELEROMETER, 25000);
104+
sensor_set_skip_duplicates(SENSOR_TYPE_ACCELEROMETER, true);
105+
sensor_request_events(SENSOR_TYPE_ACCELEROMETER);
106+
107+
89108

90109
return err;
91110

@@ -1215,6 +1234,14 @@ void ProcessEvent(SDL_Event &inEvent)
12151234
break;
12161235
}
12171236

1237+
#ifdef BLACKBERRY
1238+
case SDL_SYSWMEVENT:
1239+
{
1240+
//exit(0);
1241+
ProcessBPSEvent((inEvent.syswm.msg)->event);
1242+
}
1243+
#endif
1244+
12181245
}
12191246
}
12201247

0 commit comments

Comments
 (0)