⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appletmode.java

📁 一个java的免费游戏引擎,里面有文档,和例子
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 

package com.golden.gamedev.engine.graphics;

import com.golden.gamedev.engine.BaseGraphics;
import java.applet.Applet;
import java.awt.*;
import java.awt.image.BufferStrategy;

public class AppletMode extends Applet
    implements BaseGraphics
{

    public static final GraphicsDevice DEVICE;
    public static final GraphicsConfiguration CONFIG;
    private Canvas c;
    private BufferStrategy d;
    private Graphics2D e;

    public AppletMode()
    {
    }

    public void start()
    {
        if(d == null)
        {
            setIgnoreRepaint(true);
            setLayout(null);
            c = new Canvas(CONFIG);
            c.setIgnoreRepaint(true);
            c.setSize(getSize());
            add(c);
            c.setLocation(0, 0);
            c.createBufferStrategy(2);
            while(d == null) 
                try
                {
                    d = c.getBufferStrategy();
                }
                catch(Exception _ex) { }
            do
                try
                {
                    getBackBuffer();
                    break;
                }
                catch(Exception _ex) { }
            while(true);
        }
        c.requestFocus();
    }

    public Graphics2D getBackBuffer()
    {
        if(e == null)
            e = (Graphics2D)d.getDrawGraphics();
        return e;
    }

    public boolean flip()
    {
        e.dispose();
        e = null;
        d.show();
        Toolkit.getDefaultToolkit().sync();
        if(!d.contentsLost())
            return true;
        return false;
        JVM INSTR pop ;
        return true;
    }

    public void cleanup()
    {
    }

    public void destroy()
    {
        cleanup();
    }

    public Dimension getSize()
    {
        return super.getSize();
    }

    public Component getComponent()
    {
        return c;
    }

    public String getGraphicsDescription()
    {
        return "Applet Mode [" + getSize().width + "x" + getSize().height + "] with BufferStrategy";
    }

    public void setWindowTitle(String s)
    {
    }

    public String getWindowTitle()
    {
        return "";
    }

    public void setWindowIcon(Image image)
    {
    }

    public Image getWindowIcon()
    {
        return null;
    }

    static 
    {
        DEVICE = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        CONFIG = DEVICE.getDefaultConfiguration();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -