Skip to content

Instantly share code, notes, and snippets.

View eXpl0it3r's full-sized avatar

Lukas Dürrenberger eXpl0it3r

View GitHub Profile
auto arrowProps = createProjectileProperties({
position = position,
direction = direction,
speed = 10.0f,
size = {16.0f, 7.0f},
collisionRadius = 8.0f,
ttl = 120,
owner = owner,
texture = "assets.arrow"_hash
}, data)
@eXpl0it3r
eXpl0it3r / test-saving-images.cpp
Last active September 25, 2017 14:57
SFML Test - Saving Images (JPG)
#include <string>
#include <vector>
#include <iostream>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#include <SFML/Graphics.hpp>
int main()
{
std::string path = "jpg\\imagecompression";
@eXpl0it3r
eXpl0it3r / test-loading-images.cpp
Last active September 25, 2017 14:24
SFML Test - Loading Images (JPG)
#include <string>
#include <vector>
#include <iostream>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#include <SFML/Graphics.hpp>
int main()
{
std::string path = "jpg/google";
@eXpl0it3r
eXpl0it3r / test.cpp
Created June 3, 2017 18:32
SFML System Cursor Test Code
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window{{1024, 756}, "Hello World"};
window.setVerticalSyncEnabled(true);
sf::Cursor cursor;
cursor.loadFromSystem(sf::Cursor::Arrow);
window.setMouseCursor(cursor);
@eXpl0it3r
eXpl0it3r / SFML-Steam-Games.md
Last active November 18, 2017 16:34
SFML Games on Steam
@eXpl0it3r
eXpl0it3r / main.cpp
Last active March 2, 2017 22:59
sf::FileInputStream
sf::FileInputStream stream;
stream.open("arial.ttf");
std::vector<char> data(static_cast<std::size_t>(stream.getSize()), 0);
stream.read(data.data(), stream.getSize());
std::string str(data.data(), data.size());
@eXpl0it3r
eXpl0it3r / main.cpp
Last active January 28, 2017 16:57
Simple SFML Example - wglMakeCurrent
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
int main()
{
// Errors happening in the following line (failed to deactivate, created version 0.0, failed to activate, failed to activate):
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window", 7, sf::ContextSettings(24, 8, 0, 2, 0));
sf::Texture texture;
@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;
}
@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 / B.cpp
Last active December 14, 2015 08:34
Forward Decleration
#include "B.hpp"
#include "C.hpp"
B::B()
: m_c(nullptr)
{
}