This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.tomski.blobrun.desktop; | |
import com.badlogic.gdx.ApplicationListener; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.InputProcessor; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; | |
import com.badlogic.gdx.graphics.GL20; | |
import com.badlogic.gdx.graphics.OrthographicCamera; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.tomski.blobrun.desktop; | |
import com.badlogic.gdx.ApplicationListener; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.InputProcessor; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; | |
import com.badlogic.gdx.graphics.GL20; | |
import com.badlogic.gdx.graphics.OrthographicCamera; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.tomski.blobrun.desktop; | |
import com.badlogic.gdx.ApplicationListener; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.InputProcessor; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; | |
import com.badlogic.gdx.graphics.GL20; | |
import com.badlogic.gdx.graphics.OrthographicCamera; | |
import com.badlogic.gdx.math.Vector2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addMouseListener(new MouseAdapter() { | |
public void mousePressed(MouseEvent e) { | |
point.x = e.getX(); | |
point.y = e.getY(); | |
} | |
}); | |
addMouseMotionListener(new MouseMotionAdapter() { | |
public void mouseDragged(MouseEvent e) { | |
Point p = getLocation(); | |
setLocation(p.x + e.getX() - point.x, p.y + e.getY() - point.y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addWindowListener(new WindowAdapter() { | |
@Override | |
public void windowClosing(WindowEvent e) { | |
Runtime.getRuntime().addShutdownHook(new Thread() { | |
public void run() { | |
Runtime.getRuntime().halt(0); | |
} | |
}); | |
Gdx.app.exit(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class TomUtils { | |
public Vector2 youCantMakeMeDivideWhenNormalizing(Vector2 vec) { | |
float invMag = (vec.x * vec.x) + (vec.y * vec.y); | |
float invSq = suckItMaximtwo(invMag); | |
return vec.scl(invSq); | |
} | |
private float suckItMaximtwo(float invMag) { | |
float half = 0.5f * invMag; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void draw (PolygonSpriteBatch batch, Skeleton skeleton) { | |
boolean premultipliedAlpha = this.premultipliedAlpha; | |
int srcFunc = premultipliedAlpha ? GL11.GL_ONE : GL11.GL_SRC_ALPHA; | |
batch.setBlendFunction(srcFunc, GL11.GL_ONE_MINUS_SRC_ALPHA); | |
boolean additive = false; | |
float[] vertices; | |
short[] triangles; | |
Texture texture; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Spine Runtimes Software License | |
* Version 2 | |
* | |
* Copyright (c) 2013, Esoteric Software | |
* All rights reserved. | |
* | |
* You are granted a perpetual, non-exclusive, non-sublicensable and | |
* non-transferable license to install, execute and perform the Spine Runtimes | |
* Software (the "Software") solely for internal use. Without the written |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AtlasAttachmentLoader atlasLoader = new AtlasAttachmentLoader(atlas) { | |
public RegionAttachment newRegionAttachment (Skin skin, String name, String path) { | |
Box2dAttachment attachment = new Box2dAttachment(name); | |
AtlasRegion region = atlas.findRegion(attachment.getName()); | |
if (region == null) throw new RuntimeException("Region not found in atlas: " + attachment); | |
attachment.setRegion(region); | |
return attachment; | |
} | |
}; | |
SkeletonJson json = new SkeletonJson(atlasLoader); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void loadFixtures(TiledMap map, World world) { | |
MapLayer fixturesLayer = map.getLayers().get("fixtures"); | |
Array<PolylineMapObject> fixtures = fixturesLayer.getObjects().getByType(PolylineMapObject.class); | |
BodyDef bd = new BodyDef(); | |
bd.type = BodyType.StaticBody; | |
groundBody = world.createBody(bd); | |
groundBody.setUserData(-1); | |