Android Open Source - RockFall-Android Game Screen






From Project

Back to project page RockFall-Android.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project RockFall-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package eu.raffprta.rockfall.app;
//from ww w .  java2 s . c o  m
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;


/**
 * Class that handles what is drawn on the screen - it
 * basically acts as a very simple 2D rendering engine of pixels
 * @author Raffaello Perrotta
 *
 */

public class GameScreen {

    private int width, height;

    public GameScreen(int width, int height) {
        this.width = width;
        this.height = height;
    }

    public void render(int x, int y, Canvas c, SpriteContainer s) {
        c.drawBitmap(s.getSprite(), x, y, null);
    }

    Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);

    public void renderText(int x, int y, Canvas c, String text, int fontSize){
        p.setColor(Color.TRANSPARENT);
        c.drawPaint(p);
        p.setColor(Color.GRAY);
        p.setStyle(Paint.Style.FILL);
        p.setTextSize(fontSize);
        c.drawText(text, x+2, y+fontSize, p);
    }

    public int getWidth(){
        return this.width;
    }

    public int getHeight(){
        return this.height;
    }
}




Java Source Code List

eu.raffprta.rockfall.app.GameCanvas.java
eu.raffprta.rockfall.app.GameIntent.java
eu.raffprta.rockfall.app.GameScreen.java
eu.raffprta.rockfall.app.MainGame.java
eu.raffprta.rockfall.app.MenuCanvas.java
eu.raffprta.rockfall.app.SpriteContainer.java
eu.raffprta.rockfall.app.StopWatch.java
eu.raffprta.rockfall.app.TouchHandler.java
eu.raffprta.rockfall.core.entity.AbstractEntity.java
eu.raffprta.rockfall.core.entity.EntityFactory.java
eu.raffprta.rockfall.core.entity.Entity.java
eu.raffprta.rockfall.core.entity.FallableType.java
eu.raffprta.rockfall.core.entity.Fallable.java
eu.raffprta.rockfall.core.entity.Powerup.java
eu.raffprta.rockfall.core.entity.Protagonist.java
eu.raffprta.rockfall.core.entity.Rock.java
eu.raffprta.rockfall.core.sprite.SpriteFactory.java
eu.raffprta.rockfall.core.sprite.SpriteSheet.java
eu.raffprta.rockfall.core.sprite.Sprite.java