endif
ifeq ($(PLATFORM),maemo)
- ALL_CPPFLAGS += -D__MAEMO__
+ ALL_CPPFLAGS += -D__MAEMO__ $(shell pkg-config --cflags libosso)
endif
ALL_CPPFLAGS += $(CPPFLAGS)
BASE_LIBS += -L/opt/local/lib
endif
+ifeq ($(PLATFORM),maemo)
+ BASE_LIBS += $(shell pkg-config --libs libosso)
+endif
+
ALL_LIBS := $(SDL_LIBS) $(BASE_LIBS) $(TILT_LIBS) $(INTL_LIBS) -lSDL_ttf \
-lvorbisfile $(OGL_LIBS)
else
ifeq ($(PLATFORM),maemo)
BALL_OBJS += share/tilt_maemo.o
+BALL_OBJS += share/maemo.o
else
BALL_OBJS += share/tilt_null.o
endif
#include "tilt.h"
#include "fs.h"
#include "common.h"
+#ifdef __MAEMO__
+#include "maemo.h"
+#endif
#include "st_conf.h"
#include "st_title.h"
/* Initialize SDL. */
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) == -1)
+ if (SDL_Init(SDL_INIT_VIDEO |
+ SDL_INIT_AUDIO |
+#ifdef __MAEMO__
+ SDL_INIT_TIMER |
+#endif
+ SDL_INIT_JOYSTICK) == -1)
{
fprintf(stderr, "%s\n", SDL_GetError());
return 1;
else
goto_state(&st_title);
+#ifdef __MAEMO__
+ maemo_init("neverball");
+#endif
+
/* Run the main game loop. */
t0 = SDL_GetTicks();
SDL_JoystickClose(joy);
tilt_free();
+#ifdef __MAEMO__
+ maemo_quit();
+#endif
SDL_Quit();
return 0;
--- /dev/null
+/*
+ * Copyright (C) 2011 Neverball authors
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA
+ */
+
+#include "maemo.h"
+#include <SDL/SDL_timer.h>
+#include <libosso.h>
+
+static osso_context_t *osso_context = NULL;
+static SDL_TimerID screen_timer_id = 0;
+
+static Uint32 disable_display_blank(Uint32 interval, void *param)
+{
+ int ret;
+ ret = osso_display_blanking_pause(osso_context);
+ return interval;
+}
+
+int maemo_init(const char *program)
+{
+ osso_context = osso_initialize(program, "1.0", 0, NULL);
+ if (!osso_context) {
+ fprintf(stderr, "osso_initialize failed!\n");
+ return 0;
+ }
+
+ osso_display_blanking_pause(osso_context);
+ screen_timer_id = SDL_AddTimer(30000, disable_display_blank, NULL);
+ return 1;
+}
+
+void maemo_quit(void)
+{
+ if (osso_context)
+ osso_deinitialize(osso_context);
+
+ SDL_RemoveTimer(screen_timer_id);
+}
+
--- /dev/null
+/*
+ * Copyright (C) 2011 Neverball authors
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA
+ */
+
+int maemo_init(const char *program);
+void maemo_quit(void);
+