Programming - page 2

Unity: animated ellipsis

Click here to read Unity: animated ellipsis

We have all seen it on loading screens of a variety of games and applications. I’m talking about animated ellipses, the animated three dots () on the end of a sentence which indicates that the game or software is being loaded.

This post explains how to make exactly that, an animated ellipsis in Unity. Here’s a video showing what the script on this post will do:

Continue reading: “Unity: animated ellipsis”

Unity: expandable GUI Window

Click here to read Unity: expandable GUI Window

This Unity programming tutorial shows how to create a GUI window that changes between two pre-determined sizes, in other words, an expandable GUI window that can be shrunk down, back to its original size. The code on this post has been developed using Unity 4.0.1f2, and an example project is available for download at the bottom of this page.

Unity’s GUI windows elements are very useful, not only because they can visually group various GUI elements, but also due to the possibility of repositioning it on the screen. For that reason, the script features some additional logic that allows for the windows to be resized at the correct position on the screen, even if it has been dragged by the user.

Here’s a short video of what the code below achieves:

Continue reading: “Unity: expandable GUI Window”

Android: hexadecimal color input using an EditText

Click here to read Android: hexadecimal color input using an EditText

This Android programming tutorial shows how to create a simple application that takes the value of a hexadecimal color at an EditText field and displays it as an ImageView. In order to do so, this post goes into detail on how to correctly parse the EditText String as 32 bit hexadecimal Integer. Additionally, it explains the part of the code that constrains the characters between A to F and 0 to 9 at the EditText. Finally, it tries to solve some of the EditText problems when applying these constrains.

The application in this post has been tested on Android 2.1, 2.3 and 4.0.

So, here’s a screenshot of the example project application in action:

Hexadecimal Color Input

A screenshot of the example project. It’s available for download at the end of the post.

Continue reading: “Android: hexadecimal color input using an EditText”

Android: Change color of the standard button inside Activity

Click here to read Android: Change color of the standard button inside Activity

This post explains how to change the color of the standard Android button. It also shows how to change the color of the text inside those buttons. It goes into detail on how to create a ColorFilter effect that changes the color of the button using three different approaches . The code featured in this post has been tested on Android 2.1, 2.2, 2.3 and 4.0.

Before starting, a little advice: know that changing the color of the standard Android button through XML is an easier and more straightforward approach. For that, please refer to the link Custom color buttons for Android (9-Patch). If the button color isn’t going to be changed after the application is initialized, then use XML. If that isn’t the case, then do it programmatically, which is what this tutorial focuses on.

So, here’s the code: Continue reading: “Android: Change color of the standard button inside Activity”