Skip to content

Instantly share code, notes, and snippets.

View Groogy's full-sized avatar

Groogy Groogy

View GitHub Profile
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);
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);
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)
/* 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;
#version 330
vertex
{
layout(location = 0) in vec4 position;
void main()
{
gl_Position = position;
}
}
MessageType foo = MessageType(Messages.Base) ~ MessageType(Messages.Window) ~ MessageType(Messages.Foo);
writeln(foo.toString());
MessageType bar = MessageType("Base.Window.Foo");
writeln(bar.toString());
class BaseSubscriberInterface
{
publlic:
/* stuff */
};
class DerivedSubscriber : public BaseSubscriberInterface
{
public:
void funcThatReceivesMessage(const Message& message);
// 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);
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
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 %}