繁体   English   中英

libgdx模糊2d图形

[英]libgdx blurred 2d graphics

我仍然在解决这个问题,感觉好像在跳动。 可以说,我有这段代码可以绘制我创建的纹理。

public MainMenuScreen(TheSpring game) {
    this.game = game;
    //camera for interface
    guiCam = new OrthographicCamera(1020, 640);
    guiCam.position.set(1020 / 2, 640/2, 0);
    //buttons
    play = new Button(10, 120, 400, 300, AssetLoader.play);
    highscores = new Button(460, 10, 82, 102, AssetLoader.highscores);
    sound = new Button(10, 10, 72, 72, AssetLoader.soundEnabled);
    sound.AddTexture(AssetLoader.soundDisabled);
    if (!Settings.soundEnabled)
        sound.SwitchTexture();
    help = new Button(120, 160, 80, 15, "Help", Color.WHITE);
    //enable buttons
    play.Enable(true);
    highscores.Enable(true);
    sound.Enable(true);
    help.Enable(true);
    //touchpoint for unproject
    touchpoint = new Vector3();

}`

我为播放按钮创建的纹理也是400x300。 问题是,当我尝试运行此“应用程序”时,我的纹理模糊。 Button是我的班,并且我正在使用它的绘制方法。

public void Draw(SpriteBatch batcher) {
    if (enabled){
    if (text != null) {
        AssetLoader.ComicFont.setColor(clr);
        AssetLoader.ComicFont.setScale(ScaleWidth, ScaleHeight);
        AssetLoader.ComicFont.draw(batcher, text, x, y + height);
    }
    if (texture != null) {
        batcher.draw(texture, x, y, width, height);
    }
    }

}

结果就是这样(请不要以我的绘画技能来评判我,这是唯一的测试版本) http://prntscr.com/5u2l1y

例如,在按钮的右侧,也应该有黑线,并且线应该是直线。 你能帮我么? :)

一种可能的解决方案是将纹理滤镜设置为“线性”。默认情况下,它们不是线性的。 试试这个

    texture.setFilter(TextureFilter.Linear,TextureFilter.Linear);

暂无
暂无

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

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