filename | android/src/org/lxdream/LxdreamActivity.java |
changeset | 1245:01e0020adf88 |
prev | 1241:74f8e11ab4b8 |
next | 1247:e48ea82eb72c |
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 * Main Lxdream activity
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;
21 import android.app.Activity;
22 import android.content.Context;
23 import android.os.Bundle;
24 import android.util.Log;
25 import android.view.Menu;
26 import android.view.MenuInflater;
27 import android.view.MenuItem;
28 import android.view.WindowManager;
30 import java.io.File;
33 public class LxdreamActivity extends Activity {
34 LxdreamView view;
36 @Override
37 protected void onCreate(Bundle bundle) {
38 super.onCreate(bundle);
39 Context ctx = getApplication();
41 Log.i("LxdreamActivity", "Calling Dreamcast.init");
42 Dreamcast.init( ctx.getFilesDir().toString() );
43 Log.i("LxdreamActivity", "Finished Dreamcast.init");
44 view = new LxdreamView(ctx);
45 setContentView(view);
46 }
48 @Override
49 public boolean onCreateOptionsMenu(Menu menu) {
50 MenuInflater inflater = getMenuInflater();
51 inflater.inflate(R.menu.main, menu);
52 return true;
53 }
56 @Override
57 protected void onPause() {
58 super.onPause();
59 Dreamcast.stop();
60 }
62 @Override
63 protected void onResume() {
64 super.onResume();
65 }
67 public void onRunClicked( MenuItem item ) {
68 Dreamcast.toggleRun();
69 }
71 public void onResetClicked( MenuItem item ) {
72 Dreamcast.reset();
73 }
75 public void onPreferencesClicked( MenuItem item ) {
76 /* TODO */
77 }
78 }
.