com.gamemaker.screens.GameOverScreen.java Source code

Java tutorial

Introduction

Here is the source code for com.gamemaker.screens.GameOverScreen.java

Source

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.gamemaker.screens;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.gamemaker.ERhelpers.AssetLoader;

/**
 * Created by robertcao on 8/09/2016.
 */
public class GameOverScreen implements Screen {
    private Game game;
    private ShapeRenderer shapeRenderer;
    private OrthographicCamera cam;
    private SpriteBatch batcher;//this is for drawing pictures for u
    private TextureRegion menuBG, menuTitle1, menuTitle2, menuStart;

    public GameOverScreen(Game game) {
        this.game = game;
        cam = new OrthographicCamera();
        cam.setToOrtho(true, 1280, 720);
        batcher = new SpriteBatch();
        batcher.setProjectionMatrix(cam.combined);
        shapeRenderer = new ShapeRenderer();
        shapeRenderer.setProjectionMatrix(cam.combined);
    }

    @Override
    public void show() {

    }

    public void update(float deltaTime) {
        if (Gdx.input.justTouched()) {
            int[] data = new int[5];
            game.setScreen(new GameScreen1(game, data));
        }
    }

    public void draw(float deltaTime) {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
        batcher.begin();
        //batcher.disableBlending();
        batcher.draw(menuBG, 0, 0, 1280, 720);
        batcher.draw(menuTitle1, 40, 180, 650, 150);
        batcher.draw(menuStart, 520, 340, 200, 200);
        batcher.draw(menuTitle2, 720, 180, 460, 150);
        batcher.end();
    }

    @Override
    public void render(float delta) {
        update(delta);
        draw(delta);
    }

    @Override
    public void resize(int width, int height) {

    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void hide() {

    }

    @Override
    public void dispose() {

    }
}