Skip to content

Instantly share code, notes, and snippets.

Check collision for X:
If there's collision, xVelocity = 0
Check colision for Y:
If there's collision, yVelocity = 0
If there was a collision on X but not on Y, check if the top or bottom (depending on our position) is free, and if yes, yVelocity = -1 or 1 (depending on our position vs the box that we collided on)
Check collision for X:
If there's collision, xVelocity = 0
Check colision for Y:
If there's collision, yVelocity = 0
If there was a collision on X but not on Y, check if the top or bottom (depending on our position) is free, and if yes, yVelocity = -1 or 1 (depending on our position vs the box that we collided on)
Check collision for X:
If there's collision, xVelocity = 0
Check colision for Y:
If there's collision, yVelocity = 0
If there was a collision on X but not on Y, check if the top or bottom (depending on our position) is free, and if yes, yVelocity = -1 or 1 (depending on our position vs the box that we collided on)
for (unsigned int i = 0; i < dimensions.x; ++i) {
for (unsigned int j = 0; j < dimensions.y; ++j) {
Tile tile = tiles[i + j * dimensions.x];
if (tile.hasChanged()) {
sf::Vertex *quad = &vertices[(i + j * dimensions.x) * 4];
quad[0].position = sf::Vector2f(i * block_size, j * block_size);
quad[1].position = sf::Vector2f((i + 1) * block_size, j * block_size);
quad[2].position = sf::Vector2f((i+1) * block_size, (j+1) * block_size);
quad[3].position = sf::Vector2f(i * block_size, (j+1) * block_size);
sf::Vector3f x(start_color.r, start_color.g, start_color.b);
sf::Vector3f y(end_color.r, end_color.g, end_color.b);
const float max_time = fade_duration; // == 1.0f
const float current_time = fade_timer.restart().asSeconds();
const float a = std::min(1.0f, std::max(0.0f, current_time - max_time));
sf::Vector3f interp = x * (1 - a) + y * a;
#ifndef BUTTON_H
#define BUTTON_H
#include <SFML/Graphics.hpp>
#include "screen.h"
const sf::Color bgColor = sf::Color::Red;
const sf::Color fgColor = sf::Color::White;
enum ButtonState {
in Button.h:
typedef std::function<void()> * Func;
class Button : public Widget {
public:
void onClick(Func);
private:
Func clickFunction;
};
(sublime_text:19227): Gtk-WARNING **: Error loading theme icon 'gtk-cancel' for stock: Fatal error reading PNG image file: bad parameters to zlib
(sublime_text:19227): Gtk-WARNING **: Error loading theme icon 'document-save' for stock: Fatal error reading PNG image file: bad parameters to zlib
(sublime_text:19227): Gtk-WARNING **: Error loading theme icon 'dialog-warning' for stock: Fatal error reading PNG image file: bad parameters to zlib
(sublime_text:19227): Gtk-WARNING **: Error loading theme icon 'gtk-cancel' for stock: Fatal error reading PNG image file: bad parameters to zlib
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:239:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__4034855744871129296__call__2770033522660119263__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
ext/common/Utils/MD5.cpp:218:15: error: 'c' was not declared in this scope
SET(a, b, c, d, 0, 7, T1);
^
ext/common/Utils/MD5.cpp:213:29: note: in definition of macro 'F'
#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
^
ext/common/Utils/MD5.cpp:218:5: note: in expansion of macro 'SET'
SET(a, b, c, d, 0, 7, T1);
^
ext/common/Utils/MD5.cpp:218:18: error: 'd' was not declared in this scope