Skip to content

Instantly share code, notes, and snippets.

View bil-bas's full-sized avatar

Bil Bas bil-bas

View GitHub Profile
@bil-bas
bil-bas / gist:517474
Created August 10, 2010 15:42
TexPlay :transparent bug (now fixed)
# TexPlay :transparent fail (now fixed)
require 'rubygems'
require 'common'
require 'gosu'
require 'texplay'
class W < Gosu::Window
def initialize
super(400, 300, false, 20)
@bil-bas
bil-bas / gist:537441
Created August 19, 2010 09:03
Gosu::Image::as_devil
# Gosu::Image::as_devil (including workaround for Gosu to_blob colour shift bug)
module Gosu
class Image
def as_devil
raise ArgumentError, "Must provide a block" unless block_given?
devil_image = Devil.from_blob(Image.from_blob(to_blob, width, height).to_blob, width, height)
yield devil_image
gosu_image = devil_image.to_gosu $window
devil_image.delete
@bil-bas
bil-bas / gemspec_rake.rb
Created August 27, 2010 12:15
TexPlay gemspec
def specification(platform)
Gem::Specification.new do |s|
s.name = "texplay"
s.summary = "TexPlay is a light-weight image manipulation framework for Ruby and Gosu"
s.version = TexPlay::VERSION
s.date = Time.now.strftime '%Y-%m-%d'
s.author = "John Mair (banisterfiend)"
s.email = 'jrmair@gmail.com'
s.description = s.summary
s.require_path = 'lib'
@bil-bas
bil-bas / slideBulge.js
Created September 22, 2010 12:03
slideBulge function
// slideBulge function
// slides the top right menu bulge bg to the left/right to the requested position.
function slideBulge(currentPos, endPos) {
//stop the slideBulge function (if it is still looping)
clearTimeout(bulgeTimeout);
//set the jumpSize and jumpSpeed:
var jumpSize = 3;
var jumpSpeed = 10;
@bil-bas
bil-bas / colour_benchmarks.rb
Created October 2, 2010 23:44
benchmarking color
require 'benchmark'
require 'gosu'
n = 1000000
a1 = [1.0, 1.0, 1.0, 1.0]
a255 = [255, 255, 255, 255]
class Color
attr_accessor :red, :blue, :green, :alpha
@bil-bas
bil-bas / gist:609161
Created October 4, 2010 02:10
SiD makefile
# Auto-generated by game7/configure for the Win32 MinGW platform. Do not edit manually.
#
# Modification History
#
# 2003-November-2 Jason Rohrer
# Created.
#
# 2003-November-10 Jason Rohrer
# Removed pthread flag.
# Changed LINUX flag to WIN_32 flag.
module Gosu
class Color
# Setting up for YAML
YAML_DOMAIN = 'libgosu.org,2010'
YAML_TYPE = 'color'
YAML::add_domain_type(YAML_DOMAIN, YAML_TYPE) do |type, value|
p type, value
Gosu::Color.new(*value[:rgba])
end
@bil-bas
bil-bas / draw_update_bug.rb
Created October 25, 2010 10:16
The calling order of draw and update are inverted in Gosu 0.7.24 on Windows
require 'gosu'
include Gosu
class Game < Gosu::Window
def initialize
super 640, 480, false
@count = 4
end
@bil-bas
bil-bas / bacon.rb
Created October 26, 2010 16:06 — forked from banister/bacon.rb
require 'rubygems'
require '../lib/remix'
require 'bacon'
describe 'Test basic remix functionality' do
before :each do
class Module
public :include
end
# Setup window components within
# Current FXRubyified system managing nesting manually.
def setup
main_packer = VerticalPacker.new(container, padding: 0) do |packer|
label = Label.new(packer, text: "Hello!")
10.times do |i|
Button.new(packer, text: i.to_s) do |button|
button.subscribe :clicked_left_mouse_button do |sender, x, y|
label.text = "Pressed #{sender.text.to_i}"
end