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
playButtonAction = [this](GUI::Component& sender) { // The argument is not needed actually, just common in .NET and Java | |
startGame(); // Member function in the state that defines this action | |
}; | |
std::shared_ptr<GUI::Button> playButton(new GUI::Button("Play", playButtonAction)); | |
myContainer.pack(playButton); |
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 Tyr::Application do | |
context "minial application" do | |
subject { Tyr::Application.new() } | |
it "should load the default module" do | |
subject.num_controllers.should == 0 | |
subject.num_renderers.should == 0 | |
subject.load(:default) | |
subject.modules.should include(:default) | |
subject.num_controllers.should == 1 |
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); |
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
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
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
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
[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 |