Skip to content

Instantly share code, notes, and snippets.

View eXpl0it3r's full-sized avatar

Lukas Dürrenberger eXpl0it3r

View GitHub Profile
@eXpl0it3r
eXpl0it3r / Stroke.cpp
Created July 22, 2013 20:13
Stroke - A dirty port to SFML 2.0
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include "Stroke.hpp"
#include <SFML/OpenGL.hpp>
const float myRand(float low, float high)
{
return static_cast<float>(std::rand()) / RAND_MAX * (high - low) + low;
@eXpl0it3r
eXpl0it3r / main.cpp
Created August 18, 2014 19:42
SFML/bugfix/socket_selector
#include <SFML/Network.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include <winsock.h>
int main()
{
std::vector<sf::UdpSocket*> sockets;
sf::SocketSelector selector;
@eXpl0it3r
eXpl0it3r / main.cpp
Last active August 29, 2015 14:05
SFML/feature/strikethrough
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!");
window.setFramerateLimit(60);
sf::Font font;
font.loadFromFile("DroidSans.ttf");
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
while(true)
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
std::cout << "test" << std::endl;
}
#ifndef ENTITY_HPP
#define ENTITY_HPP
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/Transformable.hpp>
#include <SFML/Graphics/RenderStates.hpp>
// Forward declerations
namespace sf
@eXpl0it3r
eXpl0it3r / main.cpp
Last active August 29, 2015 14:16
Mixing Two SFML Sound Buffers
#include <SFML/Config.hpp>
#include <SFML/Audio.hpp>
#include <cmath>
#include <cstdint>
#include <vector>
int main()
{
sf::SoundBuffer buffer1, buffer2;
@eXpl0it3r
eXpl0it3r / screenshot.cpp
Created October 31, 2015 01:24
Non-blocking screenshots with SFML
#include <SFML/Graphics.hpp>
#include <thread>
int main()
{
sf::RenderWindow window({1920, 1080}, "Screenshot!");
sf::Texture tex;
tex.create(1920, 1080);
sf::Clock cl;
@eXpl0it3r
eXpl0it3r / B.cpp
Last active December 14, 2015 08:34
Forward Decleration
#include "B.hpp"
#include "C.hpp"
B::B()
: m_c(nullptr)
{
}
@eXpl0it3r
eXpl0it3r / Group.cpp
Last active November 18, 2016 14:05
Group Drawable
#include "Group.hpp"
Group::Group()
: m_drawables{} {
}
void Group::draw(sf::RenderTarget& target, sf::RenderStates states) const {
for(const auto& drawable : m_drawables) {
target.draw(drawable, states);
@eXpl0it3r
eXpl0it3r / 1-One.cpp
Last active December 13, 2016 17:19
How to return?
function()
{
if(statement)
return value_one;
else
return value_two;
}