Skip to content

Instantly share code, notes, and snippets.

@Tom-Ski
Tom-Ski / SkeletonTest.java
Created February 18, 2014 00:37
Skeleton attachments
/******************************************************************************
* 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
@Tom-Ski
Tom-Ski / Box2DExample.java
Created February 15, 2014 04:07
This stuff
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);
@Tom-Ski
Tom-Ski / secretstuff.java
Created February 15, 2014 01:37
maximtwo is my hero
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);
@Tom-Ski
Tom-Ski / build.gradle
Created February 14, 2014 17:17
Hoop Jumping
// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
task copyAndroidNatives() {
file("libs/armeabi/").mkdirs();
file("libs/armeabi-v7a/").mkdirs();
configurations.natives.files.each { jar ->
def outputDir = null
if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
@Tom-Ski
Tom-Ski / Settings
Created February 7, 2014 17:10
Tper
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.maxHeight = 1024;
settings.maxWidth = 1024;
settings.duplicatePadding = true;
settings.edgePadding = true;
settings.paddingX = 2;
settings.paddingY = 2;
settings.bleed = true;
settings.alias = true;
settings.useIndexes = true;
@Tom-Ski
Tom-Ski / LevelEditorScreen.java
Created January 25, 2014 18:04
Usage of tooltips
private void addToolTips() {
tooltips.registerTooltip(toolbar.grabCursor, "Translate Tool");
tooltips.registerTooltip(toolbar.gravityGlobe, "Gravity Toggle");
tooltips.registerTooltip(toolbar.pinButton, "Joint Pin ");
tooltips.registerTooltip(toolbar.lightButton, "Lighting Toggle");
tooltips.registerTooltip(toolbar.normalCursor, "Select Tool");
}
@Tom-Ski
Tom-Ski / Tooltips.java
Created January 25, 2014 18:01
Nex's tooltips
/*******************************************************************************
* Copyright 2013 See AUTHORS File
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Tom-Ski
Tom-Ski / AlertMenu.java
Created January 22, 2014 15:11
Simple Dialog
public static void simpleOkAlert(Stage stage, Skin skin, String title, String text) {
Dialog dialog = new Dialog(title, skin);
dialog.defaults().center();
dialog.setBackground(new TextureRegionDrawable(skin.get("Alert", TextureRegion.class)));
dialog.text(text).padTop(20).align(Align.center);
dialog.getButtonTable().defaults().pad(0).expandX().fillX().width(200);
dialog.button("Ok, Ill stop misbehaving").padBottom(3);
dialog.setWidth(400);
dialog.setHeight(140);
dialog.setPosition(Gdx.graphics.getWidth() / 2 - 400, Gdx.graphics.getHeight() / 2 - 140);
@Tom-Ski
Tom-Ski / index
Created January 13, 2014 23:48
gwt index
<!doctype html>
<html>
<head>
<title>%APP_NAME%</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
canvas {
cursor: default;
outline: none;
}
project(":gwt") {
apply plugin: "gwt"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
}