List of usage examples for com.badlogic.gdx.utils Pool Pool
public Pool(int initialCapacity)
From source file:com.badlydrawngames.veryangryrobots.RoomBuilder.java
License:Apache License
public RoomBuilder(int hcells, int vcells) { this.hcells = hcells; this.vcells = vcells; mazeGenerator = new MazeGenerator(hcells, vcells); rectanglePool = new Pool<Rectangle>(MAX_RECTANGLES) { @Override// w w w . j a v a 2 s .co m protected Rectangle newObject() { return new Rectangle(); } }; }
From source file:com.rayli.game.MessageDispatcher.java
License:Apache License
/** Don't let anyone else instantiate this class */ private MessageDispatcher() { this.pool = new Pool<Telegram>(64) { protected Telegram newObject() { return new Telegram(); }/* w ww. ja va 2 s.c o m*/ }; setTimeGranularity(0.25f); }
From source file:it.alcacoop.backgammon.GnuBackgammon.java
License:Open Source License
public void initAssets() { Gdx.graphics.setContinuousRendering(false); Gdx.graphics.requestRendering();/*w w w . j av a 2 s . c o m*/ atlas = new TextureAtlas(Gdx.files.internal("data/" + resname[ss] + "/pack.atlas")); fibsPlayersPool = new Pool<Player>(50) { @Override protected Player newObject() { return new Player(); } }; snd = new SoundManager(); rec = new MatchRecorder(); fibs = new FibsNetHandler(); commandDispatcher = new CommandDispatcherImpl(); fname = nativeFunctions.getDataDir() + "/data/match."; GnuBackgammon.Instance.jp = new JSONProperties( Gdx.files.internal("data/" + GnuBackgammon.Instance.getResName() + "/pos.json")); skin = new Skin(Gdx.files.internal("data/" + resname[ss] + "/myskin.json")); font = new BitmapFont(Gdx.files.internal("data/" + resname[ss] + "/checker.fnt"), false); TextureRegion r = font.getRegion(); r.getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); BitmapFont f = skin.getFont("default-font"); f.getRegion().getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); GnuBackgammon.atlas.addRegion("board", atlas.findRegion("B1")); GnuBackgammon.atlas.addRegion("boardbg", atlas.findRegion("B1-BG")); GnuBackgammon.atlas.addRegion("cb", atlas.findRegion("CS1-B")); GnuBackgammon.atlas.addRegion("cw", atlas.findRegion("CS1-W")); GnuBackgammon.atlas.addRegion("ch", atlas.findRegion("CS1-H")); board = new Board(); gameFSM = new GameFSM(board); simulationFSM = new SimulationFSM(board); menuFSM = new MenuFSM(board); fibsFSM = new FIBSFSM(board); gserviceFSM = new GServiceFSM(board); oldGserviceFSM = new OldGServiceFSM(board); fsm = simulationFSM; gameScreen = new GameScreen(); matchOptionsScreen = new MatchOptionsScreen(); menuScreen = new MainMenuScreen(); twoplayersScreen = new TwoPlayersScreen(); optionsScreen = new OptionsScreen(); welcomeScreen = new WelcomeScreen(); appearanceScreen = new AppearanceScreen(); fibsScreen = new FibsScreen(); generalStatsScreen = new GeneralStatsScreen(); diceStatsScreen = new DiceStatsScreen(); nativeFunctions.injectBGInstance(); }
From source file:it.alcacoop.fourinaline.actors.Board.java
License:Open Source License
public Board(final int wx, final int wy, final int winLength, final float height) { super();/*from ww w . j a v a2s . co m*/ this.wx = wx; this.wy = wy; this.winLength = winLength; this.height = height; checkers = new Pool<Checker>(wx * wy) { @Override protected Checker newObject() { return new Checker(); } }; usedCheckers = new HashMap<GameModel.CellCoord, Checker>(); TextureRegion r = FourInALine.Instance.atlas.findRegion("bbg"); splits = ((AtlasRegion) r).splits; patch = new NinePatch(r, splits[0], splits[1], splits[2], splits[3]); effects = new ParticleEffectActor[6]; for (int i = 0; i < 6; i++) { effects[i] = new ParticleEffectActor(); effects[i].setVisible(false); } setBoardDim(wx, wy, winLength); }