SHARE
TWEET

Untitled

a guest Sep 2nd, 2014 173 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ######################################
  2.  * Copyright 2014 (c) Pixel Scientists
  3.  * All rights reserved.
  4.  * Unauthorized copying of this file, via
  5.  * any medium is strictly prohibited.
  6.  * Proprietary and confidential.
  7.  * ###################################### */
  8. package com.pixelscientists.maze.screen;
  9.  
  10. import com.badlogic.gdx.Gdx;
  11. import com.badlogic.gdx.Input;
  12. import com.badlogic.gdx.Screen;
  13. import com.badlogic.gdx.graphics.GL30;
  14. import com.badlogic.gdx.graphics.g2d.SpriteBatch;
  15. import com.badlogic.gdx.utils.StringBuilder;
  16.  
  17. /**
  18.  * @author Daniel Holderbaum
  19.  */
  20. public class AnimationScreen implements Screen {
  21.  
  22.         // HunterGame game;
  23.         // Texture texture;
  24.         // TextureRegion currentFrame;
  25.         // TextureRegion[] frames;
  26.         // static Animation animation;
  27.         SpriteBatch batch;
  28.  
  29.         // float stateTime;
  30.  
  31.         private static final int FRAME_COLS = 6;
  32.         private static final int FRAME_ROWS = 1;
  33.  
  34.         public AnimationScreen() {
  35.         }
  36.  
  37.         @Override
  38.         public void render(float delta) {
  39.  
  40.                 Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT | GL30.GL_DEPTH_BUFFER_BIT);
  41.  
  42.                 // stateTime += 0f;
  43.                 // currentFrame = animation.getKeyFrame(stateTime, true);
  44.                 batch.begin();
  45.                 // batch.draw(currentFrame, 300, 300);
  46.                 batch.end();
  47.  
  48.                 if (Gdx.input.isKeyPressed(Input.Keys.SPACE)) {
  49.                         System.gc();
  50.                         Runtime runtime = Runtime.getRuntime();
  51.                         long totalMemory = runtime.totalMemory();
  52.                         long freeMemory = runtime.freeMemory();
  53.                         long memory = totalMemory - freeMemory;
  54.  
  55.                         StringBuilder builder = new StringBuilder();
  56.                         builder.setLength(0);
  57.                         builder.append("Total mem: ").append(totalMemory).append("\n");
  58.                         builder.append("Used mem: ").append(memory).append("\n");
  59.                         builder.append("Free mem: ").append(freeMemory);
  60.                         System.out.println(builder.toString());
  61.                 }
  62.  
  63.         }
  64.  
  65.         private static final long MEGABYTE = 1024L * 1024L;
  66.  
  67.         private long bytesToMegabytes(long bytes) {
  68.                 return bytes / MEGABYTE;
  69.         }
  70.  
  71.         @Override
  72.         public void resize(int width, int height) {
  73.  
  74.         }
  75.  
  76.         @Override
  77.         public void show() {
  78.                 // texture = new Texture("testanimationV2.png");
  79.                 // TextureRegion[][] tmp = TextureRegion.split(texture, 225, 225);
  80.                 // frames = new TextureRegion[FRAME_COLS * FRAME_ROWS];
  81.  
  82.                 // int index = 0;
  83.                 // for (int i = 0; i < FRAME_ROWS; i++){
  84.                 // for (int j = 0; j < FRAME_COLS; j++){
  85.                 // frames[index++] = tmp[i][j];
  86.                 // }
  87.                 // }
  88.                 batch = new SpriteBatch();
  89.                 // animation = new Animation (1/24f, frames);
  90.                 // stateTime = 0f;
  91.                 System.gc();
  92.  
  93.         }
  94.  
  95.         @Override
  96.         public void hide() {
  97.  
  98.         }
  99.  
  100.         @Override
  101.         public void pause() {
  102.  
  103.         }
  104.  
  105.         @Override
  106.         public void resume() {
  107.  
  108.         }
  109.  
  110.         @Override
  111.         public void dispose() {
  112.                 // texture.dispose();
  113.                 batch.dispose();
  114.                 // game.dispose();
  115.         }
  116.  
  117. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top