This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (C) 2013 Henrik Valter Vogelius Hansson ([email protected]) | |
* | |
* This software is provided 'as-is', without any express or implied warranty. | |
* In no event will the authors be held liable for any damages arising from the use of this software. | |
* | |
* Permission is granted to anyone to use this software for any purpose, | |
* including commercial applications, and to alter it and redistribute it freely, | |
* subject to the following restrictions: | |
* | |
* 1. The origin of this software must not be misrepresented; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sfml/all' | |
require 'tyr/entity' | |
require 'tyr/entity_data' | |
require 'tyr/entity_builder' | |
describe Tyr::EntityBuilder do | |
subject do | |
type = Tyr::EntityData.new() | |
type.entity_class = Tyr::Entity | |
Tyr::EntityBuilder.new(type) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Animation::update(sf::Time dt) | |
{ | |
sf::Time timePerFrame = mLength / mNumFrames; | |
mElapsedTime += dt; | |
sf::Vector2i textureBounds = mSprite.getTexture().getSize(); | |
sf::FloatRect textureRect = mSprite.getTextureRect(); | |
if (mCurrentFrame == 0) | |
textureRect = sf::FloatRect(0, 0, mFrameSize.x, mFrameSize.y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
World::doPostProcessing() | |
{ | |
// The different steps/techniques for bloom, first argument input, second output | |
mPostRenderer.apply(Shaders::BrightnessPass, mSceneTexture, mBrightnessTexture); | |
mPostRenderer.apply(Shaders::DownSample, mBrightnessTexture, mBloomTexture1); | |
mPostRenderer.apply(Shaders::GuassianBlurVertical, mBloomTexture1, mBloomTexture2); | |
mPostRenderer.apply(Shaders::GuassianBlurHorizontal, mBloomTexture2, mBloomTexture1); | |
mPostRenderer.apply(Shaders::GuassianBlurVertical, mBloomTexture1, mBloomTexture2); | |
mPostRenderer.apply(Shaders::GuassianBlurHorizontal, mBloomTexture2, mBloomTexture1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[groogy@isa rubinius]$ bin/mspec ci -t r -d spec | |
ruby 1.8.7 (2012-10-12 patchlevel 371) [x86_64-linux] | |
..FEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFEEE............E...FE.EEE.........E.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE...................................................................................................................................................................................................................................................................................................................................................................E.E.....................................E.....E...EE........................................................................F.........................................E............mkfifo: cannot create fifo ‘/home/groogy/.rubies/rubini |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "rb_obj_instance_variables" do | |
it "gets an array with instance variable names" do | |
o = ObjectTest.new | |
@o.rb_obj_instance_variables(o).should include(:@foo) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int ToRubyHashIterator( VALUE aKey, VALUE aValue, VALUE anExtra ) | |
{ | |
ToRubyHashInfo* info = ( ToRubyHashInfo* )anExtra; | |
std::string sym; | |
if( rb_type( aKey ) == T_SYMBOL ) | |
sym = rb_id2name( SYM2ID( aKey ) ); | |
else | |
sym = StringValueCStr( aKey ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Player::fire(const sf::Vector2f& direction) | |
{ | |
if(myFireCooldown <= sf::Time::Zero) | |
{ | |
float angle = std::atan2(direction.y, direction.x); | |
sf::Vector2f centerPosition = getCenterPosition(); | |
myFireCooldown = Player::FireCooldown; | |
myMuzzleTimer = Player::MuzzleTime; | |
myProjectiles->createProjectile(centerPosition + direction * Size / 2.f, rad2Degrees(angle), sf::Color::White); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SFML.memory_usage | |
VALUE rbSFML::GetMemoryUsage( VALUE aSelf ) | |
{ | |
void* table = rb_mod_const_at( aSelf, 0 ); | |
VALUE list = rb_const_list( table ); | |
GetMemoryUsageInfo info; | |
info.memoryUsage = 0; | |
info.listPointer = RARRAY_PTR( list ); | |
info.listLength = RARRAY_LEN( list ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Application::loadModule(const tyr::Module& module) | |
{ | |
myModules.push_back(module); | |
module.initialize(this); | |
} | |
static VALUE load(VALUE self, VALUE name) | |
{ | |
tyr::Module module(RSTRING(name)->ptr); | |
auto application = tyr::toNative<tyr::Application>(self); |