src/video/android/SDL_androidwindow.c
author Sam Lantinga <slouken@libsdl.org>
Fri, 11 Feb 2011 22:37:15 -0800
changeset 5262 b530ef003506
parent 5249 7a963be087ef
child 5535 96594ac5fd1a
permissions -rw-r--r--
Happy 2011! :)
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2011 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_FULLSCREEN;     /* window is always fullscreen */
    46     window->flags |= SDL_WINDOW_SHOWN;          /* only one window on Android */
    47     window->flags |= SDL_WINDOW_INPUT_FOCUS;    /* always has input focus */    
    48 
    49     return 0;
    50 }
    51 
    52 void
    53 Android_SetWindowTitle(_THIS, SDL_Window * window)
    54 {
    55     Android_JNI_SetActivityTitle(window->title);
    56 }
    57 
    58 void
    59 Android_DestroyWindow(_THIS, SDL_Window * window)
    60 {
    61     if (window == Android_Window) {
    62         Android_Window = NULL;
    63     }
    64 }
    65 
    66 /* vi: set ts=4 sw=4 expandtab: */