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:1102475
Created July 24, 2011 10:11
Ray trace when drawing with huge font
-- control frame ----------
c:0022 p:---- s:0085 b:0085 l:000084 d:000084 CFUNC :draw
c:0021 p:0015 s:0081 b:0081 l:000080 d:000080 METHOD C:/Users/Spooner/RubymineProjects/zed_and_ginger/lib/gui/shadow_text.rb:24
c:0020 p:0014 s:0077 b:0077 l:000069 d:000076 BLOCK C:/Users/Spooner/RubymineProjects/zed_and_ginger/lib/scenes/pick_level.rb:77
c:0019 p:0031 s:0075 b:0075 l:000074 d:000074 METHOD C:/Ruby192/lib/ruby/gems/1.9.1/gems/ray-0.1.1/lib/ray/target.rb:13
c:0018 p:0038 s:0070 b:0070 l:000069 d:000069 METHOD C:/Users/Spooner/RubymineProjects/zed_and_ginger/lib/scenes/pick_level.rb:76
c:0017 p:0104 s:0066 b:0066 l:000065 d:000065 METHOD C:/Ruby192/lib/ruby/gems/1.9.1/gems/ray-0.1.1/lib/ray/scene.rb:164
c:0016 p:0036 s:0062 b:0062 l:000061 d:000061 METHOD C:/Ruby192/lib/ruby/gems/1.9.1/gems/ray-0.1.1/lib/ray/scene.rb:138
c:0015 p:0076 s:0056 b:0056 l:000055 d:000055 METHOD C:/Ruby192/lib/ruby/gems/1.9.1/gems/ray-0.1.1/lib/ray/scene_list.rb:32
c:0014 p:0047 s:0052 b:0052 l:000051 d:000051 METHOD C:/Ruby192/l
@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
"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 / 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 ***
$:.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 / 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.
@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 / 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: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