Skip to content

Instantly share code, notes, and snippets.

View Groogy's full-sized avatar

Groogy Groogy

View GitHub Profile
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
@Groogy
Groogy / button.cpp
Last active December 13, 2015 18:48
void GUI::Button::activate()
{
GUI::Component::activate();
if(mIsToggle)
mSprite.setTexture(mPressedTexture)
if (mCallback)
mCallback();
@Groogy
Groogy / button.hpp
Last active December 13, 2015 18:09
namespace GUI
{
class BOOK_MENUS_API Button : public GUI::Component
{
public:
Button(const std::string& text, const FontHolder& fonts, const TextureHolder& textures, std::function<void> callback);
bool isSelectable() const;
void handleEvent(const sf::Event& event);
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);
action = [](SceneNode& node) {
GUI::Button* button = dynamic_cast<GUI::Button*>(&node);
button->select();
};
category = selectedButton->getID();
// What I will probably do instead something like:
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Enter))
mySelectedButton->activate();
FATAL ERROR: unable to find Rubinius runtime directories.
Rubinius was configured to find the directories relative to:
/home/groogy/Projects/External/rubinius
Set the environment variable RBX_PREFIX_PATH to the directory
that is the prefix of the following runtime directories:
BIN_PATH: /bin
RUNTIME_PATH: /runtime
#include <Tyr/Configuration.hpp>
#include <cassert>
#include <cstring>
tyr::Configuration tyr::Configuration::getDefaultConfiguration()
{
std::vector<tyr::Configuration> dimensionConfig;
dimensionConfig.push_back(tyr::Configuration(1024));
dimensionConfig.push_back(tyr::Configuration(768));
/* Tyr
* Copyright (c) 2013 Henrik Valter Vogelius Hansson
*
* 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:
LoadService loader = container.getLoadServiceCreator().create(runtime);
loader.init(new ArrayList<Object>());
loader.require("yaml");
require "dist/frozen-urchin.jar"
require 'external/jsfml.jar'
class StubDrawable
include Java::org.jsfml.graphics.Drawable
def draw(*args)
end
end