- /* ######################################
- * Copyright 2014 (c) Pixel Scientists
- * All rights reserved.
- * Unauthorized copying of this file, via
- * any medium is strictly prohibited.
- * Proprietary and confidential.
- * ###################################### */
- package com.pixelscientists.maze.screen;
- import com.badlogic.gdx.Gdx;
- import com.badlogic.gdx.Input;
- import com.badlogic.gdx.Screen;
- import com.badlogic.gdx.graphics.GL30;
- import com.badlogic.gdx.graphics.g2d.SpriteBatch;
- import com.badlogic.gdx.utils.StringBuilder;
- /**
- * @author Daniel Holderbaum
- */
- public class AnimationScreen implements Screen {
- // HunterGame game;
- // Texture texture;
- // TextureRegion currentFrame;
- // TextureRegion[] frames;
- // static Animation animation;
- SpriteBatch batch;
- // float stateTime;
- private static final int FRAME_COLS = 6;
- private static final int FRAME_ROWS = 1;
- public AnimationScreen() {
- }
- @Override
- public void render(float delta) {
- Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT | GL30.GL_DEPTH_BUFFER_BIT);
- // stateTime += 0f;
- // currentFrame = animation.getKeyFrame(stateTime, true);
- batch.begin();
- // batch.draw(currentFrame, 300, 300);
- batch.end();
- if (Gdx.input.isKeyPressed(Input.Keys.SPACE)) {
- System.gc();
- Runtime runtime = Runtime.getRuntime();
- long totalMemory = runtime.totalMemory();
- long freeMemory = runtime.freeMemory();
- long memory = totalMemory - freeMemory;
- StringBuilder builder = new StringBuilder();
- builder.setLength(0);
- builder.append("Total mem: ").append(totalMemory).append("\n");
- builder.append("Used mem: ").append(memory).append("\n");
- builder.append("Free mem: ").append(freeMemory);
- System.out.println(builder.toString());
- }
- }
- private static final long MEGABYTE = 1024L * 1024L;
- private long bytesToMegabytes(long bytes) {
- return bytes / MEGABYTE;
- }
- @Override
- public void resize(int width, int height) {
- }
- @Override
- public void show() {
- // texture = new Texture("testanimationV2.png");
- // TextureRegion[][] tmp = TextureRegion.split(texture, 225, 225);
- // frames = new TextureRegion[FRAME_COLS * FRAME_ROWS];
- // int index = 0;
- // for (int i = 0; i < FRAME_ROWS; i++){
- // for (int j = 0; j < FRAME_COLS; j++){
- // frames[index++] = tmp[i][j];
- // }
- // }
- batch = new SpriteBatch();
- // animation = new Animation (1/24f, frames);
- // stateTime = 0f;
- System.gc();
- }
- @Override
- public void hide() {
- }
- @Override
- public void pause() {
- }
- @Override
- public void resume() {
- }
- @Override
- public void dispose() {
- // texture.dispose();
- batch.dispose();
- // game.dispose();
- }
- }
SHARE
TWEET
Untitled
a guest
Sep 2nd, 2014
173
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
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.
