本文整理了Java中com.jme3.system.AppSettings.getHeight()
方法的一些代码示例,展示了AppSettings.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppSettings.getHeight()
方法的具体详情如下:
包路径:com.jme3.system.AppSettings
类名称:AppSettings
方法名:getHeight
[英]Get the height
[中]获得高度
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void run() {
// Fill in the combos once the window has opened so that the insets can be read.
// The assumption is made that the settings window and the display window will have the
// same insets as that is used to resize the "full screen windowed" mode appropriately.
updateResolutionChoices();
if (source.getWidth() != 0 && source.getHeight() != 0) {
displayResCombo.setSelectedItem(source.getWidth() + " x "
+ source.getHeight());
} else {
displayResCombo.setSelectedIndex(displayResCombo.getItemCount()-1);
}
updateAntialiasChoices();
colorDepthCombo.setSelectedItem(source.getBitsPerPixel() + " bpp");
}
});
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void reshape(int width, int height) {
super.reshape(width, height);
// Need to move text relative to app height
txt.setLocalTranslation(0, settings.getHeight(), 0);
txt.setText("Drag the corners of the application to resize it.\n" +
"Current Size: " + settings.getWidth() + "x" + settings.getHeight());
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void onCursorPos(long window, double xpos, double ypos) {
int x = (int) Math.round(xpos);
int y = context.getSettings().getHeight() - (int) Math.round(ypos);
if (mouseX == 0) {
mouseX = x;
}
if (mouseY == 0) {
mouseY = y;
}
xDelta = x - mouseX;
yDelta = y - mouseY;
mouseX = x;
mouseY = y;
if (xDelta != 0 || yDelta != 0) {
final MouseMotionEvent mouseMotionEvent = new MouseMotionEvent(x, y, xDelta, yDelta, mouseWheel, 0);
mouseMotionEvent.setTime(getInputTimeNanos());
mouseMotionEvents.add(mouseMotionEvent);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void loadSettings(AppSettings settings) {
keyboardEventsEnabled = settings.isEmulateKeyboard();
mouseEventsEnabled = settings.isEmulateMouse();
mouseEventsInvertX = settings.isEmulateMouseFlipX();
mouseEventsInvertY = settings.isEmulateMouseFlipY();
// view width and height are 0 until the view is displayed on the screen
if (androidInput.getView().getWidth() != 0 && androidInput.getView().getHeight() != 0) {
scaleX = (float)settings.getWidth() / (float)androidInput.getView().getWidth();
scaleY = (float)settings.getHeight() / (float)androidInput.getView().getHeight();
}
logger.log(Level.FINE, "Setting input scaling, scaleX: {0}, scaleY: {1}",
new Object[]{scaleX, scaleY});
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public Camera getDummyCamera(){
if (dummyCam == null){
if (application != null){
if (application.getCamera() != null){
dummyCam = application.getCamera().clone();
} else {
if ((settings != null) && (settings.getWidth() != 0) && (settings.getHeight() != 0)){
dummyCam = new Camera(settings.getWidth(), settings.getHeight());
} else {
dummyCam = new Camera();
}
}
} else {
throw new IllegalStateException("VR environment is not attached to any application.");
}
}
return dummyCam;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void updateOpenCL(float tpf) {
//aquire resource
texCL.acquireImageForSharingNoEvent(clQueue);
//no need to wait for the returned event, since the kernel implicitely waits for it (same command queue)
//execute kernel
Kernel.WorkSize ws = new Kernel.WorkSize(settings.getWidth(), settings.getHeight());
kernel.Run1NoEvent(clQueue, ws, texCL, C, 16);
//release resource
texCL.releaseImageForSharingNoEvent(clQueue);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void onMouseMotionEvent(MouseMotionEvent evt) {
x += evt.getDX();
y += evt.getDY();
// Prevent mouse from leaving screen
AppSettings settings = TestSoftwareMouse.this.settings;
x = FastMath.clamp(x, 0, settings.getWidth());
y = FastMath.clamp(y, 0, settings.getHeight());
// adjust for hotspot
cursor.setPosition(x, y - 64);
}
public void onMouseButtonEvent(MouseButtonEvent evt) {
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private Vector3f getWorldIntersection() {
Vector3f origin = cam.getWorldCoordinates(new Vector2f(settings.getWidth() / 2, settings.getHeight() / 2), 0.0f);
Vector3f direction = cam.getWorldCoordinates(new Vector2f(settings.getWidth() / 2, settings.getHeight() / 2), 0.3f);
direction.subtractLocal(origin).normalizeLocal();
Ray ray = new Ray(origin, direction);
CollisionResults results = new CollisionResults();
int numCollisions = terrain.collideWith(ray, results);
if (numCollisions > 0) {
CollisionResult hit = results.getClosestCollision();
return hit.getContactPoint();
}
return null;
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private void initCrossHair() {
BitmapText bitmapText = new BitmapText(guiFont);
bitmapText.setText("+");
bitmapText.setLocalTranslation((settings.getWidth() - bitmapText.getLineWidth())*0.5f, (settings.getHeight() + bitmapText.getLineHeight())*0.5f, 0);
guiNode.attachChild(bitmapText);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void simpleInitApp() {
flyCam.setDragToRotate(true);
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
geom.setMaterial(mat);
rootNode.attachChild(geom);
txt = new BitmapText(loadGuiFont(), false);
txt.setText("Drag the corners of the application to resize it.\n" +
"Current Size: " + settings.getWidth() + "x" + settings.getHeight());
txt.setLocalTranslation(0, settings.getHeight(), 0);
guiNode.attachChild(txt);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
public void simpleInitApp() {
Picture p = new Picture("Picture");
p.move(0, 0, -1); // make it appear behind stats view
p.setPosition(0, 0);
p.setWidth(settings.getWidth());
p.setHeight(settings.getHeight());
p.setImage(assetManager, "Interface/Logo/Monkey.png", false);
// attach geometry to orthoNode
guiNode.attachChild(p);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
@Override
public void simpleUpdate(float tpf) {
Vector3f origin = cam.getWorldCoordinates(new Vector2f(settings.getWidth() / 2, settings.getHeight() / 2), 0.0f);
Vector3f direction = cam.getWorldCoordinates(new Vector2f(settings.getWidth() / 2, settings.getHeight() / 2), 0.3f);
direction.subtractLocal(origin).normalizeLocal();
Ray ray = new Ray(origin, direction);
CollisionResults results = new CollisionResults();
int numCollisions = terrain.collideWith(ray, results);
if (numCollisions > 0) {
CollisionResult hit = results.getClosestCollision();
fpsText.setText(""+hit.getDistance());
dofFilter.setFocusDistance(hit.getDistance()/10.0f);
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/** A plus sign used as crosshairs to help the player with aiming.*/
protected void initCrossHairs() {
setDisplayStatView(false);
//guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // fake crosshairs :)
ch.setLocalTranslation( // center
settings.getWidth() / 2,
settings.getHeight() / 2, 0);
guiNode.attachChild(ch);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void initCrossHairs() {
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void initCrossHairs() {
//guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/** A centred plus sign to help the player aim. */
protected void initCrossHairs() {
setDisplayStatView(false);
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - ch.getLineWidth()/2, settings.getHeight() / 2 + ch.getLineHeight()/2, 0);
guiNode.attachChild(ch);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
}
内容来源于网络,如有侵权,请联系作者删除!