filename | android/src/org/lxdream/LxdreamView.java |
changeset | 1245:01e0020adf88 |
prev | 1241:74f8e11ab4b8 |
author | nkeynes |
date | Fri Mar 02 23:49:10 2012 +1000 (12 years ago) |
permissions | -rw-r--r-- |
last change | Android WIP: * Rename gui_jni.c to gui_android.c - now quite android specific. * Implement generic EGL driver with very minimal Java wrapper * Run emulation in separate thread, and implement simple queue for inter-thread communication. * Add menu/action-bar items for start + reset |
view | annotate | diff | log | raw |
1 /**
2 * $Id$
3 *
4 * Lxdream GL view. Derived from android
5 *
6 * Copyright (c) 2011 Nathan Keynes.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
19 package org.lxdream;
20 /*
21 * Copyright (C) 2008,2009 The Android Open Source Project
22 *
23 * Licensed under the Apache License, Version 2.0 (the "License");
24 * you may not use this file except in compliance with the License.
25 * You may obtain a copy of the License at
26 *
27 * http://www.apache.org/licenses/LICENSE-2.0
28 *
29 * Unless required by applicable law or agreed to in writing, software
30 * distributed under the License is distributed on an "AS IS" BASIS,
31 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
34 */
37 import android.content.Context;
38 import android.graphics.PixelFormat;
39 import android.util.AttributeSet;
40 import android.util.Log;
41 import android.view.KeyEvent;
42 import android.view.MotionEvent;
43 import android.view.Surface;
44 import android.view.SurfaceHolder;
45 import android.view.SurfaceView;
47 class LxdreamView extends SurfaceView implements SurfaceHolder.Callback {
48 private static String TAG = "LxdreamView";
49 private static final boolean DEBUG = false;
51 public LxdreamView(Context context) {
52 super(context);
53 getHolder().addCallback(this);
54 }
56 @Override
57 public void surfaceCreated( SurfaceHolder holder ) {
58 /* Ignore */
59 }
61 @Override
62 public void surfaceChanged( SurfaceHolder holder, int format, int width, int height ) {
63 setSurface( holder.getSurface(), width, height );
64 }
66 @Override
67 public void surfaceDestroyed( SurfaceHolder holder ) {
68 clearSurface( holder.getSurface() );
69 }
71 private native void setSurface( Surface surface, int width, int height );
72 private native void clearSurface( Surface surface );
74 }
.