summaryrefslogtreecommitdiff
path: root/samples/quake/src/com/android/quake/llvm/QuakeViewNoData.java
blob: 93266a959ed3b9d882659e8fac94ce1079cd2e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Copyright (C) 2007 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.android.quake.llvm;

import android.view.View;
import android.content.Context;
import android.graphics.Paint;
import android.graphics.Canvas;

public class QuakeViewNoData extends View {
    public QuakeViewNoData(Context context, int reason)
    {
        super(context);
        mReason = reason;
    }

    public static final int E_NODATA = 1;
    public static final int E_INITFAILED = 2;

    @Override
    protected void onDraw(Canvas canvas) {
        Paint paint = new Paint();
        paint.setColor(0xffffffff);
        paint.setStyle(Paint.Style.FILL);
        canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
        paint.setColor(0xff000000);
        switch(mReason)
        {
            case E_NODATA:
                canvas.drawText("Missing data files. Looking for one of:",
                        10.0f, 20.0f, paint);
                canvas.drawText("/sdcard/data/quake/id1/pak0.pak",
                        10.0f, 35.0f, paint);
                canvas.drawText("/data/quake/id1/pak0.pak",
                        10.0f, 50.0f, paint);
                canvas.drawText("Please copy a pak file to the device and reboot.",
                        10.0f, 65.0f, paint);
                break;
            case E_INITFAILED:
                canvas.drawText("Quake C library initialization failed.",
                        10.0f, 20.0f, paint);
                canvas.drawText("Try stopping and restarting the simulator.",
                        10.0f, 35.0f, paint);
                break;
        }
    }

    private int mReason;

}