src/video/android/SDL_androidwindow.c
author Sam Lantinga <slouken@libsdl.org>
Mon, 07 Feb 2011 17:44:07 -0800
changeset 5222 c66b2a778b7e
parent 5001 77df56570442
child 5249 7a963be087ef
permissions -rw-r--r--
Try to create an OpenGL ES 2.0 context on Android and successfully fall back to OpenGL ES 1.1 if that fails.
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2010 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #include "../SDL_sysvideo.h"
    25 
    26 #include "SDL_androidvideo.h"
    27 #include "SDL_androidwindow.h"
    28 
    29 int
    30 Android_CreateWindow(_THIS, SDL_Window * window)
    31 {
    32     if (Android_Window) {
    33         SDL_SetError("Android only supports one window");
    34         return -1;
    35     }
    36     Android_Window = window;
    37 
    38     /* Adjust the window data to match the screen */
    39     window->x = 0;
    40     window->y = 0;
    41     window->w = Android_ScreenWidth;
    42     window->h = Android_ScreenHeight;
    43 
    44     window->flags &= ~SDL_WINDOW_RESIZABLE;     /* window is NEVER resizeable */
    45     window->flags |= SDL_WINDOW_OPENGL;         /* window is always OpenGL */
    46     window->flags |= SDL_WINDOW_FULLSCREEN;     /* window is always fullscreen */
    47     window->flags |= SDL_WINDOW_SHOWN;          /* only one window on Android */
    48     window->flags |= SDL_WINDOW_INPUT_FOCUS;    /* always has input focus */    
    49 
    50     return 0;
    51 }
    52 
    53 void
    54 Android_SetWindowTitle(_THIS, SDL_Window * window)
    55 {
    56     Android_JNI_SetActivityTitle(window->title);
    57 }
    58 
    59 void
    60 Android_DestroyWindow(_THIS, SDL_Window * window)
    61 {
    62     if (window == Android_Window) {
    63         Android_Window = NULL;
    64     }
    65 }
    66 
    67 /* vi: set ts=4 sw=4 expandtab: */