This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Added (partially implemented) android video backend and associated fi…
…les needed to build
- Loading branch information
Showing
20 changed files
with
1,437 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
#!/bin/bash | ||
ANDROID_NDK="/home/paul/Projects/gsoc/sdk/android-ndk-r4" | ||
TOOLS_PATH="$ANDROID_NDK/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin" | ||
ADDITIONAL_LIBS=`dirname "$0"`/android_libs/ | ||
|
||
export PATH=$TOOLS_PATH:$PATH | ||
|
||
LD="arm-eabi-ld" | ||
|
||
#ldflags | ||
ACC_L=" -rpath-link=$ANDROID_NDK/build/platforms/android-4/arch-arm/usr/lib/ \ | ||
ACC_L=" -rpath-link=$ANDROID_NDK/build/platforms/android-8/arch-arm/usr/lib/ \ | ||
-dynamic-linker=/system/bin/linker \ | ||
-L$ANDROID_NDK/build/platforms/android-3/arch-arm/usr/lib/ -lc -nostdlib \ | ||
$ANDROID_NDK/build/platforms/android-4/arch-arm/usr/lib/crtbegin_static.o \ | ||
-L$ANDROID_NDK/build/prebuilt/linux-x86/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1 " | ||
-lc -nostdlib \ | ||
$ANDROID_NDK/build/platforms/android-8/arch-arm/usr/lib/crtbegin_static.o \ | ||
-L$ANDROID_NDK/build/platforms/android-8/arch-arm/usr/lib/ \ | ||
-L$ANDROID_NDK/build/prebuilt/linux-x86/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1 \ | ||
-L$ADDITIONAL_LIBS " | ||
|
||
$LD $ACC_L $LDFLAGS $@ -lgcc | ||
|
||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
SDL - Simple DirectMedia Layer | ||
Copyright (C) 1997-2010 Sam Lantinga | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library 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 | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
Sam Lantinga | ||
slouken@libsdl.org | ||
*/ | ||
#include "SDL_config.h" | ||
|
||
/* Being a null driver, there's no event stream. We just define stubs for | ||
most of the API. */ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include "../../events/SDL_sysevents.h" | ||
#include "../../events/SDL_events_c.h" | ||
|
||
void | ||
Android_PumpEvents(_THIS) | ||
{ | ||
|
||
//scanKeys(); | ||
/* TODO: defer click-age */ | ||
/* | ||
if (keysDown() & KEY_TOUCH) { | ||
SDL_SendMouseButton(0, SDL_PRESSED, 0); | ||
} else if (keysUp() & KEY_TOUCH) { | ||
SDL_SendMouseButton(0, SDL_RELEASED, 0); | ||
} | ||
if (keysHeld() & KEY_TOUCH) { | ||
touchPosition t = touchReadXY(); | ||
SDL_SendMouseMotion(0, 0, t.px, t.py, 1); | ||
} | ||
*/ | ||
} | ||
|
||
/* vi: set ts=4 sw=4 expandtab: */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
SDL - Simple DirectMedia Layer | ||
Copyright (C) 1997-2010 Sam Lantinga | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library 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 | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
Sam Lantinga | ||
slouken@libsdl.org | ||
*/ | ||
#include "SDL_config.h" | ||
|
||
#include "SDL_androidvideo.h" | ||
|
||
extern void Android_PumpEvents(_THIS); | ||
|
||
/* vi: set ts=4 sw=4 expandtab: */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
/* | ||
SDL - Simple DirectMedia Layer | ||
Copyright (C) 1997-2010 Sam Lantinga | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
This library 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 | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
Sam Lantinga | ||
slouken@libsdl.org | ||
*/ | ||
#include "SDL_config.h" | ||
|
||
/* Android SDL video driver implementation | ||
*/ | ||
|
||
#include "SDL_video.h" | ||
#include "SDL_mouse.h" | ||
#include "../SDL_sysvideo.h" | ||
#include "../SDL_pixels_c.h" | ||
#include "../../events/SDL_events_c.h" | ||
|
||
#include "SDL_androidvideo.h" | ||
#include "SDL_androidevents_c.h" | ||
#include "SDL_androidrender_c.h" | ||
|
||
/* Android header */ | ||
#include "egl.h" | ||
|
||
|
||
//EGL globals | ||
static EGLDisplay iEglDisplay; | ||
static EGLConfig iEglConfig; | ||
static EGLContext iEglContext; | ||
static EGLSurface iEglSurface; | ||
|
||
EGLint attribList [] = | ||
{ | ||
EGL_BUFFER_SIZE, 16, //16 bit color | ||
EGL_DEPTH_SIZE, 15, | ||
EGL_NONE | ||
}; | ||
|
||
|
||
|
||
|
||
/* GL functions */ | ||
int Android_GL_LoadLibrary(_THIS, const char *path){ | ||
printf("[STUB] GL_LoadLibrary\n"); | ||
return 0; | ||
} | ||
|
||
void *Android_GL_GetProcAddress(_THIS, const char *proc){ | ||
printf("[STUB] GL_GetProcAddress\n"); | ||
return 0; | ||
} | ||
|
||
void Android_GL_UnloadLibrary(_THIS){ | ||
printf("[STUB] GL_UnloadLibrary\n"); | ||
} | ||
|
||
/* | ||
int *Android_GL_GetVisual(_THIS, Display * display, int screen){ | ||
printf("[STUB] GL_GetVisual\n"); | ||
return 0; | ||
} | ||
*/ | ||
|
||
SDL_GLContext Android_GL_CreateContext(_THIS, SDL_Window * window){ | ||
printf("[STUB] GL_CreateContext\n"); | ||
|
||
//Start up the display | ||
iEglDisplay = eglGetDisplay (EGL_DEFAULT_DISPLAY); | ||
if(iEglDisplay == EGL_NO_DISPLAY){ | ||
printf("Unable to find a suitable EGLDisplay\n"); | ||
return NULL; | ||
} | ||
|
||
printf("1\n"); | ||
|
||
if(!eglInitialize(iEglDisplay, 0, 0)){ | ||
printf("Couldn't init display\n"); | ||
return NULL; | ||
} | ||
|
||
printf("2\n"); | ||
|
||
EGLint numConfigs; | ||
|
||
if(!eglChooseConfig(iEglDisplay, attribList, &iEglConfig, 1, &numConfigs)){ | ||
printf("Couldn't choose config\n"); | ||
return NULL; | ||
} | ||
|
||
printf("3\n"); | ||
|
||
iEglContext = eglCreateContext(iEglDisplay, iEglConfig, EGL_NO_CONTEXT, 0); | ||
|
||
if(iEglContext == 0){ | ||
printf("Couldn't create context\n"); | ||
return NULL; | ||
} | ||
|
||
printf("4\n"); | ||
|
||
NativeWindowType iWindow = 1; //android_createDisplaySurface(); | ||
|
||
iEglSurface = eglCreateWindowSurface(iEglDisplay, iEglConfig, iWindow, 0); | ||
|
||
printf("5\n"); | ||
|
||
if(iEglSurface == NULL){ | ||
printf("Couldn't create surface\n"); | ||
return NULL; | ||
} | ||
|
||
printf("6\n"); | ||
|
||
eglMakeCurrent(iEglDisplay, iEglSurface, iEglSurface, iEglContext); | ||
|
||
printf("fininshed making context\n"); | ||
|
||
return iEglSurface; | ||
} | ||
|
||
int Android_GL_MakeCurrent(_THIS, SDL_Window * window, | ||
SDL_GLContext context){ | ||
printf("[STUB] GL_MakeCurrent\n"); | ||
return 0; | ||
} | ||
|
||
int Android_GL_SetSwapInterval(_THIS, int interval){ | ||
printf("[STUB] GL_SetSwapInterval\n"); | ||
return 0; | ||
} | ||
|
||
int Android_GL_GetSwapInterval(_THIS){ | ||
printf("[STUB] GL_GetSwapInterval\n"); | ||
return 0; | ||
} | ||
|
||
void Android_GL_SwapWindow(_THIS, SDL_Window * window){ | ||
printf("[STUB] GL_SwapWindow\n"); | ||
} | ||
|
||
void Android_GL_DeleteContext(_THIS, SDL_GLContext context){ | ||
printf("[STUB] GL_DeleteContext\n"); | ||
} |
Oops, something went wrong.