Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Extending Gosu / Okami ruby objects wrapping Gosu
- - By arrow Date 2013-04-07 23:28 Edited 2013-04-16 15:14
Edit: I've changed the structure of the gem and written small isolated examples

Okami is just a few ruby objects wrapping Gosu.
I've ben using it for my small projects and everytime I want to play around with gosu, but I've ben too lazy too clean it up or write proper documentation. I've cleaned it up and gemified it.

I doesn't organize your game logic in any particular way, I'm trying to keep the structure similar to Gosu. One of the reasons I created this was also aesthetics because I found it more pleasing to use symbols for input and hiding the $window global.

Example of Okami input:

Okami::Mouse.visible = false
Okami::Mouse.key_down? :left
Okami::Keyboard.key_down? :left
Okami::Keyboard.any_key_down? :q, :escape, :return
Okami::Keyboard.add_key_down_listener method(:key_down)
Okami::Keyboard.add_key_up_listener method(:key_up)
Okami::Mouse.add_key_down_listener method(:mouse_down)
Okami::Mouse.add_key_up_listener method(:mouse_up)

There's also caching of images and animated sprites

Okami::Image.load_path = "path/to/images/"
@images = Okami::ImageTilesCache[image_path, tile_width, tile_height]
@sprite = images: @images, fps: 30, animation_mode: :loop
@sprite.x = 20
@sprite.y = 20
@sprite.alpha = 0.5
@sprite.degrees = 45
Parent - By arrow Date 2013-04-16 15:21
I just found out there's Ludum Dare next weekend, so I'm planning on participating using Gosu and Okami.
Up Topic Gosu / Extending Gosu / Okami ruby objects wrapping Gosu

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill