Wednesday, January 27, 2016

Okay, so you're pretty much done developing your new app or game, and you want to record a short demo or gameplay video. Or you just want to post your dev progress on Twitter with the #indiedev hashtag. But Twitter is really picky and throw errors if the video doesn't follow their parameters.

You can easily get around this by capturing your screen with QuickTime and converting the resulting video with ffmpeg via command line.

First fire up your android emulator, or desktop version of your Libgdx game.
Then start QuickTime Player. In the top menu go to File > New Screen Recording.
When you press the red record button, drag a rectangle to select a portion of the screen to record, and record your video. To stop recording, use the circle icon on the top right.
Save your video as video.mov on your desktop.

Now you need the conversion tool: ffmpeg. We'll install it using the terminal via Homebrew. If you are not familiar with it, homebrew is the famous 3rd party package manager for OSX, read about it here - http://brew.sh/

Open the terminal and use this command to install ffmpeg

brew install ffmpeg --with-libvpx

After installing, navigate to your desktop folder

cd ~/Desktop

and convert your video. The following command is for creating a h264 video for Twitter.

Monday, January 25, 2016

Peekaboo is a fast and challenging memory game, featuring cute and spooky monster girls cards!
Memorize the pattern of a 3x3 grid for just 3 seconds, and try to remember the cards that get randomly covered.
There are 24 levels with increasing difficulty, and you can unlock more than 30 cards.

Monday, August 11, 2014

Pocket softbox is an evolution of Color Light Touch, with features oriented to photographers and cinematographers.

Pocket Softbox turns your phone/tablet screen into a colored light source, to use it for photography or videos in low-light conditions when you can't bring your heavy equipment with you.

Just slide your finger on the screen to change the color, choosing from a Kelvin scale (1000K-10000K) or a full RGB scale. You can adjust the brightness and save your color for later use. A round light mode is also available for eye lighting purposes.

Thanks to cinematographer Christian Denslow for his supervision and ideas.

Thursday, January 16, 2014

Having the need to quickly generate dialogs in my game, I looked into the Dialog class in the scene2d.ui package. It allows you to create dialogs with a title, text, and all the buttons you need.
The Dialog object contains a "contentTable" field for its inner text, and a "buttonTable" field where the buttons are placed. Both are Tables. The Dialog class extends Window, which itself is a Table. So you can fine-tune sizes and paddings of the various elements.

Different story for the entire dialog sizing; if you simply use the setSize(w, h) method it won't affect anything. This is because Dialog.show() method calls WidgetGroup.pack(), which overrides any size is explicitly set, and dynamically resizes the group depending on its content. To fix this, you can simply override getPrefWidth() and getPrefHeight() to return the values you need.

I created this class for my needs, which automatically styles the text and buttons you add to the dialog.

Tutorial

Create a new Android project, with a MainActivity class inside. Create a "libs" folder inside the project, and put the GSON jar in there. When you refresh the project, Eclipse should automatically add the jar to the project's build path.

Webservice Type : REST Url : api.geonames.org/citiesJSON?Parameters : north,south,east,west : coordinates of bounding box callback : name of javascript function (optional parameter) lang : language of placenames and wikipedia urls (default = en)maxRows : maximal number of rows returned (default = 10)Result : returns a list of cities and placenames in the bounding box, ordered by relevancy (capital/population). Placenames close together are filterered out and only the larger name is included in the resulting list.

We'll call the webservice with the 4 coordinates parameters. The webservice also requires an "username" parameter. You can use the "pimentoso" user for this test, or you can register your own username here: http://www.geonames.org/login

Go to the JSONgen website, and paste the sample URL for the webservice.

When you hit "generate", the website will have you download a zip file containing the generated classes. Unzip the file and copy the classes in your project. The classes will look like this

Now we're gonna work on the activity. We're going to create the "callService()" method that does the main job: starting a thread that calls the webservice, and deserialize the data. The comments in the code should be self-explanatory.

Error handling

You will notice that when the webservice returns an error, a JsonSyntaxException is not actually thrown. This is because GSON only throws the exception if your class has a field whose type didn't match what is in the JSON. So, in case of an error like this-

{"status":{"message":"user does not exist.","value":10}}

The exception is not actually thrown. So if you want to retrieve the error message, you could expand your GeonameList class to contain a Status object, so GSON can fill it when it is returned.