简体   繁体   English

为什么我的libgdx Java桌面应用程序的高度错误?

[英]Why does my libgdx java desktop app have the wrong height?

reference : https://code.google.com/p/libgdx/wiki/SimpleApp 参考: https : //code.google.com/p/libgdx/wiki/SimpleApp

package com.badlogic.drop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

public class Main {
   public static void main(String[] args) {
      LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
      cfg.title = "Drop";
      cfg.width = 768;
      cfg.height = 1280;
      new LwjglApplication(new Drop(), cfg);
   }
}

In the main project 在主项目中

 Gdx.app.log("",Integer.toString(
              Gdx.graphics.getHeight()));

outputs - 756 输出-756

The max height available is limited by your desktop/laptops resolution. 可用的最大高度受台式机/笔记本电脑分辨率的限制。 Mine is 1280 x 768 . 我的是1280 x 768 And mac has a finder bar on the top so maxHeight = 756, anything you try to set above it, just gets reset to 756. Mac顶部有一个查找器栏,因此您尝试在其上方设置的maxHeight = 756都将重置为756。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM