Android Open Source - Tilt-snake My G L Surface View






From Project

Back to project page Tilt-snake.

License

The source code is released under:

Apache License

If you think the Android project Tilt-snake 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

/*The following code was borrowed from
 * http://developer.android.com/training/graphics/opengl/index.html
 * and modified to suit the needs of the application.
 * //w ww . j  a v  a  2  s.  c om
 * 
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed 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.awhittle.tiltsnake;

import android.content.Context;
import android.opengl.GLSurfaceView;

/**
 * A view container where OpenGL ES graphics can be drawn on screen.
 * This view can also be used to capture touch events, such as a user
 * interacting with drawn objects.
 */
public class MyGLSurfaceView extends GLSurfaceView {

    private final MyGLRenderer mRenderer;

    public MyGLSurfaceView(Context context) {
        super(context);

        // Create an OpenGL ES 2.0 context.
        setEGLContextClientVersion(2);

        // Set the Renderer for drawing on the GLSurfaceView
        mRenderer = new MyGLRenderer();
        setRenderer(mRenderer);

        // Render continuously
        setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    }

}




Java Source Code List

com.awhittle.tiltsnake.Direction.java
com.awhittle.tiltsnake.Egg.java
com.awhittle.tiltsnake.GameActivity.java
com.awhittle.tiltsnake.Head.java
com.awhittle.tiltsnake.MainActivity.java
com.awhittle.tiltsnake.Movement.java
com.awhittle.tiltsnake.MyGLRenderer.java
com.awhittle.tiltsnake.MyGLSurfaceView.java
com.awhittle.tiltsnake.Saving.java
com.awhittle.tiltsnake.ShapeTools.java
com.awhittle.tiltsnake.Square.java
com.awhittle.tiltsnake.Tail.java