Skip to content

Instantly share code, notes, and snippets.

View kim366's full-sized avatar

Kim Schmider kim366

  • Sydney
View GitHub Profile
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
using StaticArrays
mutable struct CAcceleration
a::SVector{2, Float32}
end
mutable struct CPosition
p::SVector{2, Float32}
end
acpi | perl -ne '$_=~m/(\\d+)(?=%)/;print "$1"'
sf::Vector2f put_point_on_line(sf::Vector2f point, sf::Vector2f line_point0, sf::Vector2f line_point1)
{
const sf::Vector2f line_seg{line_point1 - line_point0};
return line_point1 + unitV(line_seg) * dot(unitV(line_seg), point - line_point1);
}
sf::Vector2f put_point_on_line(sf::Vector2f point, sf::Vector2f line_point0, sf::Vector2f line_point1)
{
const double new_point_x
{
(
point.x * std::pow(line_point0.x - line_point1.x, 2)
+
(
point.y * (line_point0.x - line_point1.x)
- line_point0.x * line_point1.y
#include <SFML/Graphics.hpp>
#include <cassert>
#include <array>
#include <algorithm>
// #define CATCH_CONFIG_MAIN
// #include <catch.hpp>
void draw_lines(const std::vector<sf::Vector2f>& vector_, sf::RenderTarget& target_, sf::Color color_ = sf::Color::White)
{
for (auto it{vector_.cbegin()}; it != vector_.cend();)
#include <SFML/Graphics.hpp>
// #define CATCH_CONFIG_MAIN
// #include <catch.hpp>
void draw_lines(const std::vector<sf::Vector2f>& vector, sf::RenderWindow& window, sf::Color color = sf::Color::White)
{
for (auto it{vector.cbegin()}; it != vector.cend();)
{
auto current_it{it};
if (++it != vector.cend())
@kim366
kim366 / Mix.frag
Created August 26, 2017 21:14
SFML Layer Mask
// Most credit to @fallahn
#version 120
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform sampler2D maskTex;
void main()
{
#include <SFML/Graphics.hpp>
#include <stdio.h>
#include <set>
#include <vector>
#include <math.h>
#include <assert.h>
const sf::Vector2u window_size{1280, 720};
sf::CircleShape player{20.f};
@kim366
kim366 / new.cpp
Last active October 24, 2016 16:17
Dry SFML Event/Keyboard Poll code
sf::Event event;
while (window.pollEvent(event))
{
using k = sf::Keyboard;
using e = sf::Event;
auto kc = event.key.code;
auto et = event.type;
auto kp = e::KeyPressed;
//DIREKTER VERGLEICH/////////////////////////////////////////////////