libGDX - 更改屏幕後的黑色按鈕和文本 (libGDX - Black buttons and text after changing screen)


問題描述

libGDX ‑ 更改屏幕後的黑色按鈕和文本 (libGDX ‑ Black buttons and text after changing screen)

我最近在我的 libGDX 程序中發現了一個奇怪的問題。當我啟動我的程序時,我首先顯示一個 SplashScreen,然後是 MainMenu 屏幕,然後您就可以進入程序了。問題是,如果我在主菜單上更改 screen,我的所有 TextButton 都會變成完全黑色,並且它們的文本字符會變成黑框。換屏前






<hr>




<h2>參考解法</h2>

<h4>方法 1:</h4> <p>It seems like the problem came from disposing the <code>skin</code>. I use a <code>static Skin</code> object in an external class as my skin, which is used by all classes that need that skin. My problem was that I disposed the skin in one of the screens, which disposed the skin that all other classes were using as well. I solved this by simply creating a <code>dispose();</code> method in the class that holds all of my skins, and dispose of them when I exit the game instead.</p><p>(by <a href=CharanorCharanor)

參考文件

  1. libGDX ‑ Black buttons and text after changing screen (CC BY‑SA 2.5/3.0/4.0)

#libgdx #java






相關問題

為什麼原生 libmpg123 在帶有 libgdx 的 android 上花費這麼長時間? (Why is native libmpg123 taking so long on android with libgdx?)

睡眠後重新加載應用程序 (Re-load the app after sleep)

獲取實際觸摸位置 LibGDX (Get actual touch position LibGDX)

LibGDX - 只有可拖動的運動 (LibGDX - only draggable movement)

無法解析符號“android” - 在使用 libgdx 在 Android 應用程序中實現 Google Analytics 時 (Cannot resolve symbol 'android' - While implementing Google Analytics in Android App with libgdx)

如何從矩形數組中刪除隨機矩形? (How to remove random rectangle from rectangle array?)

球在傾斜平面上滾動 java libgdx (Ball rolling on an incline plane java libgdx)

libgdx - Intellij 類未找到異常? (libgdx - Intellij class not found exception?)

GL_COLOR_BUFFER_BIT 再生哪個內存? (GL_COLOR_BUFFER_BIT regenerating which memory?)

libGDX - 更改屏幕後的黑色按鈕和文本 (libGDX - Black buttons and text after changing screen)

帶有 9patch 的 LibGdx 標籤背景 (LibGdx label background with 9patch)

如何從平鋪中刪除對象? (How do I remove an object from tiled?)







留言討論