📄 fullscreenmode.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 com.golden.gamedev.util.ImageUtil;
import java.awt.*;
import java.awt.image.BufferStrategy;
import java.awt.image.VolatileImage;
import java.io.PrintStream;
import java.util.*;
// Referenced classes of package com.golden.gamedev.engine.graphics:
// WindowExitListener
public class FullScreenMode
implements BaseGraphics, Comparator
{
public static final GraphicsDevice DEVICE;
public static final GraphicsConfiguration CONFIG;
private Frame d;
private Dimension e;
private VolatileImage f;
private BufferStrategy g;
private Graphics2D h;
static Class a;
public FullScreenMode(Dimension dimension, boolean flag)
{
DisplayMode displaymode;
DisplayMode displaymode1;
e = dimension;
if(!DEVICE.isFullScreenSupported())
throw new RuntimeException("Full Screen Exclusive Mode is not supported");
d = new Frame("Golden T Game Engine", CONFIG);
try
{
d.setIconImage(ImageUtil.getImage((a != null ? a : (a = a("com.golden.gamedev.engine.graphics.FullScreenMode"))).getResource("Icon.png")));
}
catch(Exception _ex) { }
d.addWindowListener(WindowExitListener.getInstance());
d.setResizable(false);
d.setIgnoreRepaint(true);
d.setLayout(null);
d.setUndecorated(true);
d.dispose();
DEVICE.setFullScreenWindow(d);
if(!DEVICE.isDisplayChangeSupported())
{
DEVICE.setFullScreenWindow(null);
d.dispose();
throw new RuntimeException("Changing Display Mode is not supported");
}
displaymode1 = q(e);
displaymode1;
displaymode = displaymode1;
JVM INSTR ifnonnull 256;
goto _L1 _L2
_L1:
break MISSING_BLOCK_LABEL_189;
_L2:
break MISSING_BLOCK_LABEL_256;
DEVICE.setFullScreenWindow(null);
d.dispose();
throw new RuntimeException("Changing Display Mode to " + e.width + "x" + e.height + " is not supported");
DEVICE.setDisplayMode(displaymode);
try
{
Thread.sleep(1000L);
}
catch(InterruptedException _ex) { }
if(flag)
c();
else
d();
d.requestFocus();
return;
}
private void c()
{
d.createBufferStrategy(2);
while(g == null)
try
{
g = d.getBufferStrategy();
}
catch(Exception _ex) { }
do
try
{
getBackBuffer();
return;
}
catch(Exception _ex) { }
while(true);
}
private void d()
{
if(f != null)
{
f.flush();
f = null;
}
f = CONFIG.createCompatibleVolatileImage(e.width, e.height);
}
public Graphics2D getBackBuffer()
{
if(h == null)
if(g == null)
{
if(f.validate(CONFIG) == 2)
d();
h = f.createGraphics();
} else
{
h = (Graphics2D)g.getDrawGraphics();
}
return h;
}
public boolean flip()
{
h.dispose();
h = null;
if(g == null)
{
d.getGraphics().drawImage(f, 0, 0, null);
Toolkit.getDefaultToolkit().sync();
return !f.contentsLost();
}
g.show();
Toolkit.getDefaultToolkit().sync();
return !g.contentsLost();
}
public void cleanup()
{
try
{
Thread.sleep(500L);
}
catch(InterruptedException _ex) { }
try
{
Thread.sleep(200L);
if(d != null)
d.dispose();
return;
}
catch(Exception exception)
{
System.err.println("ERROR: Shutting down graphics context " + exception);
}
System.exit(-1);
}
public Dimension getSize()
{
return e;
}
public Component getComponent()
{
return d;
}
public Frame getFrame()
{
return d;
}
public boolean isBufferStrategy()
{
return g != null;
}
public String getGraphicsDescription()
{
return "Full Screen Mode [" + getSize().width + "x" + getSize().height + "]" + (g == null ? "" : " with BufferStrategy");
}
public void setWindowTitle(String s)
{
d.setTitle(s);
}
public String getWindowTitle()
{
return d.getTitle();
}
public void setWindowIcon(Image image)
{
try
{
d.setIconImage(image);
return;
}
catch(Exception _ex)
{
return;
}
}
public Image getWindowIcon()
{
return d.getIconImage();
}
private DisplayMode q(Dimension dimension)
{
DisplayMode adisplaymode[] = DEVICE.getDisplayModes();
ArrayList arraylist = new ArrayList();
for(int i = 0; i < adisplaymode.length; i++)
if(adisplaymode[i].getWidth() == dimension.width && adisplaymode[i].getHeight() == dimension.height)
arraylist.add(adisplaymode[i]);
if(arraylist.size() == 0)
{
return null;
} else
{
DisplayMode adisplaymode1[];
Arrays.sort(adisplaymode1 = (DisplayMode[])arraylist.toArray(new DisplayMode[0]), this);
return adisplaymode1[0];
}
}
public int compare(Object obj, Object obj1)
{
DisplayMode displaymode = (DisplayMode)obj;
DisplayMode displaymode1 = (DisplayMode)obj1;
int i = displaymode.getRefreshRate() <= 75 ? 0 : 5000 * displaymode.getRefreshRate();
int j = displaymode1.getRefreshRate() <= 75 ? 0 : 5000 * displaymode1.getRefreshRate();
return ((displaymode1.getBitDepth() - displaymode.getBitDepth()) * 1000 + (displaymode1.getRefreshRate() - displaymode.getRefreshRate())) - (j - i);
}
static Class a(String s)
{
return Class.forName(s);
ClassNotFoundException classnotfoundexception;
classnotfoundexception;
throw new NoClassDefFoundError(classnotfoundexception.getMessage());
}
static
{
DEVICE = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
CONFIG = DEVICE.getDefaultConfiguration();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -