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
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
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
/* 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
#version 330 | |
vertex | |
{ | |
layout(location = 0) in vec4 position; | |
void main() | |
{ | |
gl_Position = position; | |
} | |
} |
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
MessageType foo = MessageType(Messages.Base) ~ MessageType(Messages.Window) ~ MessageType(Messages.Foo); | |
writeln(foo.toString()); | |
MessageType bar = MessageType("Base.Window.Foo"); | |
writeln(bar.toString()); |
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
class BaseSubscriberInterface | |
{ | |
publlic: | |
/* stuff */ | |
}; | |
class DerivedSubscriber : public BaseSubscriberInterface | |
{ | |
public: | |
void funcThatReceivesMessage(const Message& message); |
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
// In Update function | |
myTransform = sf::Transform::Identity | |
myTransform.translate(-originVector); | |
myTransform.roate(rotation); | |
// In Draw | |
states.transform = states.transform.combine(myTransform); | |
target.draw(sprite, states); |
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
class Foo | |
invariant( some_other_test ) # Run at entry of every contract | |
# First argument run at function start, second argument run at function end | |
contract baz == true, @thing.nil? == false, | |
def bar(val) | |
@thing = val.do_thing | |
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
macro finished | |
{% for definition in Crystal::Clear::CLASS_COMPILE_DATA %} | |
class {{definition[0]}} | |
Crystal::Clear::CLASS_RUNTIME_DATA << Crystal::Clear::ClassData({{definition[0]}}).new() | |
def {{definition[1]}} | |
{% for condition in definition[2] %} | |
if(({{condition}}) == false) | |
raise Crystal::Clear::Exception.new("Failed {{definition[0]}} require contract: {{condition}}") | |
end | |
{% end %} |