zjc1985 / beginning-android-games Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/beginning-android-games
Automatically exported from code.google.com/p/beginning-android-games
In the printed version of the book, in the sub-section "Continuous Rendering
with SurfaceView", chapter 4, page 179, listing 4-16 leads to an infinite loop.
In method pause() of the inner class FastRenderView, after the join of the
render thread, the while loop condition is trivially still valid, and the
application freezes until the complete saturation of the DVM memory.
It's necessary to add a break after renderThread.join() call.
However, the online source code is correct.
--- Alessandro Dal Bello ---
Original issue reported on code.google.com by [email protected]
on 21 Aug 2011 at 7:32
As much as I love the line in the book "huge amounts of unicorns with rabies",
shouldn't that be "numbers" rather than "amounts"?
Original issue reported on code.google.com by [email protected]
on 29 May 2011 at 11:33
Sorry for posting this here but I assumed that someone using the framework
might be able to help.
Does anyone know how I can show an AlertDialog within a game screen using the
Canvas version of the framework? I've tried adding a showMessage() method to
various parts of the code but always get the old error:
Can't create handler inside thread that has not called Looper.prepare()
because the call is always being made on the renderThread rather than the UI
thread. Can anyone help with a good way to do this?
Original issue reported on code.google.com by [email protected]
on 7 Jun 2011 at 11:14
What steps will reproduce the problem?
1. Loaded projects into Eclipse tried Clean but getting all these errors
[2011-05-24 19:00:29 - ch12-droidinvaders] Unable to resolve target 'android-9'
[2011-05-24 19:00:29 - ch02-hello world] Unable to resolve target 'android-3'
[2011-05-24 19:00:29 - ch11-gl-advanced] Unable to resolve target 'android-9'
[2011-05-24 19:01:16 - ch04-android-basics] ERROR: Unable to open class file
C:\Zvi\Android Beginning Games
Development\ch04-android-basics\gen\com\badlogic\androidgames\R.java: No such
file or directory
[2011-05-24 19:01:17 - ch06-mr-nom] ERROR: Unable to open class file
C:\Zvi\Android Beginning Games
Development\ch06-mrnom\gen\com\badlogic\androidgames\mrnom\R.java: No such file
or directory
[2011-05-24 19:01:18 - ch07-gl-basics] ERROR: Unable to open class file
C:\Zvi\Android Beginning Games
Development\ch07-gl-basics\gen\com\badlogic\androidgames\glbasics\R.java: No
such file or directory
[2011-05-24 19:01:18 - ch08-2d-gamedev] ERROR: Unable to open class file
C:\Zvi\Android Beginning Games
Development\ch08-2d-gamedev\gen\com\badlogic\androidgames\gamedev2d\R.java: No
such file or directory
[2011-05-24 19:01:19 - ch09-jumper] ERROR: Unable to open class file
C:\Zvi\Android Beginning Games
Development\ch09-jumper\gen\com\badlogic\androidgames\jumper\R.java: No such
file or directory
[2011-05-24 19:01:21 - ch10-gl-3d] ERROR: Unable to open class file
C:\Zvi\Android Beginning Games
Development\ch10-gl-3d\gen\com\badlogic\androidgames\gl3d\R.java: No such file
or directory
Windows XP, Eclipse Helios 3.6
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 24 May 2011 at 6:05
The drawRect function in AndroidGraphics.java adds width to y rather than
height, it reads
'canvas.drawRect(x, y, x + width - 1, y + width - 1, paint);'
rather than
'canvas.drawRect(x, y, x + width - 1, y + height - 1, paint);'
Original issue reported on code.google.com by [email protected]
on 10 May 2011 at 3:25
In the chapter "Handling Different Screen Sizes and Resolutions", the screen
resolutions have typos in them: instead "240x320" they are given as "240! 320"
Original issue reported on code.google.com by [email protected]
on 21 May 2011 at 5:12
Making the variable tick static will make your game not reset to the proper
starting tick of .5 if you play multiple games in a row. If your tick has
gotten to .01 (or whatever the case may be) it will start a new game with that
value. I would suggest changing it to just float tick = TICK_INITIAL;
public class World {
static final int WORLD_WIDTH = 10;
static final int WORLD_HEIGHT = 13;
static final int SCORE_INCREMENT = 10;
static final float TICK_INITIAL = 0.5F;
static final float TICK_DECREMENT = 0.05f;
public Snake snake;
public Stain stain;
public boolean gameOver = false;
public int score = 0;
boolean fields[][] = new boolean[WORLD_WIDTH][WORLD_HEIGHT];
Random rand = new Random();
float tickTime = 0;
static float tick = TICK_INITIAL;
Original issue reported on code.google.com by [email protected]
on 8 Nov 2011 at 7:20
I was wondering if there is anyway to incorporate AdMob's AdViews into the Mr.
Nom framework, as currently we don't use any android layouts to display the
game. Has anyone found a way to do this?
Original issue reported on code.google.com by [email protected]
on 7 Dec 2011 at 8:36
What steps will reproduce the problem?
1. starting the game
What is the expected output? What do you see instead?
Instead of the main menu of the game, i see continuosly crashing messages
I've tried to compare the source codes from repository and mine (wrote line per
line by hands, reading the book), and i can't find any difference but my
MrNomGame javaclass that ask me to implement all of the methods (extending
AndroidGame class)...and i think is normal...but your doesn't!!! It implements
only one method and the compiler doesn't ask for any other unimplemented
method...
thanks
Original issue reported on code.google.com by [email protected]
on 22 Oct 2011 at 11:41
What steps will reproduce the problem?
Add the contents of «Using Wake Locks» to the full-screen example.
1. Add this lines into onCreate method (same after or before seting content
view):
PowerManager powerManager =
(PowerManager)context.getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK,
"My Lock");
2. Add «wakeLock.acquire();» and «wakeLock.release();» lines into onResume
and onPause methods respectively.
What is the expected output? What do you see instead?
It doesn't works. Eclipse underline first «context» word and shows de error
«context cannot be resolved».
What version of the product are you using? On what operating system?
Please provide any additional information below.
It's solved without «context.» in that line.
Original issue reported on code.google.com by [email protected]
on 2 Jan 2012 at 9:41
In the printed version of the book, in the sub-section "Frame Rate-Indipendent
Movement", chapter 3, page 101, first page's paragraph, math calculations are
wrong.
60 FPS multiplied by ~0.83 pixel (or ~0.85 as written in the text, but I
expected ~0.83 since this is the correct result of the previous calculation),
equals 50 pixel per second, not 100. And this is what we want, since we have
decided previously to move our pixmap at this speed (50 PpS).
Same incorrect result is achieved with calculations for the 30 FPS device.
Original issue reported on code.google.com by [email protected]
on 15 Aug 2011 at 3:50
i try to run your source code but this example(GLGameTest in chaptef 07) has
error. someone explains to me!
java.lang.NullPointerException
at
com.badlogic.androidgames.framework.impl.GLGame.onSurfaceCreated(GLGame.java:72)
at
com.badlogic.androidgames.jumper.SuperJumper.onSurfaceCreated(SuperJumper.java:2
0)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1112)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)
Original issue reported on code.google.com by [email protected]
on 18 Jul 2011 at 3:41
PDF page 20 / e-book page 15:
"In this regard, the Hero was a major diasppointment for game developers who
had hoped for similar multi-touch capabilities as those found on the iPhone."
"disappointment" vs "diasppointment"
Original issue reported on code.google.com by [email protected]
on 18 Apr 2011 at 4:02
What steps will reproduce the problem?
1. I loaded the project and then below error was thrown.
Unable to resolve target 'android-8'
For all the projects under this.
I tried to Clean but I am unable to and I even tried to rebuild and create the
gen folders but no luck. Am I doing something wrong?
What version of the product are you using? On what operating system?
Using jre7
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Dec 2011 at 3:03
"I am reading chapter three, and on page 98 and 99, you have a example of a
simple implementation of MySuperAwesomeStartScreen, you use methods in the
class, specifically update() and present(), but in the explanation of the the
class you refer to the present() method as render() on page 99, just a heads
up."
Original issue reported on code.google.com by badlogicgames
on 24 Aug 2011 at 4:14
In the printed version of the book, in the sub-section "The World Class",
chapter 6, page 257, Mr.Nom maximum score is wrong.
Ok, this has no effect with the game, nor with our learning process, but I love
Mr.Nom and it can do better than 1000 points :)
The world is big 10x13 cells, and 3 of them are already occupied by the snake
at the beginning of the game. So, the greatest lunch of Mr.Nom is (10 * 13) - 3
= 127 stains, which are equals to 1270 points. There is no need of parenthesis
in this calculation, but in the book they aren't written, and bad priority with
math operations has turned in wrong result.
Go Mr.Nom, beat your highscore!!
--- Alessandro Dal Bello ---
Original issue reported on code.google.com by [email protected]
on 25 Aug 2011 at 9:05
Hello, I love book, but I have one problem. I saw in youtube a tutorial how to
download your code and I did it. But at the end when you import code to
Eclipse, I have a errors show up. But in tutorail you fix this problem by going
to Project and Clean. I did the same, but did work.
I said to me:
"Cleaning all projects has encountered a problem. Errors occured during the
build".
And there is button ok and Detail
In Details it said:"Errors occurred during the build.
Errors running builder 'Android Pre Compiler' on project 'ch02-hello-world'.
Resource '/ch02-hello-world/gen' does not exist.
Resource '/ch02-hello-world/gen' does not exist.
Errors running builder 'Android Pre Compiler' on project 'ch04-android-basics'.
Resource '/ch04-android-basics/gen' does not exist.
Resource '/ch04-android-basics/gen' does not exist.
Errors running builder 'Android Pre Compiler' on project 'ch06-mrnom'.
Resource '/ch06-mrnom/gen' does not exist.
Resource '/ch06-mrnom/gen' does not exist.
Errors running builder 'Android Pre Compiler' on project 'ch07-gl-basics'.
Resource '/ch07-gl-basics/gen' does not exist.
Resource '/ch07-gl-basics/gen' does not exist.
Errors running builder 'Android Pre Compiler' on project 'ch08-2d-gamedev'.
Resource '/ch08-2d-gamedev/gen' does not exist.
Resource '/ch08-2d-gamedev/gen' does not exist.
Errors running builder 'Android Pre Compiler' on project 'ch09-jumper'.
Resource '/ch09-jumper/gen' does not exist.
Resource '/ch09-jumper/gen' does not exist.
Errors running builder 'Android Pre Compiler' on project 'ch10-gl-3d'.
Resource '/ch10-gl-3d/gen' does not exist.
Resource '/ch10-gl-3d/gen' does not exist.
Errors running builder 'Android Pre Compiler' on project 'ch11-gl-advanced'.
Resource '/ch11-gl-advanced/gen' does not exist.
Resource '/ch11-gl-advanced/gen' does not exist.
Errors running builder 'Android Pre Compiler' on project 'ch12-droidinvaders'.
Resource '/ch12-droidinvaders/gen' does not exist.
Resource '/ch12-droidinvaders/gen' does not exist."
So pls can you help me, i do not know what to do?
Thank you
Original issue reported on code.google.com by [email protected]
on 31 Oct 2011 at 2:42
What steps will reproduce the problem?
1. I followed your setup video and when i imported the projects i was presented
with these errors. even after cleaning, can you please point me in the right
direction thanks
"[2012-01-03 15:30:10 - ch10-gl-3d] Android requires compiler compliance level
5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:19 - ch02-hello-world] Android requires compiler compliance
level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:19 - ch04-android-basics] Android requires compiler
compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools >
Fix Project Properties.
[2012-01-03 15:31:19 - ch06-mrnom] Android requires compiler compliance level
5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:19 - ch07-gl-basics] Android requires compiler compliance
level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:19 - ch08-2d-gamedev] Android requires compiler compliance
level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:19 - ch09-jumper] Android requires compiler compliance level
5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:19 - ch10-gl-3d] Android requires compiler compliance level
5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:42 - ch02-hello-world] Android requires compiler compliance
level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:42 - ch04-android-basics] Android requires compiler
compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools >
Fix Project Properties.
[2012-01-03 15:31:42 - ch06-mrnom] Android requires compiler compliance level
5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:42 - ch07-gl-basics] Android requires compiler compliance
level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:42 - ch08-2d-gamedev] Android requires compiler compliance
level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:42 - ch09-jumper] Android requires compiler compliance level
5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
[2012-01-03 15:31:42 - ch10-gl-3d] Android requires compiler compliance level
5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project
Properties.
"
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
I am running latest eclipse and on windows 7
all files are uptodate as far as i am aware.
thanks
Daniel
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 3 Jan 2012 at 3:37
Page 181, second to last paragraph:
There is no isue or typo, but I like the use and definition of the a very cool,
geek-worthy term: "heisenbug".
-- Scott Thisse --
Original issue reported on code.google.com by [email protected]
on 12 May 2011 at 1:10
Near the bottom of the page you list the following equations:
blue = src.green * src.alpha + dst.green * (1 - src.alpha)
green = src.blue * src.alpha + dst.blue * (1 - src.alpha)
shouldn't is be:
blue = src.blue * src.alpha + dst.blue * (1 - src.alpha)
green = src.green * src.alpha + dst.green * (1 - src.alpha)
Original issue reported on code.google.com by [email protected]
on 23 Jun 2011 at 4:22
In the printed version of the book, chapter 8, page 392, listing 8-10, there is
an unused parameter in clearDynamicCells() method.
I think that correct code is:
public void clearDynamicCells() {
...
}
instead of:
public void clearDynamicCells(GameObject obj) {
...
}
I take this opportunity to ask a question about getPotentialColliders() method,
implemented in the same class: why is there a need to check for potential
duplication in the staticCells list? Static objects set has no intersection
with the dynamic objects one and a static thing cannot move from one cell to
another. So, if we add a static object to the spatial hash grid only once, then
maybe this check is unnecessary. Do I miss something?
--- Alessandro Dal Bello ---
Original issue reported on code.google.com by [email protected]
on 11 Sep 2011 at 3:19
PDF page 187 / e-book page 190:
-----------------------------------------------
package com.badlogic.androidgames.framework.impl;
import java.io.IOException;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import com.badlogic.androidgames.framework.Music;
public class AndroidMusic implements Music, OnCompletionListener {
MediaPlayer mediaPlayer;
boolean isPrepared = false; package com.badlogic.androidgames.framework.impl;
import java.io.IOException;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import com.badlogic.androidgames.framework.Music;
public class AndroidMusic implements Music, OnCompletionListener {
MediaPlayer mediaPlayer;
boolean isPrepared = false;
--------------------------------------------------------------------
Original issue reported on code.google.com by emelial%[email protected]
on 20 May 2011 at 9:32
It was missing the [width = bitmap.getWidth(); height = bitmap.getHeight();]
underneath of gl.glBindTexture in the load function. It wouldn't work properly
without it.
Original issue reported on code.google.com by [email protected]
on 13 Jul 2011 at 10:15
Attachments:
PDF page 224:
Current line:
graphics = new AndroidGraphics(getAssets(), frameBuffer);
AndroidGraphics constructor requires also canvas and paint:
AndroidGraphics(AssetManager assets, Bitmap frameBuffer, Canvas canvas, Paint
paint)
Original issue reported on code.google.com by [email protected]
on 23 May 2011 at 11:09
In the printed version of the book, in the sub-section "AndroidGraphics:
Serving Our Drawing Needs", chapter 5, page 217, listing 5-12 implements
newPixmap(String, PixmapFormat) with a little inaccuracy.
The method sets an instance of BitmapFactory.Options, but it isn't passed in
the BitmapFactory.decodeStream() static call.
I think that correct code is:
bitmap = BitmapFactory.decodeStream(in, null, options);
instead of:
bitmap = BitmapFactory.decodeStream(in);
--- Alessandro Dal Bello ---
Original issue reported on code.google.com by [email protected]
on 21 Aug 2011 at 2:37
The book shows examples that use Android's FloatMath class. In the
corresponding text it is referred to as FastMath.
(Example page 370, but also in other places I do not find right now. ;-))
Original issue reported on code.google.com by [email protected]
on 22 Nov 2011 at 3:18
PDF page 226:
getCurrentScreen() is not the last method. Our Game interface implemented by
AndroidGame requires to override getStartScreen(). Unless I missed something...
Original issue reported on code.google.com by [email protected]
on 23 May 2011 at 11:05
Always in the printed version of the book, chapter 7, page 314, listing 7-8,
method dispose() doesn't unbind texture properly.
OpenGL ES method glBindTexture has to be called with the "special" texture ID
0, to unbind the texture.
I think that correct code is:
gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);
instead of:
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);
The online code is affected too.
--- Alessandro Dal Bello ---
Original issue reported on code.google.com by [email protected]
on 3 Sep 2011 at 8:43
In the framework implementation in Ch 5 code, in KeyboardHandler.java the
onKey() function the two if statements which read
'if(keyCode > 0 && keyCode < 127)' exclude the values 0 and 127 which I
understand to be acceptable values the statement should be
'if(keyCode >= 0 && keyCode < 128)'
Original issue reported on code.google.com by [email protected]
on 10 May 2011 at 3:08
In Chapter 5 the Override method for pause doesent exist, but it is located in
the sourcecode;
Original issue reported on code.google.com by [email protected]
on 21 Nov 2011 at 3:16
Page: 332
in present()
gl.glRotatef() and gl.glScalef() are introduced before you talk about them in
the source code.
The output will look different than the picture on the following page (page
333).
Original issue reported on code.google.com by [email protected]
on 20 May 2011 at 10:20
The SpatialHashGrid class throws a out of bounds exception in several places:
36: while((cellId = cellIds[i++]) != -1) {
45: while((cellId = cellIds[i++]) != -1) {
54: while((cellId = cellIds[i++]) != -1) {
72: while((cellId = cellIds[i++]) != -1) {
Fixed version of the class is in attached file
Original issue reported on code.google.com by [email protected]
on 26 Jun 2011 at 1:34
Attachments:
Page 99, item 3:
The text refers to the "render()" method, but matching method in the code
listing is called "present()".
Page 105, 4th paragraph:
The versionName is displayed to users of the Android Market when they browses
our application."
should read
The versionName is displayed to users of the Android Market when they browse
our application."
Page 105, 5th paragraph:
On Android 2.2 or newer the application will always get installed to the
internal storage if possible.
should probably read
With this setting on Android 2.2 or newer, the application will always get
installed to the external storage if possible.
Page 107 and again on 108, code listings:
There appears to be an extra ">" at the end of each of the
android:screenOrientation lines.
Page 127, 2nd paragraph:
"simplified four our game" should read "simplified for our game".
Page 127, 3rd paragraph:
"the three of the most relevant" should read "three of the most relevant".
Page 131, last line of the note box:
The numbers specified are no longer accurate. perhaps the line should read
"To support all multitouch-capable Android versions (2.0 and above), we have to
use the API of SDK version 5 or later."
Page 153, 2nd paragraph from the bottom:
"Notice that we didn't unload the sound or released the SoundPool"
should read
"Notice that we didn't unload the sound or release the SoundPool"
Page 158, near the bottom of the page:
There is an extraneous "]" in the line that starts "stay on, the CPU will".
Page 173, third paragraph:
The text states that the bitmap is scaled to 250 x 250, but the code actually
scales it to 300 x 300.
Page 174, second paragraph under the "Loading Fonts" section:
"Interestingly enough, this method does not throw any kind of Exception""
should probably read
"Interestingly enough, this method does not throw a specific kind of Exception"
Page 181, last line of the third paragraph:
"This will execute the next method of the FastRenderView in that new thread."
should more accurately read
"This will execute the run() method of the FastRenderView in that new thread."
-- Scott Thisse --
Original issue reported on code.google.com by [email protected]
on 12 May 2011 at 1:08
What steps will reproduce the problem?
1. Any attempt to download the code via SVN. Have tried via SVN on windows via
command and tortoise, as well as command line on Ubuntu.
What is the expected output? What do you see instead?
I expect to be able see the code, instead I get:
C:\dev\bag>svn checkout http://beginning-android-games.googlecode.com/svn/trunk/
beginning-android-games-read-only
svn: OPTIONS of 'http://beginning-android-games.googlecode.com/svn/trunk': Could
not resolve hostname `beginning-android-games.googlecode.com': No such host is
known.
(http://beginning-android-games.googlecode.com)
C:\dev\bag>
What version of the product are you using? On what operating system?
C:\dev\bag>svn --version
svn, version 1.6.15 (SlikSvn/1.6.15) WIN32
compiled Dec 17 2010, 14:03:07
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.apache.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository access (RA) modules are available:
* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
- handles 'http' scheme
- handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
- with Cyrus SASL authentication
- handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
- handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
- handles 'http' scheme
- handles 'https' scheme
Windows XP SP3
C:\dev\bag>
Please provide any additional information below.
As mentioned, I have tried with similar results on both an XP machine as well
as a Linux machine.
Plugging the URL directly into a web page does however give you the code tree
via HTML.
Original issue reported on code.google.com by [email protected]
on 28 Sep 2011 at 2:08
What steps will reproduce the problem?
1. Run BobTest
What is the expected output? What do you see instead?
100 Bobs should be bouncing around the screen but instead only some Bobs are
seen "flying away" upwards (if you get lucky).
Problem:
The y-component of the coordinate system used for the Bob objects in Bob.java
is opposite to the coordinate system on the actual screen.
Proposed solution:
Suggested change 1:
Page 339 (BobTest.java)
Change:
gl.glTranslatef(bobs[i].x, bobs[i].y, 0);
to:
gl.glTranslatef(bobs[i].x, -1 * bobs[i].y, 0);
There is other (minor, non-critical) issue on that same class, NUM_BOBS value
is ignored when Bob objects are instantiated.
Suggested change 2:
Page 338 (BobTest.java)
Change:
bobs = new Bob[100];
for(int i = 0; i < 100; i++) {
bobs[i] = new Bob();
}
to
bobs = new Bob[NUM_BOBS];
for (int i = 0; i < NUM_BOBS; i++) {
bobs[i] = new Bob();
}
Great book!!!
Original issue reported on code.google.com by [email protected]
on 27 Sep 2011 at 7:12
What is the expected output? What do you see instead?
I'm trying to load an .obj Object with the Ch. 11 "GL- Advanced" obj loader.
But the Object seems to miss some triangles. Do you know what will fix the
problem?
I'm using this to draw the Object to screen:
cessna.draw(GL10.GL_TRIANGLES, 0, cessna.getNumVertices());
I attached a Screenshot from the Emulator.
Original issue reported on code.google.com by [email protected]
on 27 Dec 2011 at 4:27
Attachments:
What steps will reproduce the problem?
1. Start DroidInvaders
2. Play for some time.
3. More to and fro between Settings and Home Screen
DroidInvaders crashes.
Crash Logs :
E/AndroidRuntime( 2799): Uncaught handler: thread GLThread 9 exiting due to
uncaught exception
E/AndroidRuntime( 2799): java.lang.IndexOutOfBoundsException: Invalid location
3, size is 0
E/AndroidRuntime( 2799): at java.util.ArrayList.get(ArrayList.java:341)
E/AndroidRuntime( 2799): at
com.badlogic.androidgames.droidinvaders.SettingsScreen.update(SettingsScreen.jav
a:42)
E/AndroidRuntime( 2799): at
com.badlogic.androidgames.framework.impl.GLGame.onDrawFrame(GLGame.java:96)
E/AndroidRuntime( 2799): at
android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1133)
E/AndroidRuntime( 2799): at
android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:981)
Observed on Sony xperia
Original issue reported on code.google.com by [email protected]
on 29 Jul 2011 at 1:40
The SpatialHashGrid examples in your download section missing the "i<=3"
condition in all of your cell methos (remove, add, get).
Wihout that, the example will crash many times.
best regards,
joe
Original issue reported on code.google.com by [email protected]
on 6 Oct 2011 at 1:51
The type-o is on page 190 on the 5th line down:
" boolean isPrepared = false; package com.badlogic.androidgames.framework.impl;"
the line should be:
"boolean isPrepared = false;"
the source code on the website is correct though.
Original issue reported on code.google.com by [email protected]
on 6 May 2011 at 4:44
What steps will reproduce the problem?
1. Copy the code for ObjLoader Class
2. Change the LightTest class to use the ObjLoader
3. Use the invader.obj file
What is the expected output? What do you see instead?
I have a lot triangles missing maybe about half
What version of the product are you using? On what operating system?
MacOs X 10.6.8
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 2 Jan 2012 at 1:49
Caculations shown in book:
pixelsPerUnitX = screenWidth / worldWidth = 480 / 9.6 = 50 pixels / meter
pixelsPerUnitY = screenHeight / worldHeight = 320 / 6.4 = 50 pixels / meter
Issue: If you divide the pixels by the meters smaller number of meters becomes
a larger number of pixels
ex:
480/9.6 = 50 or 320/6.4 = 50
50/1.0 = 50
50/0.5 = 100
Should be:
pixelsPerUnitX = screenWidth / worldWidth = 480 / 9.6 = 50 pixels * meter
pixelsPerUnitY = screenHeight / worldHeight = 320 / 6.4 = 50 pixels * meter
ex:
480/9.6 = 50 or 320/6.4 = 50
50*1.0 = 50
50*0.5 = 25
Original issue reported on code.google.com by [email protected]
on 12 Oct 2011 at 10:24
What steps will reproduce the problem?
1. After using the code from 'FixedSpatialHashGrid.java' that was posted by
[email protected], there were still errors. The problem was that the
following methods were trying to access ArrayList items indexed as -1 (cellId
's marked as not containing the obj GameObject):
insertStaticObject, insertDynamicObject, removeObject, and getPotentialColliders
Example:
Original:
public void insertDynamicObject(GameObject obj) {
int[] cellIds = getCellIds(obj);
int i = 0;
int cellId = -1;
for(i = 0; i < cellIds.length; ++i) {
cellId = cellIds[i];
dynamicCells[cellId].add(obj);
}
}
Fixed:
public void insertDynamicObject(GameObject obj){
int[] cellIds = getCellIds(obj);
int cellId = -1;
for (int i = 0; i < cellIds.length; ++i){
cellId = cellIds[i];
if (cellId == -1)
continue;
dynamicCells[cellId].add(obj);
}
}
Attached working version of the complete class
Thank you for writing such a great book!
Original issue reported on code.google.com by [email protected]
on 12 Oct 2011 at 6:48
Attachments:
In the book and the downloadable source code it read
"@Override
public void onResume() {
super.onPause();
glView.onResume();
}
@Override
public void onPause() {
super.onPause();
glView.onPause();
}"
the override of onResume calls super.onPause instead of super.onResume, it
should read....
"@Override
public void onResume() {
super.onResume();
glView.onResume();
}
@Override
public void onPause() {
super.onPause();
glView.onPause();
}
"
Original issue reported on code.google.com by [email protected]
on 24 Jul 2011 at 11:58
[ Bug ]
Back button on settings screen in Droid Invaders isn't working properly. Its
bounds are set at right-top from the proper place (you have to touch somewhere
between arrow and image of hand).
[ What is wrong ]
I found these lines in ch12-droidinvaders/(...)/SettingsScreen.java (revision
26):
33: soundBounds = new Rectangle(360 - 32, 160 - 32, 64, 64);
34: backBounds = new Rectangle(32, 32, 64, 64);
and these
97: batcher.drawSprite(360, 160, 64, 64, (...)
100: batcher.drawSprite(32, 32, 64, 64, Assets.leftRegion);
So there is no substraction of 32 in backBounds' x and y.
[ Solution ]
It should be:
34: backBounds = new Rectangle(32 - 32, 32 - 32, 64, 64);
Now I can touch the arrow to get back to main menu.
[ Additional info ]
Device: Samsung Nexus S
OS: Android 2.3.4
Original issue reported on code.google.com by [email protected]
on 7 Sep 2011 at 12:22
Last night i lost more than 40% of my battery power.
As i look in the taskmanager, i saw that "mr nom" is still runing.
Could it be that "mr nom" renderview thread is still runing after closing the
app?
Original issue reported on code.google.com by [email protected]
on 5 Sep 2011 at 9:11
What steps will reproduce the problem?
1. Just looking at the code in AndroidGraphics.
2.
3.
What is the expected output? What do you see instead?
I believe the AndroidGraphics.newPixmap() method is not using the format passed
in. Around line 44, you create a new instance of Options and properly set the
inPreferredConfig, but then when the BitmapFactory.decodeStream() is called,
you do not use the version that accepts the options.
I believe the decodeStream method call should look like this:
bitmap = BitmapFactory.decodeStream(in,null, options);
What version of the product are you using? On what operating system?
Windows 7 Home Prem 64 Bit
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 30 Dec 2011 at 11:05
Basically, every time you restart MrNom, (like say turn off your phone and
reboot your phone), your settings do not load. this includes wrong
soundEnabled, and previous high scores are not loaded.
What steps will reproduce the problem?
1. copyright 2011 edition of book
2. using the code from pg 235
3. Ubuntu 9.10
4. Eclipse Galileo
5.
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.9) (6b20-1.9.9-0ubuntu1~10.04.2)
OpenJDK Server VM (build 19.0-b09, mixed mode)
6. latest Android tools as of Sept 9th, 2011 (which should not affect this
error)
What is the expected output? What do you see instead?
the expected output is that the settings load properly
I'm not sure why no one else has this problem, im guessing because i'm using an
older version of Java?
Original issue reported on code.google.com by [email protected]
on 10 Sep 2011 at 6:44
When playing Super Jumper on my tablet (xoom android 3.1) the accelerometer
orientation is wrong. Moving the tablet up and down makes the game move left
and right. Is there a way of detecting the default accelerometer's orientation
as I guess it's different on all tablets to phones.
Original issue reported on code.google.com by [email protected]
on 6 Jan 2012 at 6:00
The implementation of the mediaPlayer.pause() in the beginning of chapter 5 is
missing from the book. The downloadable source code is ok, though.
Here is the method:
@Override
public void pause() {
if (mediaPlayer.isPlaying())
mediaPlayer.pause();
}
Original issue reported on code.google.com by [email protected]
on 12 Jul 2011 at 8:43
In the printed version of the book, in the sub-section "Encoding Colors
Digitally", chapter 3, page 86, figure 3-23 shows strange color component
values for the 16-bit representation of the float (1.0, 0.5, 0.75).
Maybe I miss something, but the Blue component, which it's memorized in 5 bits,
cannot exceed the value 31. And in this particular case, it should be something
like 24, since the real value is 0.75.
Instead, the 16-bit color is represented by the triplet (31, 31, 45).
--- Alessandro Dal Bello ---
Original issue reported on code.google.com by [email protected]
on 15 Aug 2011 at 4:10
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.