Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Paint;
import android.graphics.Paint.Align;

import android.graphics.Typeface;

public class Main {
    private static boolean draw_help, draw_btns, draw_battery, draw_stats, draw_controls, draw_shields, draw_aim;
    private static Paint textPaint, fieldPaint, highlightPaint, titlePaint, controlPaint, arrowPaint, bitmapPaint;

    /**
     * Initializes all necessary values. Must be called once before 
     * any other method to avoid NullPointerException.
     */
    public static void init() {

        // initialize all booleans to true
        draw_help = true;
        draw_aim = true;
        draw_shields = true;
        draw_battery = true;
        draw_controls = true;
        draw_stats = true;
        draw_btns = true;

        // Initialize all Paints and set as much information as possible without
        // access to resources
        titlePaint = new Paint();
        titlePaint.setTextAlign(Align.LEFT);

        textPaint = new Paint();
        textPaint.setTextAlign(Align.LEFT);
        textPaint.setTypeface(Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL));
        textPaint.setAntiAlias(true);

        fieldPaint = new Paint();

        highlightPaint = new Paint();
        highlightPaint.setStyle(Paint.Style.FILL);
        highlightPaint.setAntiAlias(true);

        arrowPaint = new Paint();
        arrowPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        arrowPaint.setStrokeWidth(3);
        arrowPaint.setAntiAlias(true);

        controlPaint = new Paint();
        controlPaint.setStyle(Paint.Style.STROKE);
        controlPaint.setStrokeWidth(5);

        bitmapPaint = new Paint();
        bitmapPaint = new Paint();
        bitmapPaint.setStrokeWidth(10);
        bitmapPaint.setFilterBitmap(true);
        bitmapPaint.setAntiAlias(true);
    }
}