Permalink
Browse files

Rename to MrNom and MrNom test

  • Loading branch information...
1 parent fa3d513 commit 81e0cba10c3d961d74cbea8817e5d30a5b01a265 Syver Enstad committed Feb 16, 2012
Showing with 371 additions and 19 deletions.
  1. +0 −13 GameFramework/src/com/androidgames/framework/GameFrameworkActivity.java
  2. 0 {GameFramework → MrNom}/.classpath
  3. +1 −1 {GameFramework → MrNom}/.project
  4. +2 −2 {GameFramework → MrNom}/AndroidManifest.xml
  5. BIN MrNom/assets/background.png
  6. BIN MrNom/assets/bitten.ogg
  7. BIN MrNom/assets/bobargb8888.png
  8. BIN MrNom/assets/bobrgb888.png
  9. BIN MrNom/assets/buttons.png
  10. BIN MrNom/assets/click.ogg
  11. BIN MrNom/assets/eat.ogg
  12. BIN MrNom/assets/gameover.png
  13. BIN MrNom/assets/headdown.png
  14. BIN MrNom/assets/headleft.png
  15. BIN MrNom/assets/headright.png
  16. BIN MrNom/assets/headup.png
  17. BIN MrNom/assets/help1.png
  18. BIN MrNom/assets/help2.png
  19. BIN MrNom/assets/help3.png
  20. BIN MrNom/assets/logo.png
  21. BIN MrNom/assets/mainmenu.png
  22. BIN MrNom/assets/music.ogg
  23. BIN MrNom/assets/numbers.png
  24. BIN MrNom/assets/pausemenu.png
  25. BIN MrNom/assets/ready.png
  26. BIN MrNom/assets/stain1.png
  27. BIN MrNom/assets/stain2.png
  28. BIN MrNom/assets/stain3.png
  29. BIN MrNom/assets/tail.png
  30. +1 −0 MrNom/assets/test.txt
  31. 0 {GameFramework → MrNom}/proguard.cfg
  32. 0 {GameFramework → MrNom}/project.properties
  33. BIN {GameFramework → MrNom}/res/drawable/ic_launcher.png
  34. 0 {GameFramework → MrNom}/res/layout/main.xml
  35. 0 {GameFramework → MrNom}/res/values/strings.xml
  36. 0 {GameFramework → MrNom}/src/com/androidgames/framework/Audio.java
  37. 0 {GameFramework → MrNom}/src/com/androidgames/framework/FileIO.java
  38. 0 {GameFramework → MrNom}/src/com/androidgames/framework/Game.java
  39. 0 {GameFramework → MrNom}/src/com/androidgames/framework/Graphics.java
  40. 0 {GameFramework → MrNom}/src/com/androidgames/framework/Input.java
  41. 0 {GameFramework → MrNom}/src/com/androidgames/framework/Music.java
  42. 0 {GameFramework → MrNom}/src/com/androidgames/framework/Pixmap.java
  43. 0 {GameFramework → MrNom}/src/com/androidgames/framework/Screen.java
  44. 0 {GameFramework → MrNom}/src/com/androidgames/framework/Sound.java
  45. 0 {GameFramework → MrNom}/src/com/androidgames/framework/TouchHandler.java
  46. +49 −0 MrNom/src/com/androidgames/framework/impl/AndroidFastRenderView.java
  47. +93 −0 MrNom/src/com/androidgames/framework/impl/AndroidGame.java
  48. +58 −0 MrNom/src/com/androidgames/mrnom/Assets.java
  49. +43 −0 MrNom/src/com/androidgames/mrnom/GameScreen.java
  50. +43 −0 MrNom/src/com/androidgames/mrnom/LoadingScreen.java
  51. +54 −0 MrNom/src/com/androidgames/mrnom/MainMenuScreen.java
  52. +13 −0 MrNom/src/com/androidgames/mrnom/MrNom.java
  53. +12 −0 MrNom/src/com/androidgames/mrnom/Settings.java
  54. +1 −1 {GameFrameworkTest → MrNomTest}/.classpath
  55. +1 −1 {GameFrameworkTest → MrNomTest}/.project
  56. 0 {GameFrameworkTest → MrNomTest}/AndroidManifest.xml
  57. 0 {GameFrameworkTest → MrNomTest}/proguard.cfg
  58. 0 {GameFrameworkTest → MrNomTest}/project.properties
  59. BIN {GameFrameworkTest → MrNomTest}/res/drawable/ic_launcher.png
  60. 0 {GameFrameworkTest → MrNomTest}/res/layout/main.xml
  61. 0 {GameFrameworkTest → MrNomTest}/res/values/strings.xml
  62. +0 −1 android-basics/src/com/badlogic/androidgames/FastRenderView.java
@@ -1,13 +0,0 @@
-package com.androidgames.framework;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-public class GameFrameworkActivity extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- }
-}
File renamed without changes.
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>GameFramework</name>
+ <name>MrNom</name>
<comment></comment>
<projects>
</projects>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.androidgames.framework"
+ package="com.androidgames.mrnom"
android:versionCode="1"
android:versionName="1.0" >
@@ -10,7 +10,7 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
- android:name=".GameFrameworkActivity"
+ android:name=".MrNom"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Binary file not shown.
View
Binary file not shown.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Binary file not shown.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1 @@
+test tests
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,49 @@
+package com.androidgames.framework.impl;
+
+import java.util.Random;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+
+public class AndroidFastRenderView extends SurfaceView implements Runnable {
+ private SurfaceHolder holder;
+ private volatile boolean running = false;
+ private Thread renderThread;
+ private Random rand = new Random();
+
+
+ public AndroidFastRenderView(Context context) {
+ super(context);
+ holder = getHolder();
+ }
+ void resume() {
+ running = true;
+ renderThread = new Thread(this);
+ renderThread.start();
+ }
+
+ public void run() {
+ while (running) {
+ if (!holder.getSurface().isValid()) {
+ continue;
+ }
+ Canvas canvas = holder.lockCanvas();
+ canvas.drawRGB(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
+ holder.unlockCanvasAndPost(canvas);
+ }
+ }
+
+ public void pause() {
+ running = false;
+ while (true) {
+ try {
+ renderThread.join();
+ return;
+ } catch (InterruptedException e) {
+ // retry
+ }
+ }
+ }
+}
@@ -0,0 +1,93 @@
+package com.androidgames.framework.impl;
+
+import com.androidgames.framework.Audio;
+import com.androidgames.framework.FileIO;
+import com.androidgames.framework.Game;
+import com.androidgames.framework.Graphics;
+import com.androidgames.framework.Input;
+import com.androidgames.framework.Screen;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.graphics.Bitmap;
+import android.graphics.Bitmap.Config;
+import android.os.Bundle;
+import android.os.PowerManager;
+import android.os.PowerManager.WakeLock;
+import android.view.Window;
+import android.view.WindowManager;
+
+public class AndroidGame extends Activity implements Game {
+ AndroidFastRenderView renderView;
+ Graphics graphics;
+ Audio audio;
+ Input input;
+ FileIO fileIO;
+ Screen screen;
+ WakeLock wakeLock;
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+ boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
+ int frameBufferWidth = isLandscape ? 480 : 320;
+ int frameBufferHeight = isLandscape ? 320 : 480;
+ Bitmap frameBuffer = Bitmap.createBitmap(frameBufferWidth,
+ frameBufferHeight, Config.RGB_565);
+
+ PowerManager powerManager = (PowerManager) this
+ .getSystemService(Context.POWER_SERVICE);
+ wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK,
+ "GLGame");
+
+ //setContentView(R.layout.main);
+ }
+
+ @Override
+ public Input getInput() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public FileIO getFileIO() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Graphics getGraphics() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Audio getAudio() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setScreen(Screen screen) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Screen getCurrentScreen() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Screen getStartScreen() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
@@ -0,0 +1,58 @@
+package com.androidgames.mrnom;
+
+import com.androidgames.framework.Game;
+import com.androidgames.framework.Graphics;
+import com.androidgames.framework.Graphics.PixmapFormat;
+import com.androidgames.framework.Pixmap;
+import com.androidgames.framework.Sound;
+
+public class Assets {
+ public static Pixmap background;
+ public static Pixmap logo;
+ public static Pixmap mainMenu;
+ public static Pixmap buttons;
+ public static Pixmap help1;
+ public static Pixmap help2;
+ public static Pixmap help3;
+ public static Pixmap numbers;
+ public static Pixmap ready;
+ public static Pixmap pause;
+ public static Pixmap gameOver;
+ public static Pixmap headUp;
+ public static Pixmap headLeft;
+ public static Pixmap headDown;
+ public static Pixmap headRight;
+ public static Pixmap tail;
+ public static Pixmap stain1;
+ public static Pixmap stain2;
+ public static Pixmap stain3;
+ public static Sound click;
+ public static Sound eat;
+ public static Sound bitten;
+ public static void load(Game game) {
+ Graphics g = game.getGraphics();
+ Assets.background = g.newPixmap("background.png", PixmapFormat.RGB565);
+ Assets.logo = g.newPixmap("logo.png", PixmapFormat.ARGB4444);
+ Assets.mainMenu = g.newPixmap("mainmenu.png", PixmapFormat.ARGB4444);
+ Assets.buttons = g.newPixmap("buttons.png", PixmapFormat.ARGB4444);
+ Assets.help1 = g.newPixmap("help1.png", PixmapFormat.ARGB4444);
+ Assets.help2 = g.newPixmap("help2.png", PixmapFormat.ARGB4444);
+ Assets.help3 = g.newPixmap("help3.png", PixmapFormat.ARGB4444);
+ Assets.numbers = g.newPixmap("numbers.png", PixmapFormat.ARGB4444);
+ Assets.ready = g.newPixmap("ready.png", PixmapFormat.ARGB4444);
+ Assets.pause = g.newPixmap("pausemenu.png", PixmapFormat.ARGB4444);
+ Assets.gameOver = g.newPixmap("gameover.png", PixmapFormat.ARGB4444);
+ Assets.headUp = g.newPixmap("headup.png", PixmapFormat.ARGB4444);
+ Assets.headLeft = g.newPixmap("headleft.png", PixmapFormat.ARGB4444);
+ Assets.headDown = g.newPixmap("headdown.png", PixmapFormat.ARGB4444);
+ Assets.headRight = g.newPixmap("headright.png", PixmapFormat.ARGB4444);
+ Assets.tail = g.newPixmap("tail.png", PixmapFormat.ARGB4444);
+ Assets.stain1 = g.newPixmap("stain1.png", PixmapFormat.ARGB4444);
+ Assets.stain2 = g.newPixmap("stain2.png", PixmapFormat.ARGB4444);
+ Assets.stain3 = g.newPixmap("stain3.png", PixmapFormat.ARGB4444);
+ Assets.click = game.getAudio().newSound("click.ogg");
+ Assets.eat = game.getAudio().newSound("eat.ogg");
+ Assets.bitten = game.getAudio().newSound("bitten.ogg");
+ }
+
+}
@@ -0,0 +1,43 @@
+package com.androidgames.mrnom;
+
+import com.androidgames.framework.Game;
+import com.androidgames.framework.Screen;
+
+public class GameScreen extends Screen {
+
+ public GameScreen(Game game) {
+ super(game);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void update(float deltaTime) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void present(float deltaTime) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void pause() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void resume() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
@@ -0,0 +1,43 @@
+package com.androidgames.mrnom;
+
+
+import com.androidgames.framework.Screen;
+
+public class LoadingScreen extends Screen {
+
+ public LoadingScreen(MrNom mrNom) {
+ super(mrNom);
+ }
+
+ @Override
+ public void update(float deltaTime) {
+ Assets.load(game);
+ Settings.load(game);
+ game.setScreen(new MainMenuScreen(game));
+ }
+
+ @Override
+ public void present(float deltaTime) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void pause() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void resume() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
@@ -0,0 +1,54 @@
+package com.androidgames.mrnom;
+
+import java.util.List;
+
+import com.androidgames.framework.Game;
+import com.androidgames.framework.Graphics;
+import com.androidgames.framework.Input.TouchEvent;
+import com.androidgames.framework.Screen;
+
+public class MainMenuScreen extends Screen {
+
+ public MainMenuScreen(Game game) {
+ super(game);
+ }
+
+ public void update(float deltaTime) {
+ List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
+ int len = touchEvents.size();
+ for (int i = 0; i < len; i++) {
+ TouchEvent event = touchEvents.get(i);
+ if (event.type == TouchEvent.TOUCH_UP) {
+ if (true) { // game start touched
+ game.setScreen(new GameScreen(game));
+ if (Settings.soundEnabled) {
+ Assets.click.play(1);
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ public void present(float deltaTime) {
+ Graphics g = game.getGraphics();
+ g.drawPixmap(Assets.background, 0, 0);
+ g.drawPixmap(Assets.logo, 32, 20);
+ }
+
+ public void pause() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void resume() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Oops, something went wrong.

0 comments on commit 81e0cba

Please sign in to comment.