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:1067033
Created July 6, 2011 11:30
wrath instructions
gods:
title: The Gods
body: |
* The god will ask for specific creatures, which will reap greater rewards when sacrificed.
* The image of the creature the god demands is shown next to their portrait at the top of the screen.
* Sacrificing creatures that were not requested, will provide very little reward.
anger:
@bil-bas
bil-bas / gist:1077999
Created July 12, 2011 13:39
ray error
C:\Users\Spooner\RubymineProjects\ray>rake ext
c:/ruby192/bin/ruby.exe extconf.rb
checking for main() in -lgdi32... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
@bil-bas
bil-bas / gist:1078001
Created July 12, 2011 13:44
ext/mkmf.log
"gcc -o conftest -Ic:/ruby192/include/ruby-1.9.1/i386-mingw32 -Ic:/ruby192/include/ruby-1.9.1/ruby/backward -Ic:/ruby192/include/ruby-1.9.1 -I. -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wextra -Wall -Wno-unused-parameter -std=gnu99 -g -O0 -DSAY_WIN conftest.c -L. -Lc:/ruby192/lib -L. -lmsvcrt-ruby191-static -lshell32 -lws2_32 "
cc1.exe: error: unrecognized command line option "-Wno-missing-field-initializers"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */
@bil-bas
bil-bas / gist:1078116
Created July 12, 2011 14:45
more Ray pains
C:\Users\Spooner\RubymineProjects\ray>rake ext
(in C:/Users/Spooner/RubymineProjects/ray)
cd ext/
c:/Ruby192/bin/ruby.exe -rdevkit extconf.rb
Temporarily enhancing PATH to include DevKit...
checking for main() in -lgdi32... yes
checking for main() in -lopengl32... yes
checking for main() in -lglew32... yes
checking for main() in -llibfreetype... yes
checking for main() in -lOpenAL32... yes
@bil-bas
bil-bas / pixelation.rb
Created July 15, 2011 11:35
Pixelation shader in Ray
# Pixelation post-processing effect
# based on http://www.geeks3d.com/20101029/shader-library-pixelation-post-processing-effect-glsl/
# Shaders -------------------
PIXEL_SHADER =<<END
uniform sampler2D in_Texture; // Automatically set by Ray.
uniform float rt_w; // Width of window.
uniform float rt_h; // Height of window.
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../ray/lib")
$:.unshift File.expand_path(File.dirname(__FILE__) + "/../ray/ext")
require 'ray'
require 'pry'
def path_of(res)
File.expand_path File.join(File.dirname(__FILE__), '../../test/res', res)
end
@bil-bas
bil-bas / gist:1087469
Created July 17, 2011 11:12
Ray gem error
C:\Users\Spooner\RubymineProjects\spooner_ld_18>gem install ray
Fetching: ray-0.1.0.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing ray:
ERROR: Failed to build gem native extension.
c:/Ruby192/bin/ruby.exe extconf.rb
checking for main() in -lgdi32... *** extconf.rb failed ***
"gcc -o conftest -Ic:/Ruby192/include/ruby-1.9.1/i386-mingw32 -Ic:/Ruby192/include/ruby-1.9.1/ruby/backward -Ic:/Ruby192/include/ruby-1.9.1 -I. -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wextra -Wall -Wno-unused-parameter -std=gnu99 -g -O0 -DSAY_WIN conftest.c -L. -Lc:/Ruby192/lib -L. -lmsvcrt-ruby191-static -lshell32 -lws2_32 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */
"gcc -o conftest -Ic:/Ruby192/include/ruby-1.9.1/i386-mingw32 -Ic:/Ruby192/include/ruby-1.9.1/ruby/backward -Ic:/Ruby192/include/ruby-1.9.1 -I. -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wextra -Wall -Wno-unused-parameter -std=gnu99 -g -O0 -DSAY_WIN conftest.c -L. -Lc:/Ruby192/lib -L. -lmsvcrt-ruby191-static -lshell32 -lws2_32 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */
@bil-bas
bil-bas / faster_collide.rb
Created July 18, 2011 18:28
Optmised collision
class Rect
def collide_new?(rect)
rect = rect.to_rect
rect.x < x + width and
x < rect.x + rect.width and
rect.y < y + height and
y < rect.y + rect.height
end
end