Skip to content

Instantly share code, notes, and snippets.

View MobiDevelop's full-sized avatar

Justin Shapcott MobiDevelop

  • Phoenix, AZ, USA
View GitHub Profile
@MobiDevelop
MobiDevelop / Speech Bubbles - CSS
Created June 2, 2012 21:11
Speech Bubbles - CSS
/*
Speech Bubbles
Usage: Apply a class of .speech-bubble and .speech-bubble-DIRECTION
<div class="speech-bubble speech-bubble-top">Hi there</div>
*/
.speech-bubble {
position: relative;
background-color: #292929;
@MobiDevelop
MobiDevelop / Appender.java
Created September 13, 2012 15:22
A zero-allocation way to append ints and longs to a StringBuilder in Android.
/*******************************************************************************
* Copyright 2012 Justin Shapcott
*
* 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
@MobiDevelop
MobiDevelop / ResolutionFileResolver.java
Created April 7, 2013 13:41
Add a pluggable ChooserStrategy to the LibGDX ResolutionFileResolver, to allow the choosing algorithm to be changed by the user.
/*******************************************************************************
* Copyright 2011 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
package nEx.Games.Samples;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
@MobiDevelop
MobiDevelop / ActionSnippets.java
Created August 28, 2013 14:15
Scene2D Action Snippets
public static SequenceAction getClickActon()
{
SequenceAction action = Actions.sequence(
Actions.scaleTo(1.1f, 0.9f, 0.15f),
Actions.scaleTo(0.92f, 1.08f, 0.15f),
Actions.scaleTo(1.06f, 0.94f, 0.15f),
Actions.scaleTo(0.96f, 1.04f, 0.15f),
Actions.scaleTo(1.0f, 1.0f, 0.15f),
Actions.color(Color.RED, 1.0f),
Actions.fadeOut(2.0f),
@MobiDevelop
MobiDevelop / Additional Info.txt
Last active June 22, 2017 04:06
Google Drive Problem
Additional Info
---------------
Nexus 5
Android 4.4
Using either Android Studio or Eclipse results in the same exception
With Eclipse, added Drive API v2 from the Google Plugin. With Android Studio, included the jars manually.
@MobiDevelop
MobiDevelop / PickScrollPane.java
Last active July 17, 2017 08:01
A ScrollPane that centers on a particular actor.
package com.badlogic.gdx.tests.examples;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.Array;
@MobiDevelop
MobiDevelop / tileset.scm
Last active March 21, 2021 09:48
GIMP script to add margin adn spacing to a tilsheet
(define (script-fu-respace-tiles-addMarginSpacing inImage inLayer tileSize)
(let* (
(margin 1)
(spacing 2)
(duplicatePadding TRUE)
(theWidth (car (gimp-drawable-width inLayer)))
(theHeight (car (gimp-drawable-height inLayer)))
(theMarginX (* 2 margin))
(theMarginY (* 2 margin))
@MobiDevelop
MobiDevelop / PagedScrollPane.java
Last active March 21, 2022 02:00
A LibGDX ScrollPane with page support. It center-locks on pages after scrolling.
package com.badlogic.gdx.tests.examples;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.Array;
import com.esotericsoftware.tablelayout.Cell;
@MobiDevelop
MobiDevelop / Snippet.java
Created August 12, 2013 21:58
An example of downloading a file and displaying progress with the LibGDX Net module.
package com.badlogic.gdx.tests.lwjgl;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Net.HttpMethods;
import com.badlogic.gdx.Net.HttpRequest;