diff --git a/BelligerentBlocks/src/Platform.cpp b/BelligerentBlocks/src/Platform.cpp index 5fccc6a..9da398c 100644 --- a/BelligerentBlocks/src/Platform.cpp +++ b/BelligerentBlocks/src/Platform.cpp @@ -135,8 +135,7 @@ bool Platform::init() { } SC_ScoresController_SetMode(m_scoresController, 0); - SC_ScoresController_SetSearchList(m_scoresController, SC_SCORE_SEARCH_LIST_GLOBAL); - SC_ScoresController_SetTimeInterval(m_scoresController, SC_TIME_INTERVAL_GLOBAL); + SC_ScoresController_SetSearchList(m_scoresController, SC_SCORES_SEARCH_LIST_ALL); struct stat fileInfo; if (stat("data/scores.db", &fileInfo) == -1) { @@ -372,7 +371,7 @@ void Platform::fetchLeaderboard() { return; } - SC_Error_t rc = SC_ScoresController_LoadRange(m_scoresController, scores); + SC_Error_t rc = SC_ScoresController_LoadScores(m_scoresController, scores); if (rc != SC_OK) { fprintf(stderr, "Error loading leaderboard score range: %d\n", rc); return; diff --git a/BelligerentBlocks/src/bbutil.c b/BelligerentBlocks/src/bbutil.c index e1d590f..fdb9d50 100644 --- a/BelligerentBlocks/src/bbutil.c +++ b/BelligerentBlocks/src/bbutil.c @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include #include #include @@ -202,61 +201,28 @@ bbutil_init_egl(screen_context_t ctx) { return EXIT_FAILURE; } - int screen_resolution[2]; + const char *env = getenv("WIDTH"); - rc = screen_get_display_property_iv(screen_disp, SCREEN_PROPERTY_SIZE, screen_resolution); - if (rc) { - perror("screen_get_display_property_iv"); + if (0 == env) { + perror("failed getenv for WIDTH"); bbutil_terminate(); return EXIT_FAILURE; } - int angle = atoi(getenv("ORIENTATION")); + int width = atoi(env); - screen_display_mode_t screen_mode; - rc = screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode); - if (rc) { - perror("screen_get_display_property_pv"); - bbutil_terminate(); - return EXIT_FAILURE; - } + env = getenv("HEIGHT"); - int size[2]; - rc = screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size); - if (rc) { - perror("screen_get_window_property_iv"); + if (0 == env) { + perror("failed getenv for HEIGHT"); bbutil_terminate(); return EXIT_FAILURE; } - int buffer_size[2] = {size[0], size[1]}; + int height = atoi(env); + int size[2] = { width, height }; - if ((angle == 0) || (angle == 180)) { - if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) || - ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) { - buffer_size[1] = size[0]; - buffer_size[0] = size[1]; - } - } else if ((angle == 90) || (angle == 270)){ - if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) || - ((screen_mode.width < screen_mode.height && size[0] < size[1]))) { - buffer_size[1] = size[0]; - buffer_size[0] = size[1]; - } - } else { - fprintf(stderr, "Navigator returned an unexpected orientation angle.\n"); - bbutil_terminate(); - return EXIT_FAILURE; - } - - rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size); - if (rc) { - perror("screen_set_window_property_iv"); - bbutil_terminate(); - return EXIT_FAILURE; - } - - rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle); + rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size); if (rc) { perror("screen_set_window_property_iv"); bbutil_terminate(); @@ -483,7 +449,7 @@ void bbutil_render_text(font_t* font, const char* msg, float x, float y, float r int i, c; GLfloat *vertices; GLfloat *texture_coords; - GLshort* indices; + GLushort* indices; float pen_x = 0.0f; @@ -506,7 +472,7 @@ void bbutil_render_text(font_t* font, const char* msg, float x, float y, float r vertices = (GLfloat*) malloc(sizeof(GLfloat) * 8 * msg_len); texture_coords = (GLfloat*) malloc(sizeof(GLfloat) * 8 * msg_len); - indices = (GLshort*) malloc(sizeof(GLfloat) * 6 * msg_len); + indices = (GLushort*) malloc(sizeof(GLushort) * 6 * msg_len); for(i = 0; i < msg_len; ++i) { c = msg[i]; diff --git a/GoodCitizen/bbutil.c b/GoodCitizen/bbutil.c index 395f0d8..fdb9d50 100644 --- a/GoodCitizen/bbutil.c +++ b/GoodCitizen/bbutil.c @@ -201,61 +201,28 @@ bbutil_init_egl(screen_context_t ctx) { return EXIT_FAILURE; } - int screen_resolution[2]; + const char *env = getenv("WIDTH"); - rc = screen_get_display_property_iv(screen_disp, SCREEN_PROPERTY_SIZE, screen_resolution); - if (rc) { - perror("screen_get_display_property_iv"); + if (0 == env) { + perror("failed getenv for WIDTH"); bbutil_terminate(); return EXIT_FAILURE; } - int angle = atoi(getenv("ORIENTATION")); + int width = atoi(env); - screen_display_mode_t screen_mode; - rc = screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode); - if (rc) { - perror("screen_get_display_property_pv"); - bbutil_terminate(); - return EXIT_FAILURE; - } + env = getenv("HEIGHT"); - int size[2]; - rc = screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size); - if (rc) { - perror("screen_get_window_property_iv"); + if (0 == env) { + perror("failed getenv for HEIGHT"); bbutil_terminate(); return EXIT_FAILURE; } - int buffer_size[2] = {size[0], size[1]}; + int height = atoi(env); + int size[2] = { width, height }; - if ((angle == 0) || (angle == 180)) { - if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) || - ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) { - buffer_size[1] = size[0]; - buffer_size[0] = size[1]; - } - } else if ((angle == 90) || (angle == 270)){ - if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) || - ((screen_mode.width < screen_mode.height && size[0] < size[1]))) { - buffer_size[1] = size[0]; - buffer_size[0] = size[1]; - } - } else { - fprintf(stderr, "Navigator returned an unexpected orientation angle.\n"); - bbutil_terminate(); - return EXIT_FAILURE; - } - - rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size); - if (rc) { - perror("screen_set_window_property_iv"); - bbutil_terminate(); - return EXIT_FAILURE; - } - - rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle); + rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size); if (rc) { perror("screen_set_window_property_iv"); bbutil_terminate(); diff --git a/GoodCitizen/main.c b/GoodCitizen/main.c index c4f0899..b7d37f4 100644 --- a/GoodCitizen/main.c +++ b/GoodCitizen/main.c @@ -14,23 +14,24 @@ * limitations under the License. */ -#include +#include "bbutil.h" + #include #include #include #include -#include + +#include + +#include +#include + #include #include #include #include #include -#include -#include - -#include "bbutil.h" - static GLfloat radio_btn_unselected_vertices[8], radio_btn_selected_vertices[8], background_portrait_vertices[8], background_landscape_vertices[8], *background_vertices; @@ -752,14 +753,6 @@ int main(int argc, char *argv[]) { return 0; } - //Signal BPS library that navigator orientation is not to be locked - if (BPS_SUCCESS != navigator_rotation_lock(false)) { - fprintf(stderr, "navigator_rotation_lock failed\n"); - bbutil_terminate(); - screen_destroy_context(screen_cxt); - return 0; - } - while (!shutdown) { // Handle user input and accelerometer handle_events(); diff --git a/HelloWorldDisplay/bbutil.c b/HelloWorldDisplay/bbutil.c index 395f0d8..fdb9d50 100644 --- a/HelloWorldDisplay/bbutil.c +++ b/HelloWorldDisplay/bbutil.c @@ -201,61 +201,28 @@ bbutil_init_egl(screen_context_t ctx) { return EXIT_FAILURE; } - int screen_resolution[2]; + const char *env = getenv("WIDTH"); - rc = screen_get_display_property_iv(screen_disp, SCREEN_PROPERTY_SIZE, screen_resolution); - if (rc) { - perror("screen_get_display_property_iv"); + if (0 == env) { + perror("failed getenv for WIDTH"); bbutil_terminate(); return EXIT_FAILURE; } - int angle = atoi(getenv("ORIENTATION")); + int width = atoi(env); - screen_display_mode_t screen_mode; - rc = screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode); - if (rc) { - perror("screen_get_display_property_pv"); - bbutil_terminate(); - return EXIT_FAILURE; - } + env = getenv("HEIGHT"); - int size[2]; - rc = screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size); - if (rc) { - perror("screen_get_window_property_iv"); + if (0 == env) { + perror("failed getenv for HEIGHT"); bbutil_terminate(); return EXIT_FAILURE; } - int buffer_size[2] = {size[0], size[1]}; + int height = atoi(env); + int size[2] = { width, height }; - if ((angle == 0) || (angle == 180)) { - if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) || - ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) { - buffer_size[1] = size[0]; - buffer_size[0] = size[1]; - } - } else if ((angle == 90) || (angle == 270)){ - if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) || - ((screen_mode.width < screen_mode.height && size[0] < size[1]))) { - buffer_size[1] = size[0]; - buffer_size[0] = size[1]; - } - } else { - fprintf(stderr, "Navigator returned an unexpected orientation angle.\n"); - bbutil_terminate(); - return EXIT_FAILURE; - } - - rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size); - if (rc) { - perror("screen_set_window_property_iv"); - bbutil_terminate(); - return EXIT_FAILURE; - } - - rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle); + rc = screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size); if (rc) { perror("screen_set_window_property_iv"); bbutil_terminate(); diff --git a/HelloWorldDisplay/main.c b/HelloWorldDisplay/main.c index a44a744..0004b79 100644 --- a/HelloWorldDisplay/main.c +++ b/HelloWorldDisplay/main.c @@ -14,26 +14,28 @@ * limitations under the License. */ -#include -#include -#include -#include -#include -#include -#include +#include "bbutil.h" + +#include + #include #include #include #include -#include -#include -#include + #include +#include + #include #include -#include "png.h" -#include "bbutil.h" +#include +#include +#include +#include +#include +#include +#include static float width, height; static GLuint background; @@ -177,14 +179,6 @@ int main(int argc, char **argv) { return 0; } - //Signal BPS library that navigator orientation is to be locked - if (BPS_SUCCESS != navigator_rotation_lock(true)) { - fprintf(stderr, "navigator_rotation_lock failed\n"); - bbutil_terminate(); - screen_destroy_context(screen_cxt); - return 0; - } - //Signal BPS library that navigator and screen events will be requested if (BPS_SUCCESS != screen_request_events(screen_cxt)) { fprintf(stderr, "screen_request_events failed\n");