Java 类com.badlogic.gdx.ApplicationAdapter 实例源码

项目:MountainRangePvP    文件:Main.java   
private ApplicationListener joiningAdapter() {
    return new ApplicationAdapter() {
        TcpServerInterface server;
        ClientGame game;

        @Override
        public void create() {
            server = new TcpServerInterface(new Log("tcp"), settings.serverIP, settings.port);

            game = new ClientGame(settings, server);
            game.start();
        }

        @Override
        public void render() {
            game.render();
        }

        @Override
        public void dispose() {
            game.kill();
        }
    };
}
项目:featurea    文件:FontCreator.java   
public void createFont(final File fntFile, final String name, final int size, final boolean isBold, final boolean isItalic) {
    final JFrame frame = new JFrame() {{
        pack();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); // IMPORTANT
    }};
    frame.getContentPane().add(new MyLwjglCanvas(new ApplicationAdapter() {
        private final UnicodeFont unicodeFont = new UnicodeFont(Font.decode(name), size, isBold, isItalic);

        @Override
        public void create() {
            unicodeFont.setMono(false);
            unicodeFont.setPaddingTop(PADDING);
            unicodeFont.setPaddingRight(PADDING);
            unicodeFont.setPaddingBottom(PADDING);
            unicodeFont.setPaddingLeft(PADDING);
            unicodeFont.setPaddingAdvanceX(-2 * PADDING);
            unicodeFont.setPaddingAdvanceY(-2 * PADDING);
            unicodeFont.setGlyphPageWidth(1024);
            unicodeFont.setGlyphPageHeight(512);
            unicodeFont.setRenderType(UnicodeFont.RenderType.Java);
            List effects = unicodeFont.getEffects();
            effects.add(new ColorEffect(Color.white));
            unicodeFont.addGlyphs(CHARACTERS);
            try {
                FileUtil.createNewFile(fntFile);
                new BMFontUtil(unicodeFont).save(fntFile);
            } catch (Throwable ex) {
                ex.printStackTrace();
            }
            if ("studio".equals(System.getProperty("featurea.launcher"))) {
                frame.dispose();
            } else {
                frame.setVisible(false);
            }
        }
    }).getCanvas());
}
项目:MountainRangePvP    文件:Main.java   
private ApplicationListener hostingAdapter() {
    return new ApplicationAdapter() {
        LocalServerInterface localInterface;
        TcpServerWrapper wrapper;
        ClientGame game;

        @Override
        public void create() {
            SessionConfig sessionConfig = new SessionConfig(settings.teamsOn);

            Log serverLog = new Log("server");
            Log tcpLog = new Log("tcp");

            localInterface = ServerThread.startServer(serverLog, sessionConfig);
            wrapper = new TcpServerWrapper(tcpLog, localInterface, settings.port);
            wrapper.start();

            game = new ClientGame(settings, localInterface);
            game.start();
        }

        @Override
        public void render() {
            game.render();
        }

        @Override
        public void dispose() {
            game.kill();
            localInterface.shutdown();
            wrapper.shutdown();
        }
    };
}
项目:nvlist    文件:GdxAppStub.java   
public GdxAppStub() {
    appListener = new ApplicationAdapter() {
    };
}