#------------------------------------------------------------------------------
# Provide a target system hint for the Makefile.
-# Recognized PLATFORM values: darwin, mingw.
+# Recognized PLATFORM values: darwin, mingw, maemo.
ifeq ($(shell uname), Darwin)
PLATFORM := darwin
endif
+ifdef _SBOX_DIR
+ PLATFORM := maemo
+endif
+
#------------------------------------------------------------------------------
# Paths (packagers might want to set DATADIR and LOCALEDIR)
ALL_CPPFLAGS += -I/opt/local/include
endif
+ifeq ($(PLATFORM),maemo)
+ ALL_CPPFLAGS += -D__MAEMO__
+endif
+
ALL_CPPFLAGS += $(CPPFLAGS)
#------------------------------------------------------------------------------
OGL_LIBS := -framework OpenGL
endif
+ifeq ($(PLATFORM),maemo)
+ OGL_LIBS := -lm -lSDL_gles -lEGL -lGLES_CM
+endif
+
BASE_LIBS := -ljpeg $(PNG_LIBS) $(FS_LIBS)
ifeq ($(PLATFORM),darwin)
#include "sync.h"
/*---------------------------------------------------------------------------*/
+#ifdef __MAEMO__
+static SDL_GLES_Context *context;
+#endif
int video_init(const char *title, const char *icon)
{
set_SDL_icon(icon);
+#ifdef __MAEMO__
+ if (SDL_GLES_Init(SDL_GLES_VERSION_1_1) != 0)
+ {
+ fprintf(stderr, "SDL_GLES_Init failed\n");
+ return 0;
+ }
+#endif
+
/* Initialize the video. */
if (!video_mode(config_get_d(CONFIG_FULLSCREEN),
/* Require 16-bit double buffer with 16-bit depth buffer. */
+#ifndef __MAEMO__ /* SDL_GLES already takes care of these */
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+#endif
/* Try to set the currently specified mode. */
-
- if (SDL_SetVideoMode(w, h, 0, SDL_OPENGL | (f ? SDL_FULLSCREEN : 0)))
+ if (SDL_SetVideoMode(w, h, 0,
+#ifdef __MAEMO__
+ SDL_SWSURFACE |
+#else
+ SDL_OPENGL |
+#endif
+ (f ? SDL_FULLSCREEN : 0)))
{
config_set_d(CONFIG_FULLSCREEN, f);
config_set_d(CONFIG_WIDTH, w);
config_set_d(CONFIG_HEIGHT, h);
+#ifdef __MAEMO__
+ SDL_ShowCursor(SDL_DISABLE);
+ context = SDL_GLES_CreateContext();
+ if (context == 0)
+ {
+ fprintf(stderr, "SDL_GLES_CreateContext failed\n");
+ fprintf(stderr, "%s\n", SDL_GetError());
+ return 0;
+ }
+
+ if (SDL_GLES_MakeCurrent(context) != 0)
+ {
+ fprintf(stderr, "SDL_GLES_MakeCurrent failed\n");
+ fprintf(stderr, "%s\n", SDL_GetError());
+ return 0;
+ }
+#endif
+
if (!glext_init())
return 0;