2015-03-13 52 views
0

我想在LibGDX中創建一些像textfield和textbutton這樣的簡單元素,並且要這麼做,據說需要加載一個我認爲可以確定的皮膚元素的佈局和設計。加載默認皮膚創建文本字段和按鈕時出錯(LibGDX)

Skin skin = new Skin(Gdx.files.internal("uiskin.atlas")); 
    nickNameField = new TextField("Enter nickname: ", skin); 
    playButton = new TextButton("Find match", skin); 

然而,在嘗試加載default skins像uiskin.json和uiskin.atlas,我得到的錯誤:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error reading pack file: uiskin.atlas 
    at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:187) 
    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:231) 
    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:226) 
    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:216) 
    at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:70) 
    at com.mygdx.game.Battleship.create(Battleship.java:41) 
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143) 
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120) 
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid line: <html lang="en" class=""> 
    at com.badlogic.gdx.graphics.g2d.TextureAtlas.readTuple(TextureAtlas.java:443) 
    at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:115) 
    ... 7 more 

任何人都知道的原因呢?

回答

0

如果您從github獲得文件,請確保您下載了RAW文件。

enter image description here

+0

是的,我確實下載了RAW。 – user1803704 2015-03-13 10:09:19

+0

用文本編輯器打開地圖集文件,並將其與github上的地圖集文件進行比較。 – 2015-03-13 14:15:24