📄 spoofz.java
字号:
/*
Netwar
Copyright (C) 2002 Daniel Grund, Kyle Kakligian, Jason Komutrattananon, & Brian Hibler.
This file is part of Netwar.
Netwar is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Netwar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Netwar; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package netwar.utils.vectorgraphics;
import netwar.game.GameViewer;
/** Nonprimitive GraphicThing
* Wrapper for a graphic thing to cause it to have a predefined Z.
* Used for 'top' and 'bottom' things.
* Basically, it is for when things utterly refuse to display in the right order.
*/
public class SpoofZ extends GraphicThing {
private float myZ;
private GraphicThing myGraphic;
/** Creates a new instance of SpoofZ.
* @param spoofMe The real GraphicThing.
* @param spoofZ The Z to provide to ZOrdered lists.
*/
public SpoofZ(GraphicThing spoofMe, float spoofZ) {
myGraphic = spoofMe;
myZ = spoofZ;
}
public void draw(GameViewer v) {
myGraphic.draw(v);
}
/** get the Z coordinate, according to Transform t
* SpoofZ merely returns the Z value assigned to it.
* @param t A transform.
* @return The Z value assigned to this SpoofZ.
*/
public float getZ(Transform t) {
return myZ;
}
public boolean isOnScreen(Transform t) {
return myGraphic.isOnScreen(t);
}
public GraphicThing rotate(Point3D axisPt, Point3D axisDir, int angle) {
myGraphic.rotate(axisPt, axisDir, angle);
return this;
}
public GraphicThing translate(Point3D offset) {
myGraphic.translate(offset);
return this;
}
public void explode(Point3D epicenter) {
kill();
myGraphic.explode(epicenter);
}
Point3D getCenter() {
return myGraphic.getCenter();
}
void unlink() {
myGraphic.unlink();
}
public GraphicThing copy() {
return new SpoofZ(myGraphic.copy(), myZ);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -