我正在通过网络下载图像并将其作为Image actor添加到我的libgdx UI中使用:
Pixmap pm = new Pixmap(data, 0, data.length);
Texture t = new Texture(pm);
TextureRegion tr = new TextureRegion(t,200,300);
TextureRegionDrawable trd = new TextureRegionDrawable(tr);
Image icon = new Image();
icon.setDrawable(trd);
Run Code Online (Sandbox Code Playgroud)
鉴于此,我需要一些重新加载纹理数据的方法,因为它在OpenGL上下文丢失时丢失(例如因为屏幕进入休眠状态).
我已经尝试过制作自己的经理课程了
DynamicTextureManager.register(t, pm); // Register texture together with the source pixmap
Run Code Online (Sandbox Code Playgroud)
到上面的片段,在resume()我做:
DynamicTextureManager.reload();
Run Code Online (Sandbox Code Playgroud)
经理班:
public class DynamicTextureManager {
private static LinkedHashMap<Texture, Pixmap> theMap = new
LinkedHashMap<Texture,Pixmap>();
public static void reload() {
Set<Entry<Texture,Pixmap>> es = theMap.entrySet();
for(Entry<Texture,Pixmap> e : es) {
Texture t = e.getKey();
Pixmap p …Run Code Online (Sandbox Code Playgroud) 我的init()函数创建UDP Socket并将Socket值作为State返回.
start() ->
{ok, ServerPid} = gen_server:start_link(?MODULE, [], []).
%%% gen_server API
init([]) ->
{ok, Socket} = gen_udp:open(8888, [list, {active,false}]),
{ok, Socket}.
Run Code Online (Sandbox Code Playgroud)
如何在函数start()中获取Socket?
我正在尝试在AWS弹性beanstalk上安装varnish缓存.我使用过
yum install varnish
Run Code Online (Sandbox Code Playgroud)
它要求一些输入
Is this ok [y/d/N]:
Run Code Online (Sandbox Code Playgroud)
我想按命令命中"Y".还有其他方法吗?
谢谢