View.java

/*
 * Copyright © 2012 Nokia Corporation. All rights reserved.
 * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
 * Oracle and Java are trademarks or registered trademarks of Oracle and/or its
 * affiliates. Other product and company names mentioned herein may be trademarks
 * or trade names of their respective owners.
 * See LICENSE.TXT for license information.
 */
package com.nokia.example.racer.views;

import com.nokia.example.racer.Main;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.GameCanvas;

/*
 * Every view in Racer extends this View
 */
public abstract class View
    extends GameCanvas {

    public static int screenWidth;
    public static int screenHeight;
    protected Graphics g;

    /**
     * Super class of views. Defines whether landscape mode is on.
     */
    public View() {
        super(false);
        setFullScreenMode(true);
        screenWidth = this.getWidth();
        screenHeight = this.getHeight();

        if (screenHeight > screenWidth) {
            Main.landscape = false;
        }
        else {
            Main.landscape = true;
        }
    }
}