Thursday, July 22, 2010

Thingaweek #1 - lolcat Viewer

Thingaweek #1 - lolcat Viewer

My first creation for thingaweek is a lolcat Viewer. I found lolcatz when they originally appeared on the internet and since then I've saved the ones that I like. Fast forward a couple years of doing this and I now have a library of a couple hundred lolcatz.

I wrote a simple java program that displays the images in my library. When you click the mouse in the window, it selects a random lolcat. I also included keyboard shortcuts for viewing.
  • Space - displays a random lolcat
  • Right - displays the next lolcat (numerically from my library)
  • Left - displays the previous lolcat (numerically from my library)
  • Down - displays the last lolcat viewed (chronologically)
  • Up - displays the next lolcat viewed (chronologically)
  • Q - quit the program
Due to the fact that each lolcat image is not the same size, I wrote a method to auto-scale each image. The method decrements the width of each image, and each time it does that, it multiplies the image's height by the ratio of the new width to the original width. I then switched the appropriate variables and redid this for the height.
    My friends recommend that I add a rating system; perhaps that will find its way into a future version. 

    Thingaweek #1 - lolcat Viewer

    I will try to find a way that I can post the source code so people can download and try it.


    No comments :

    Post a Comment