Thursday, May 31, 2007

Annoucement of New Projects



I am here to announce you my first project to be unveiled here at this blog, rbgooey!

Rbgooey
is an alternative GUI library for Rubygame and also the first of its kind to be released for the Rubygame library.

This library, version 0.0.1 only support texts and limited typing operations. Over the following days, I'll continues to extend it and refine the API so everyone who use it will get a much better(and more awesome) experience in using the library. This library is the culmination of all my knowledge in writing a GUI library using Rubygame, although it isn't complete yet.

The image I show you below is the screenshot of a really cool example application I developed to demonstrate the rbgooey library. It randomly display new texts of five characters long in random locations on the display screen every second. 10 seconds latter, the application reset and the process started over. In total, there should be 50 pieces of texts every cycle.

Code:

Enough said, let get to the real code(Don't forget to install rbgooey)

require"rubygems"
require"rubygame"
require"rbgooey"
include Rubygame
TTF.setup()

class Timer
def initialize seconds , &action
@interval = seconds
@action = action
end
def check
t = Time.now.tv_sec
if t >= @fire_at
@action.call
@fire_at = t + @interval
end
end
def start
@fire_at = Time.now.tv_sec + @interval
end
end


class RandomText
def initialize
@display = Display.new
@display.setup(800,600,true)
@display.color([100 , 100 ,100],[20 , 20 ,20])
@background = Rubygame::Surface.new(@display.screen.size)
@data = UiData.new(@display)
@data.text.setup("freesansbold.ttf",12)
@data.text.render.surface(@background)
@clock = Rubygame::Clock.new
@clock.target_frametime= 40
@q = Rubygame::EventQueue.new()
@data.declare(:hello)
@random = Timer.new(1) { random() }
@delete = Timer.new(10) { delete() }
@random.start()
@delete.start()
end
#http://snippets.dzone.com/posts/show/2111
def String.random_alphanumeric(size=16)
s = ""
size.times { s << (i = Kernel.rand(62); i += ((i < string =" String.random_alphanumeric(5)">


action = RandomText.new
action.action()

Explaining Things:

The entire codebase of the program is about 77 lines long, including space. With some data files, the application should works. Well, it certainally won't work without data, so I am just offering this place to download the whole thing, just the codebase and some data files.

This demo program will probably not work in versions later than 0.0.1

Already, I discovered the first flaw in my library. Rbgooey required a hard coded path to an image. The path is "test/mouse.png". Even though we didn't use the mouse in the program, it is required for the application to work.

The entire code of this program is public domain, excluding a code snippet for generating random texts.

While this is not a tutorial, I would like to explain a few methods that I used with rbgooey. For example, UiData#text.add(string,x,y) is used for adding strings. UiData#clear is used to clear every information about texts, rect, and so on. Before you can create texts, you will need to declare a group you want a certain group of texts to be associated with. For that, you use Ui#declare(name here). UiData#text.render.undraw clears all the rendering of texts.

I'll stress one thing, this library is not ready for consumptions. It isn't used in real rubygame applications yet. Soon, I'll use this library and implement improvements as I muck around with video game creations.

A Roadmap:

The roadmap of rbgooey look like this for the next three versions:

Version 0.0.2 will includes file based configuration of basic setting such as screen size, mode, the font, and among other settings that I forgot to mention. It should help the code manage clutter. Bugfixes are the main focus here.

Version 0.0.3 will see some features for groups(the association of texts and other user interface elements) such as the ability to change the size of all texts within that group. Support for capital letters in typing will also be added.

Version 0.0.4 is where many of the major enhancement and improvement to the text library part will be added. In this version, you will be able to change the color for each individual characters, as well display different type of fonts for different texts. There will be lot of new features to manage texts in this version.

Some Other Announcements:


Now that we're finished with rbgooey introduction, I'll have a few projects that will be coming up. First, a new version of a simple game that I developed long ago will be released sometime on the weekend. It is called Space Fighter Ace. This game is a simple space invader clone that only work with previous version of Rubygame and only work on Window(Because I wasn't aware that linux is case sensitive). The target date I am aiming for is Saturday. New version of rbgooey should come out after this project's release.

Next, I'll start work on my first big commercial Free software game project. This new game will be called Rubyemon. Rubyemon will have similiar gameplay to the game Pokemon. We will chronicle that project for at least one week of its development, and then some update between there and here.

Wow, that's a mouthful. There are about 940 words in this post! If you got here without getting bored, congratulation.

It is time for me to get cracking on the various new projects.

Happy hacking!

~Kiba

P.S If you got any comments for this post, please post it, even if it is grammar nitpicking. You can alway contact me at my email address, wikipediankiba______AT______gmail.com

No comments: